ume 2006-11-19 07:17:22 UTC FreeBSD src repository Modified files: (Branch: RELENG_6) sys/modules/if_ppp Makefile sys/net if_ppp.c if_pppvar.h Log: MFC: Teach an IPv6 to ppp(4). sys/modules/if_ppp/Makefile: 1.37 sys/net/if_ppp.c: 1.118 sys/net/if_pppvar.h: 1.25 Revision Changes Path 1.33.2.4 +11 -1 src/sys/modules/if_ppp/Makefile 1.105.2.5 +54 -0 src/sys/net/if_ppp.c 1.23.2.2 +2 -1 src/sys/net/if_pppvar.h ume 2006-11-11 15:02:04 UTC FreeBSD src repository Modified files: sys/modules/if_ppp Makefile sys/net if_ppp.c if_pppvar.h Log: Teach an IPv6 to ppp(4). Obtained from: NetBSD MFC after: 1 week Revision Changes Path 1.37 +11 -1 src/sys/modules/if_ppp/Makefile 1.118 +54 -0 src/sys/net/if_ppp.c 1.25 +2 -1 src/sys/net/if_pppvar.h Index: sys/modules/if_ppp/Makefile diff -u sys/modules/if_ppp/Makefile.orig sys/modules/if_ppp/Makefile --- sys/modules/if_ppp/Makefile.orig Mon Sep 25 17:14:33 2006 +++ sys/modules/if_ppp/Makefile Sat Nov 11 23:48:19 2006 @@ -4,12 +4,17 @@ KMOD= if_ppp SRCS= if_ppp.c ppp_tty.c slcompress.c \ - opt_inet.h opt_ipx.h opt_mac.h opt_ppp.h + opt_inet.h opt_inet6.h opt_ipx.h opt_mac.h opt_ppp.h PPP_BSDCOMP?= 1 # 0/1 PPP_DEFLATE?= 1 # 0/1 PPP_FILTER?= 1 # 0/1 - requires bpf to be configured in kernel PPP_INET?= 1 # 0/1 - requires INET to be configured in kernel +.if defined(NO_INET6) +PPP_INET6?= 0 # 0/1 - requires INET6 to be configured in kernel +.else +PPP_INET6?= 1 # 0/1 - requires INET6 to be configured in kernel +.endif PPP_IPX?= 0 # 0/1 - requires IPX to be configured in kernel .if ${PPP_BSDCOMP} > 0 @@ -23,6 +28,11 @@ .if ${PPP_INET} > 0 opt_inet.h: echo "#define INET 1" > ${.TARGET} +.endif + +.if ${PPP_INET6} > 0 +opt_inet6.h: + echo "#define INET6 1" > ${.TARGET} .endif .if ${PPP_IPX} > 0 Index: sys/net/if_ppp.c diff -u -p sys/net/if_ppp.c.orig sys/net/if_ppp.c --- sys/net/if_ppp.c.orig Sun Oct 29 03:09:40 2006 +++ sys/net/if_ppp.c Sat Nov 11 23:26:13 2006 @@ -76,6 +76,7 @@ /* from NetBSD: if_ppp.c,v 1.15.2.2 1994/07/28 05:17:58 cgd Exp */ #include "opt_inet.h" +#include "opt_inet6.h" #include "opt_ipx.h" #include "opt_mac.h" #include "opt_ppp.h" @@ -577,6 +578,9 @@ pppioctl(sc, cmd, data, flag, td) case PPP_IP: npx = NP_IP; break; + case PPP_IPV6: + npx = NP_IPV6; + break; default: error = EINVAL; } @@ -684,6 +688,10 @@ pppsioctl(ifp, cmd, data) case AF_INET: break; #endif +#ifdef INET6 + case AF_INET6: + break; +#endif #ifdef IPX case AF_IPX: break; @@ -700,6 +708,10 @@ pppsioctl(ifp, cmd, data) case AF_INET: break; #endif +#ifdef INET6 + case AF_INET6: + break; +#endif #ifdef IPX case AF_IPX: break; @@ -737,6 +749,10 @@ pppsioctl(ifp, cmd, data) case AF_INET: break; #endif +#ifdef INET6 + case AF_INET6: + break; +#endif default: error = EAFNOSUPPORT; break; @@ -834,6 +850,24 @@ pppoutput(ifp, m0, dst, rtp) m0->m_flags |= M_HIGHPRI; break; #endif +#ifdef INET6 + case AF_INET6: + address = PPP_ALLSTATIONS; /*XXX*/ + control = PPP_UI; /*XXX*/ + protocol = PPP_IPV6; + mode = sc->sc_npmode[NP_IPV6]; + +#if 0 /* XXX flowinfo/traffic class, maybe? */ + /* + * If this packet has the "low delay" bit set in the IP header, + * put it on the fastq instead. + */ + ip = mtod(m0, struct ip *); + if (ip->ip_tos & IPTOS_LOWDELAY) + m0->m_flags |= M_HIGHPRI; +#endif + break; +#endif #ifdef IPX case AF_IPX: /* @@ -990,6 +1024,9 @@ ppp_requeue(sc) case PPP_IP: mode = sc->sc_npmode[NP_IP]; break; + case PPP_IPV6: + mode = sc->sc_npmode[NP_IPV6]; + break; default: mode = NPMODE_PASS; } @@ -1590,6 +1627,23 @@ ppp_inproc(sc, m) if (ip_fastforward(m)) return; isr = NETISR_IP; + break; +#endif +#ifdef INET6 + case PPP_IPV6: + /* + * IPv6 packet - take off the ppp header and pass it up to IPv6. + */ + if ((ifp->if_flags & IFF_UP) == 0 + || sc->sc_npmode[NP_IPV6] != NPMODE_PASS) { + /* interface is down - drop the packet. */ + m_freem(m); + return; + } + m->m_pkthdr.len -= PPP_HDRLEN; + m->m_data += PPP_HDRLEN; + m->m_len -= PPP_HDRLEN; + isr = NETISR_IPV6; break; #endif #ifdef IPX Index: sys/net/if_pppvar.h diff -u sys/net/if_pppvar.h.orig sys/net/if_pppvar.h --- sys/net/if_pppvar.h.orig Fri Aug 19 23:52:21 2005 +++ sys/net/if_pppvar.h Sat Nov 11 14:36:30 2006 @@ -48,7 +48,8 @@ * indexing sc_npmode. */ #define NP_IP 0 /* Internet Protocol */ -#define NUM_NP 1 /* Number of NPs. */ +#define NP_IPV6 1 /* Internet Protocol version 6 */ +#define NUM_NP 2 /* Number of NPs. */ /* * Structure describing each ppp unit.