summaryrefslogtreecommitdiffstats
path: root/sys/net
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/net
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/net')
-rw-r--r--sys/net/if_ppp.c54
-rw-r--r--sys/net/if_pppvar.h3
2 files changed, 56 insertions, 1 deletions
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