--- /usr/src/sys/conf/files	Wed Mar  8 11:17:06 2000
+++ conf/files	Sat Apr 29 07:43:06 2000
@@ -672,6 +672,9 @@
 netgraph/ng_UI.c	optional netgraph_UI
 netgraph/ng_vjc.c	optional netgraph_vjc
 net/slcompress.c	optional netgraph_vjc
+netipopt/ipopt_proto.c	optional ipoption
+netipopt/ipopt_usrreq.c	optional ipoption
+netipopt/ipopt_input.c	optional ipoption
 netinet/if_atm.c	optional atm
 netinet/if_ether.c	optional ether
 netinet/in_gif.c	optional gif inet
--- /usr/src/sys/conf/options	Wed Feb 23 15:10:53 2000
+++ conf/options	Sat Apr 29 07:54:03 2000
@@ -244,6 +244,7 @@
 IPSEC_IPV6FWD		opt_ipsec.h
 IPDIVERT
 DUMMYNET		opt_ipdn.h
+IPOPTION		opt_ipoption.h
 IPFILTER		opt_ipfilter.h
 IPFILTER_LOG		opt_ipfilter.h
 IPFIREWALL		opt_ipfw.h
--- /usr/src/sys/i386/conf/LINT	Thu Mar  9 11:32:56 2000
+++ i386/conf/LINT	Sat Apr 29 08:10:46 2000
@@ -380,6 +380,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
 #options 	NSIP			#XNS over IP
--- /usr/src/sys/netinet/ip.h	Wed Dec 22 14:13:20 1999
+++ netinet/ip.h	Sat Apr 29 07:30:54 2000
@@ -166,6 +166,19 @@
 #define	IPOPT_TS_TSANDADDR	1		/* timestamps and addresses */
 #define	IPOPT_TS_PRESPEC	3		/* specified modules only */
 
+/*
+ * Router Alert option structure.
+ */
+struct  ip_routeralert {
+	u_char	ipa_code;		/* IPOPT_RA */
+	u_char	ipa_len;		/* size of structure, always 4  */
+	u_short	ipa_val;		/* value */
+};
+
+/* Router Alert values */
+#define IPOPT_RA_EXAM	0
+#define IPOPT_RA_RTCP	1
+
 /* bits for security (not byte swapped) */
 #define	IPOPT_SECUR_UNCLASS	0x0000
 #define	IPOPT_SECUR_CONFID	0xf135
--- /usr/src/sys/netinet/in.h	Thu Feb 10 14:33:55 2000
+++ netinet/in.h	Mon Jun  5 16:21:38 2000
@@ -343,6 +343,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	Wed Feb 23 15:11:57 2000
+++ netinet/ip_input.c	Mon Jun  5 16:25:03 2000
@@ -43,6 +43,7 @@
 #include "opt_ipfilter.h"
 #include "opt_ipstealth.h"
 #include "opt_ipsec.h"
+#include "opt_ipoption.h"
 
 #include <stddef.h>
 
@@ -200,6 +201,13 @@
 
 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));
@@ -576,6 +584,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.
@@ -1250,7 +1263,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);
@@ -1475,6 +1492,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	Wed Jan 19 01:07:34 2000
+++ sys/mount.h	Sun May 21 00:00:34 2000
@@ -372,7 +372,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	Sat Mar 11 14:51:04 2000
+++ sys/socket.h	Sun May 21 00:00:28 2000
@@ -138,8 +138,9 @@
 					 * 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
@@ -215,6 +216,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
 
@@ -262,6 +264,7 @@
 	{ "atm", CTLTYPE_NODE }, \
 	{ "hdrcomplete", CTLTYPE_NODE }, \
 	{ "netgraph", CTLTYPE_NODE }, \
+	{ "ipoption", CTLTYPE_NODE }, \
 }
 
 /*
--- /usr/include/sys/mount.h	Mon Mar 20 16:27:25 2000
+++ sys/mount.h	Sun May 21 00:00:34 2000
@@ -372,7 +372,7 @@
 
 #include <net/radix.h>
 
-#define	AF_MAX		33	/* XXX */
+#define	AF_MAX		34	/* XXX */
 
 /*
  * Network address lookup element
--- /usr/include/sys/socket.h	Mon Mar 20 16:27:25 2000
+++ sys/socket.h	Sun May 21 00:00:28 2000
@@ -138,8 +138,9 @@
 					 * 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
@@ -215,6 +216,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
 
@@ -262,6 +264,7 @@
 	{ "atm", CTLTYPE_NODE }, \
 	{ "hdrcomplete", CTLTYPE_NODE }, \
 	{ "netgraph", CTLTYPE_NODE }, \
+	{ "ipoption", CTLTYPE_NODE }, \
 }
 
 /*
--- /usr/include/netinet/ip.h	Mon Mar 20 16:27:25 2000
+++ netinet/ip.h	Sat Apr 29 07:30:54 2000
@@ -166,6 +166,19 @@
 #define	IPOPT_TS_TSANDADDR	1		/* timestamps and addresses */
 #define	IPOPT_TS_PRESPEC	3		/* specified modules only */
 
+/*
+ * Router Alert option structure.
+ */
+struct  ip_routeralert {
+	u_char	ipa_code;		/* IPOPT_RA */
+	u_char	ipa_len;		/* size of structure, always 4  */
+	u_short	ipa_val;		/* value */
+};
+
+/* Router Alert values */
+#define IPOPT_RA_EXAM	0
+#define IPOPT_RA_RTCP	1
+
 /* bits for security (not byte swapped) */
 #define	IPOPT_SECUR_UNCLASS	0x0000
 #define	IPOPT_SECUR_CONFID	0xf135
--- /usr/include/netinet/in.h	Mon Mar 20 16:27:25 2000
+++ netinet/in.h	Mon Jun  5 16:21:38 2000
@@ -343,6 +343,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
  */
