--- /usr/src/sys/conf/files	Tue Apr 18 09:33:02 2000
+++ conf/files	Wed Jul 12 14:37:32 2000
@@ -565,6 +565,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	Tue Jun 13 04:48:00 2000
+++ conf/options	Wed Jul 12 14:36:34 2000
@@ -227,6 +227,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 Jun 13 04:48:06 2000
+++ i386/conf/LINT	Wed Jul 12 14:39:17 2000
@@ -365,6 +365,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	Wed Jul 12 14:43:37 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	Wed Jul 12 14:41:09 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	Tue Jun 13 03:12:34 2000
+++ netinet/ip_input.c	Wed Jul 12 14:48:22 2000
@@ -43,6 +43,7 @@
 #include "opt_ipdivert.h"
 #include "opt_ipfilter.h"
 #include "opt_ipstealth.h"
+#include "opt_ipoption.h"
 
 #include <stddef.h>
 
@@ -201,6 +202,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));
@@ -566,6 +576,10 @@
 
 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.
@@ -1218,6 +1232,9 @@
 			    sizeof(n_time));
 			ipt->ipt_ptr += sizeof(n_time);
 		}
+#ifdef IPOPTION
+		ipopt_map(opt, cp, ip); 
+#endif
 	}
 	if (forward && ipforwarding) {
 		ip_forward(m, 1);
@@ -1440,6 +1457,11 @@
 		ip->ip_ttl -= IPTTLDEC;
 #ifdef IPSTEALTH
 	}
+#endif
+
+#ifdef IPOPTION
+	if (ipopt_input(m, 0))
+		return; 
 #endif
 
 	sin = (struct sockaddr_in *)&ipforward_rt.ro_dst;
--- /usr/src/sys/sys/mount.h	Mon Nov 22 02:08:11 1999
+++ sys/mount.h	Wed Jul 12 14:49:15 2000
@@ -373,7 +373,7 @@
 
 #include <net/radix.h>
 
-#define	AF_MAX		33	/* XXX */
+#define	AF_MAX		34	/* XXX */
 
 /*
  * Network address lookup element
--- /usr/src/sys/sys/socket.h	Wed Mar  8 01:32:44 2000
+++ sys/socket.h	Wed Jul 12 15:00:00 2000
@@ -138,8 +138,9 @@
 					 * headers in interface output routine
 					 */
 #define	AF_NETGRAPH	32		/* Netgraph sockets */
+#define AF_IPOPTION	33		/* used to demux on IP Option value */
 
-#define	AF_MAX		33
+#define	AF_MAX		34
 
 /*
  * Structure used by kernel to store most
@@ -198,6 +199,7 @@
 #define	PF_NATM		AF_NATM
 #define	PF_ATM		AF_ATM
 #define	PF_NETGRAPH	AF_NETGRAPH
+#define	PF_IPOPTION	AF_IPOPTION
 
 #define	PF_MAX		AF_MAX
 
--- /usr/include/sys/mount.h	Wed Jun 21 23:09:07 2000
+++ sys/mount.h	Wed Jul 12 14:49:15 2000
@@ -373,7 +373,7 @@
 
 #include <net/radix.h>
 
-#define	AF_MAX		33	/* XXX */
+#define	AF_MAX		34	/* XXX */
 
 /*
  * Network address lookup element
--- /usr/include/sys/socket.h	Wed Jun 21 23:09:08 2000
+++ sys/socket.h	Wed Jul 12 15:00:00 2000
@@ -138,8 +138,9 @@
 					 * headers in interface output routine
 					 */
 #define	AF_NETGRAPH	32		/* Netgraph sockets */
+#define AF_IPOPTION	33		/* used to demux on IP Option value */
 
-#define	AF_MAX		33
+#define	AF_MAX		34
 
 /*
  * Structure used by kernel to store most
@@ -198,6 +199,7 @@
 #define	PF_NATM		AF_NATM
 #define	PF_ATM		AF_ATM
 #define	PF_NETGRAPH	AF_NETGRAPH
+#define	PF_IPOPTION	AF_IPOPTION
 
 #define	PF_MAX		AF_MAX
 
--- /usr/include/netinet/ip.h	Wed Jun 21 23:09:06 2000
+++ netinet/ip.h	Wed Jul 12 14:43:37 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	Wed Jun 21 23:09:06 2000
+++ netinet/in.h	Wed Jul 12 14:41:09 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
  */
