-.\" $OpenBSD: ppp.4,v 1.16 2015/07/28 14:31:50 sthen Exp $
+.\" $OpenBSD: ppp.4,v 1.17 2024/02/28 16:08:34 denis Exp $
.\"
.\" Copyright (c) 1983, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
.\" From: @(#)lo.4 8.1 (Berkeley) 6/5/93
.\"
-.Dd $Mdocdate: July 28 2015 $
+.Dd $Mdocdate: February 28 2024 $
.Dt PPP 4
.Os
.Sh NAME
.Nm
device appeared in
.Ox 1.2 .
-.Sh BUGS
-Currently, only the
-.Xr ip 4
-protocol is supported by this device.
-Note that the
-.Xr pppoe 4
-device does support
-.Xr ip6 4 .
-/* $OpenBSD: if_ppp.c,v 1.117 2020/08/21 22:59:27 kn Exp $ */
+/* $OpenBSD: if_ppp.c,v 1.118 2024/02/28 16:08:34 denis Exp $ */
/* $NetBSD: if_ppp.c,v 1.39 1997/05/17 21:11:59 christos Exp $ */
/*
case PPP_IP:
npx = NP_IP;
break;
+#ifdef INET6
+ case PPP_IPV6:
+ npx = NP_IPV6;
+ break;
+#endif
default:
return EINVAL;
}
break;
case SIOCSIFADDR:
- if (ifa->ifa_addr->sa_family != AF_INET)
- error = EAFNOSUPPORT;
- break;
-
case SIOCSIFDSTADDR:
- if (ifa->ifa_addr->sa_family != AF_INET)
+ switch (ifa->ifa_addr->sa_family) {
+ case AF_INET:
+ break;
+#ifdef INET6
+ case AF_INET6:
+ break;
+#endif
+ default:
error = EAFNOSUPPORT;
+ break;
+ }
break;
-
case SIOCSIFMTU:
sc->sc_if.if_mtu = ifr->ifr_mtu;
break;
protocol = PPP_IP;
mode = sc->sc_npmode[NP_IP];
break;
+#ifdef INET6
+ case AF_INET6:
+ address = PPP_ALLSTATIONS;
+ control = PPP_UI;
+ protocol = PPP_IPV6;
+ mode = sc->sc_npmode[NP_IPV6];
+ break;
+#endif
case AF_UNSPEC:
address = PPP_ADDRESS(dst->sa_data);
control = PPP_CONTROL(dst->sa_data);
case PPP_IP:
mode = sc->sc_npmode[NP_IP];
break;
+#ifdef INET6
+ case PPP_IPV6:
+ mode = sc->sc_npmode[NP_IPV6];
+ break;
+#endif
default:
mode = NPMODE_PASS;
}
ipv4_input(ifp, m);
rv = 1;
break;
+#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;
+ ipv6_input(ifp, m);
+ rv = 1;
+ break;
+#endif
default:
/*
* Some other protocol - place on input queue for read().
-/* $OpenBSD: if_pppvar.h,v 1.20 2020/05/20 06:44:30 mpi Exp $ */
+/* $OpenBSD: if_pppvar.h,v 1.21 2024/02/28 16:08:34 denis Exp $ */
/* $NetBSD: if_pppvar.h,v 1.5 1997/01/03 07:23:29 mikel Exp $ */
/*
* if_pppvar.h - private structures and declarations for PPP.
* indexing sc_npmode.
*/
#define NP_IP 0 /* Internet Protocol */
-#define NUM_NP 1 /* Number of NPs. */
+#define NP_IPV6 1 /* Internet Protocol v6 */
+#define NUM_NP 2 /* Number of NPs. */
struct ppp_pkt;