--- /usr/src/sys/conf/files	Sat Sep 11 11:46:07 1999
+++ conf/files	Fri May 19 10:14:55 2000
@@ -538,6 +538,9 @@
 netinet/tcp_timer.c	optional inet
 netinet/tcp_usrreq.c	optional inet
 netinet/udp_usrreq.c	optional inet
+netipopt/ipopt_proto.c  optional ipoption
+netipopt/ipopt_usrreq.c optional ipoption
+netipopt/ipopt_input.c  optional ipoption
 netipx/ipx.c		optional ipx
 netipx/ipx_cksum.c	optional ipx
 netipx/ipx_input.c	optional ipx
--- /usr/src/sys/conf/options	Sun Aug 29 12:22:03 1999
+++ conf/options	Fri May 19 10:15:40 2000
@@ -212,6 +212,7 @@
 INET			opt_inet.h
 IPDIVERT
 DUMMYNET		opt_ipdn.h
+IPOPTION		opt_ipoption.h
 IPFIREWALL		opt_ipfw.h
 IPFIREWALL_VERBOSE	opt_ipfw.h
 IPFIREWALL_VERBOSE_LIMIT	opt_ipfw.h
--- /usr/src/sys/i386/conf/LINT	Tue Sep 14 18:53:31 1999
+++ i386/conf/LINT	Fri May 19 10:16:48 2000
@@ -371,6 +371,8 @@
 
 options		NETATALK		#Appletalk communications protocols
 
+options		IPOPTION		# IP Options
+
 # These are currently broken but are shipped due to interest.
 #options		NS			#Xerox NS protocols
 
--- /usr/src/sys/netinet/ip.h	Sun Aug 29 12:29:38 1999
+++ netinet/ip.h	Fri May 19 10:23:59 2000
@@ -172,6 +172,20 @@
 #define	IPOPT_SECUR_TOPSECRET	0x6bc5
 
 /*
+ * Router Alert option structure.
+ */
+struct	ip_routeralert {
+	u_char	ipa_code;		/* IPOPT_RA */
+	u_char	ipa_len;		/* size of structure, 4  */
+	u_short	ipa_val;		/* value */
+};
+
+/* Router Alert values */
+#define IPOPT_RA_EXAM	0
+#define IPOPT_RA_RTCP	1
+
+
+/*
  * Internet implementation parameters.
  */
 #define	MAXTTL		255		/* maximum time to live (seconds) */
--- /usr/src/sys/netinet/in.h	Sun Aug 29 12:29:34 1999
+++ netinet/in.h	Mon Jun  5 21:20:44 2000
@@ -330,6 +330,11 @@
 #define	IP_DUMMYNET_FLUSH	62   /* flush dummynet */
 #define	IP_DUMMYNET_GET		64   /* get entire dummynet pipes */
 
+#define IPOPT_RECVLOCAL		70   /* pick up pkt's coming to local box */
+#define IPOPT_RECVRA		71   /* pick up all router alert pkt's */
+#define IPOPT_RECVRSVP		72   /* pick up RSVP router alert pkt's only */
+#define IPOPT_RECVRTCP		73   /* pick up RTCP router alert pkt's only */
+
 /*
  * Defaults and limits for options
  */
--- /usr/src/sys/netinet/ip_input.c	Sun Aug 29 12:29:46 1999
+++ netinet/ip_input.c	Mon Jun  5 21:31:59 2000
@@ -42,6 +42,7 @@
 #include "opt_ipdn.h"
 #include "opt_ipdivert.h"
 #include "opt_ipfilter.h"
+#include "opt_ipoption.h"
 
 #include <stddef.h>
 
@@ -196,6 +197,15 @@
 
 struct sockaddr_in *ip_fw_fwd_addr;
 
+#ifdef IPOPTION
+
+#define IPOPT_LOCAL     1
+
+void ipopt_map __P((int, u_char *, struct ip *));
+int ipopt_input __P((struct mbuf *m, int flag));
+
+#endif
+
 static void save_rte __P((u_char *, struct in_addr));
 static int	 ip_dooptions __P((struct mbuf *));
 static void	 ip_forward __P((struct mbuf *, int));
@@ -567,6 +577,11 @@
 
 ours:
 
+#ifdef IPOPTION
+	if (ipopt_input(m, IPOPT_LOCAL))
+		return;
+#endif
+
 	/*
 	 * If offset or IP_MF are set, must reassemble.
 	 * Otherwise, nothing need be done.
@@ -1210,7 +1225,11 @@
 			    sizeof(n_time));
 			ipt->ipt_ptr += sizeof(n_time);
 		}
+#ifdef IPOPTION
+		ipopt_map(opt, cp, ip);
+#endif 
 	}
+
 	if (forward && ipforwarding) {
 		ip_forward(m, 1);
 		return (1);
@@ -1426,6 +1445,11 @@
 		return;
 	}
 	ip->ip_ttl -= IPTTLDEC;
+
+#ifdef IPOPTION
+	if (ipopt_input(m, 0))
+		return;
+#endif
 
 	sin = (struct sockaddr_in *)&ipforward_rt.ro_dst;
 	if ((rt = ipforward_rt.ro_rt) == 0 ||
--- /usr/src/sys/sys/mount.h	Sun Aug 29 12:32:33 1999
+++ sys/mount.h	Fri May 19 10:32:35 2000
@@ -373,7 +373,7 @@
 
 #include <net/radix.h>
 
-#define	AF_MAX		31	/* XXX */
+#define	AF_MAX		32	/* XXX */
 
 /*
  * Network address lookup element
--- /usr/src/sys/sys/socket.h	Sun Aug 29 12:32:44 1999
+++ sys/socket.h	Fri May 19 11:27:00 2000
@@ -128,8 +128,9 @@
 #define	AF_INET6	28		/* IPv6 */
 #define	AF_NATM		29		/* native ATM access */
 #define	AF_ATM		30		/* ATM */
+#define AF_IPOPTION	31		/* used to demux on IP Option value */
 
-#define	AF_MAX		31
+#define	AF_MAX		32
 
 /*
  * Structure used by kernel to store most
@@ -187,6 +188,7 @@
 #define	PF_INET6	AF_INET6
 #define	PF_NATM		AF_NATM
 #define	PF_ATM		AF_ATM
+#define	PF_IPOPTION	AF_IPOPTION
 
 #define	PF_MAX		AF_MAX
 
@@ -231,6 +233,7 @@
 	{ "key", CTLTYPE_NODE }, \
 	{ "inet6", CTLTYPE_NODE }, \
 	{ "natm", CTLTYPE_NODE }, \
+	{ "ipoption", CTLTYPE_NODE }, \
 }
 
 /*
--- /usr/include/sys/mount.h	Thu Sep 16 18:40:32 1999
+++ sys/mount.h	Fri May 19 10:32:35 2000
@@ -373,7 +373,7 @@
 
 #include <net/radix.h>
 
-#define	AF_MAX		31	/* XXX */
+#define	AF_MAX		32	/* XXX */
 
 /*
  * Network address lookup element
--- /usr/include/sys/socket.h	Thu Sep 16 18:40:33 1999
+++ sys/socket.h	Fri May 19 11:27:00 2000
@@ -128,8 +128,9 @@
 #define	AF_INET6	28		/* IPv6 */
 #define	AF_NATM		29		/* native ATM access */
 #define	AF_ATM		30		/* ATM */
+#define AF_IPOPTION	31		/* used to demux on IP Option value */
 
-#define	AF_MAX		31
+#define	AF_MAX		32
 
 /*
  * Structure used by kernel to store most
@@ -187,6 +188,7 @@
 #define	PF_INET6	AF_INET6
 #define	PF_NATM		AF_NATM
 #define	PF_ATM		AF_ATM
+#define	PF_IPOPTION	AF_IPOPTION
 
 #define	PF_MAX		AF_MAX
 
@@ -231,6 +233,7 @@
 	{ "key", CTLTYPE_NODE }, \
 	{ "inet6", CTLTYPE_NODE }, \
 	{ "natm", CTLTYPE_NODE }, \
+	{ "ipoption", CTLTYPE_NODE }, \
 }
 
 /*
--- /usr/include/netinet/ip.h	Thu Sep 16 18:40:31 1999
+++ netinet/ip.h	Fri May 19 10:23:59 2000
@@ -172,6 +172,20 @@
 #define	IPOPT_SECUR_TOPSECRET	0x6bc5
 
 /*
+ * Router Alert option structure.
+ */
+struct	ip_routeralert {
+	u_char	ipa_code;		/* IPOPT_RA */
+	u_char	ipa_len;		/* size of structure, 4  */
+	u_short	ipa_val;		/* value */
+};
+
+/* Router Alert values */
+#define IPOPT_RA_EXAM	0
+#define IPOPT_RA_RTCP	1
+
+
+/*
  * Internet implementation parameters.
  */
 #define	MAXTTL		255		/* maximum time to live (seconds) */
--- /usr/include/netinet/in.h	Thu Sep 16 18:40:31 1999
+++ netinet/in.h	Mon Jun  5 21:20:44 2000
@@ -330,6 +330,11 @@
 #define	IP_DUMMYNET_FLUSH	62   /* flush dummynet */
 #define	IP_DUMMYNET_GET		64   /* get entire dummynet pipes */
 
+#define IPOPT_RECVLOCAL		70   /* pick up pkt's coming to local box */
+#define IPOPT_RECVRA		71   /* pick up all router alert pkt's */
+#define IPOPT_RECVRSVP		72   /* pick up RSVP router alert pkt's only */
+#define IPOPT_RECVRTCP		73   /* pick up RTCP router alert pkt's only */
+
 /*
  * Defaults and limits for options
  */
