summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorume <ume@FreeBSD.org>2006-11-11 15:02:04 +0000
committerume <ume@FreeBSD.org>2006-11-11 15:02:04 +0000
commit0100d343f488d0d5c2e70c793182caa2fe89fcc0 (patch)
treed08d60736ad415f0da01d8344936991b717c3d05 /sys
parent01440ba8481572538f4dc4c63180f9e3182bf004 (diff)
downloadFreeBSD-src-0100d343f488d0d5c2e70c793182caa2fe89fcc0.zip
FreeBSD-src-0100d343f488d0d5c2e70c793182caa2fe89fcc0.tar.gz
Teach an IPv6 to ppp(4).
Obtained from: NetBSD MFC after: 1 week
Diffstat (limited to 'sys')
-rw-r--r--sys/modules/if_ppp/Makefile12
-rw-r--r--sys/net/if_ppp.c54
-rw-r--r--sys/net/if_pppvar.h3
3 files changed, 67 insertions, 2 deletions
diff --git a/sys/modules/if_ppp/Makefile b/sys/modules/if_ppp/Makefile
index 5ba5039..ce7bdb0 100644
--- a/sys/modules/if_ppp/Makefile
+++ b/sys/modules/if_ppp/Makefile
@@ -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
@@ -25,6 +30,11 @@ 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
opt_ipx.h:
echo "#define IPX ${PPP_IPX}" > ${.TARGET}
diff --git a/sys/net/if_ppp.c b/sys/net/if_ppp.c
index d01ed8f..394aa8d 100644
--- a/sys/net/if_ppp.c
+++ b/sys/net/if_ppp.c
@@ -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"
@@ -567,6 +568,9 @@ pppioctl(sc, cmd, data, flag, td)
case PPP_IP:
npx = NP_IP;
break;
+ case PPP_IPV6:
+ npx = NP_IPV6;
+ break;
default:
error = EINVAL;
}
@@ -675,6 +679,10 @@ pppsioctl(ifp, cmd, data)
case AF_INET:
break;
#endif
+#ifdef INET6
+ case AF_INET6:
+ break;
+#endif
#ifdef IPX
case AF_IPX:
break;
@@ -691,6 +699,10 @@ pppsioctl(ifp, cmd, data)
case AF_INET:
break;
#endif
+#ifdef INET6
+ case AF_INET6:
+ break;
+#endif
#ifdef IPX
case AF_IPX:
break;
@@ -732,6 +744,10 @@ pppsioctl(ifp, cmd, data)
case AF_INET:
break;
#endif
+#ifdef INET6
+ case AF_INET6:
+ break;
+#endif
default:
error = EAFNOSUPPORT;
break;
@@ -829,6 +845,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:
/*
@@ -985,6 +1019,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;
}
@@ -1587,6 +1624,23 @@ ppp_inproc(sc, m)
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
case PPP_IPX:
/*
diff --git a/sys/net/if_pppvar.h b/sys/net/if_pppvar.h
index 12c308f..75d99a8 100644
--- a/sys/net/if_pppvar.h
+++ b/sys/net/if_pppvar.h
@@ -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.
OpenPOWER on IntegriCloud