summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsg <jsg@openbsd.org>2016-04-01 04:03:35 +0000
committerjsg <jsg@openbsd.org>2016-04-01 04:03:35 +0000
commit094714e14d6065921587751da8e019d38c7da58e (patch)
tree20198e4fe2e5799ebbc7d2a9fe954e3ccaca03f9
parentwhitespace at EOL (diff)
downloadwireguard-openbsd-094714e14d6065921587751da8e019d38c7da58e.tar.xz
wireguard-openbsd-094714e14d6065921587751da8e019d38c7da58e.zip
Building kernels with PPPOE_SERVER enabled has been broken for at least
eleven years, remove it. Despite what the wildly outdated time(9) claims, there is no longer globally visible "struct timeval mono_time" or "struct timeval time". ok mpi@ sthen@ mikeb@
-rw-r--r--share/man/man4/pppoe.417
-rw-r--r--sys/net/if_ethersubr.c4
-rw-r--r--sys/net/if_pppoe.c198
3 files changed, 4 insertions, 215 deletions
diff --git a/share/man/man4/pppoe.4 b/share/man/man4/pppoe.4
index 67ed6422186..2dc8f88732e 100644
--- a/share/man/man4/pppoe.4
+++ b/share/man/man4/pppoe.4
@@ -1,4 +1,4 @@
-.\" $OpenBSD: pppoe.4,v 1.29 2015/08/12 09:15:49 mpi Exp $
+.\" $OpenBSD: pppoe.4,v 1.30 2016/04/01 04:03:35 jsg Exp $
.\" $NetBSD: pppoe.4,v 1.26 2003/10/02 07:06:36 wiz Exp $
.\"
.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd $Mdocdate: August 12 2015 $
+.Dd $Mdocdate: April 1 2016 $
.Dt PPPOE 4
.Os
.Sh NAME
@@ -153,19 +153,6 @@ driver with this option set will send a PADT packet
The peer will immediately disconnect
the orphaned session and allow a new one to be established.
.Pp
-If the kernel is compiled with option
-.Dv PPPOE_SERVER ,
-there are two modes of connection, controlled via the
-.Em link0
-switch.
-The default mode,
-.Em link0
-not being set, is client mode.
-The
-.Dq PPPoE server
-mode, selected by setting
-.Em link0 ,
-is to wait for incoming PPPoE sessions.
.Sh MTU/MSS ISSUES
Problems can arise on machines with private IPs connecting to the Internet
via a machine running both
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c
index 362bca2203f..eeb488122b3 100644
--- a/sys/net/if_ethersubr.c
+++ b/sys/net/if_ethersubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ethersubr.c,v 1.234 2016/03/01 01:48:14 dlg Exp $ */
+/* $OpenBSD: if_ethersubr.c,v 1.235 2016/04/01 04:03:35 jsg Exp $ */
/* $NetBSD: if_ethersubr.c,v 1.19 1996/05/07 02:40:30 thorpej Exp $ */
/*
@@ -392,10 +392,8 @@ decapsulate:
#if NPPPOE > 0 || defined(PIPEX)
case ETHERTYPE_PPPOEDISC:
case ETHERTYPE_PPPOE:
-#ifndef PPPOE_SERVER
if (m->m_flags & (M_MCAST | M_BCAST))
goto dropanyway;
-#endif
M_PREPEND(m, sizeof(*eh), M_DONTWAIT);
if (m == NULL)
return (1);
diff --git a/sys/net/if_pppoe.c b/sys/net/if_pppoe.c
index 15b2b8a9d39..0b3e4a27462 100644
--- a/sys/net/if_pppoe.c
+++ b/sys/net/if_pppoe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pppoe.c,v 1.52 2015/12/05 10:07:55 tedu Exp $ */
+/* $OpenBSD: if_pppoe.c,v 1.53 2016/04/01 04:03:35 jsg Exp $ */
/* $NetBSD: if_pppoe.c,v 1.51 2003/11/28 08:56:48 keihan Exp $ */
/*
@@ -115,10 +115,6 @@ struct pppoetag {
#define PPPOE_DISC_MAXPADI 4 /* retry PADI four times (quickly) */
#define PPPOE_DISC_MAXPADR 2 /* retry PADR twice */
-#ifdef PPPOE_SERVER
-#define IFF_PASSIVE IFF_LINK0 /* wait passively for connection */
-#endif
-
struct pppoe_softc {
struct sppp sc_sppp; /* contains a struct ifnet as first element */
LIST_ENTRY(pppoe_softc) sc_list;
@@ -134,10 +130,6 @@ struct pppoe_softc {
size_t sc_ac_cookie_len; /* length of cookie data */
u_int8_t *sc_relay_sid; /* content of relay SID we must echo back */
size_t sc_relay_sid_len; /* length of relay SID data */
-#ifdef PPPOE_SERVER
- u_int8_t *sc_hunique; /* content of host unique we must echo back */
- size_t sc_hunique_len; /* length of host unique */
-#endif
u_int32_t sc_unique; /* our unique id */
struct timeout sc_timeout; /* timeout while not in session state */
int sc_padi_retried; /* number of PADI retries already done */
@@ -171,10 +163,6 @@ static void pppoe_timeout(void *);
/* sending actual protocol control packets */
static int pppoe_send_padi(struct pppoe_softc *);
static int pppoe_send_padr(struct pppoe_softc *);
-#ifdef PPPOE_SERVER
-static int pppoe_send_pado(struct pppoe_softc *);
-static int pppoe_send_pads(struct pppoe_softc *);
-#endif
static int pppoe_send_padt(unsigned int, u_int, const u_int8_t *);
/* raw output */
@@ -384,10 +372,6 @@ static void pppoe_dispatch_disc_pkt(struct mbuf *m, int off)
u_int8_t *ac_cookie;
u_int8_t *relay_sid;
u_int8_t code;
-#ifdef PPPOE_SERVER
- u_int8_t *hunique;
- size_t hunique_len;
-#endif
err_msg = NULL;
devname = "pppoe";
@@ -406,10 +390,6 @@ static void pppoe_dispatch_disc_pkt(struct mbuf *m, int off)
relay_sid = NULL;
relay_sid_len = 0;
max_payload = NULL;
-#ifdef PPPOE_SERVER
- hunique = NULL;
- hunique_len = 0;
-#endif
session = 0;
if (m->m_pkthdr.len - off <= PPPOE_HEADERLEN) {
@@ -478,10 +458,6 @@ static void pppoe_dispatch_disc_pkt(struct mbuf *m, int off)
err_msg = "TAG HUNIQUE ERROR";
break;
}
-#ifdef PPPOE_SERVER
- hunique = mtod(n, caddr_t) + noff;
- hunique_len = len;
-#endif
sc = pppoe_find_softc_by_hunique(mtod(n, caddr_t) + noff,
len, m->m_pkthdr.ph_ifidx);
if (sc != NULL)
@@ -557,90 +533,9 @@ static void pppoe_dispatch_disc_pkt(struct mbuf *m, int off)
breakbreak:
switch (code) {
case PPPOE_CODE_PADI:
-#ifdef PPPOE_SERVER
- /*
- * Got service name, concentrator name, and/or host unique.
- * Ignore if we have no interfaces with IFF_PASSIVE|IFF_UP.
- */
- if (LIST_EMPTY(&pppoe_softc_list))
- goto done;
-
- LIST_FOREACH(sc, &pppoe_softc_list, sc_list) {
- if (!(sc->sc_sppp.pp_if.if_flags & IFF_UP))
- continue;
- if (!(sc->sc_sppp.pp_if.if_flags & IFF_PASSIVE))
- continue;
- if (sc->sc_state == PPPOE_STATE_INITIAL)
- break;
- }
- if (sc == NULL) {
-#ifdef PPPOE_DEBUG
- printf("pppoe: free passive interface is not found\n");
-#endif
- goto done;
- }
- if (hunique) {
- if (sc->sc_hunique)
- free(sc->sc_hunique, M_DEVBUF, 0);
- sc->sc_hunique = malloc(hunique_len, M_DEVBUF,
- M_DONTWAIT);
- if (sc->sc_hunique == NULL)
- goto done;
- sc->sc_hunique_len = hunique_len;
- memcpy(sc->sc_hunique, hunique, hunique_len);
- }
-
- memcpy(&sc->sc_dest, eh->ether_shost, sizeof(sc->sc_dest));
- sc->sc_state = PPPOE_STATE_PADO_SENT;
- pppoe_send_pado(sc);
-
- break;
-#endif /* PPPOE_SERVER */
case PPPOE_CODE_PADR:
-#ifdef PPPOE_SERVER
- /*
- * Get sc from ac_cookie if IFF_PASSIVE.
- */
- if (ac_cookie == NULL) {
- /* be quiet if there is not a single pppoe instance */
- printf("pppoe: received PADR but not includes ac_cookie\n");
- goto done;
- }
-
- sc = pppoe_find_softc_by_hunique(ac_cookie,
- ac_cookie_len,
- m->m_pkthdr.ph_ifidx);
- if (sc == NULL) {
- /* be quiet if there is not a single pppoe instance */
- if (!LIST_EMPTY(&pppoe_softc_list))
- printf("pppoe: received PADR but could not find request for it\n");
- goto done;
- }
- if (sc->sc_state != PPPOE_STATE_PADO_SENT) {
- printf("%s: received unexpected PADR\n",
- sc->sc_sppp.pp_if.if_xname);
- goto done;
- }
- if (hunique) {
- if (sc->sc_hunique)
- free(sc->sc_hunique, M_DEVBUF, 0);
- sc->sc_hunique = malloc(hunique_len, M_DEVBUF,
- M_DONTWAIT);
- if (sc->sc_hunique == NULL)
- goto done;
- sc->sc_hunique_len = hunique_len;
- memcpy(sc->sc_hunique, hunique, hunique_len);
- }
-
- pppoe_send_pads(sc);
- sc->sc_state = PPPOE_STATE_SESSION;
- sc->sc_sppp.pp_up(&sc->sc_sppp);
-
- break;
-#else
/* ignore, we are no access concentrator */
goto done;
-#endif /* PPPOE_SERVER */
case PPPOE_CODE_PADO:
if (sc == NULL) {
/* be quiet if there is not a single pppoe instance */
@@ -1218,11 +1113,6 @@ pppoe_connect(struct pppoe_softc *sc)
if (sc->sc_state != PPPOE_STATE_INITIAL)
return (EBUSY);
-#ifdef PPPOE_SERVER
- /* wait for PADI if IFF_PASSIVE */
- if ((sc->sc_sppp.pp_if.if_flags & IFF_PASSIVE))
- return (0);
-#endif
x = splnet();
/* save state, in case we fail to send PADI */
@@ -1269,13 +1159,6 @@ pppoe_disconnect(struct pppoe_softc *sc)
sc->sc_relay_sid = NULL;
}
sc->sc_relay_sid_len = 0;
-#ifdef PPPOE_SERVER
- if (sc->sc_hunique) {
- free(sc->sc_hunique, M_DEVBUF, 0);
- sc->sc_hunique = NULL;
- }
- sc->sc_hunique_len = 0;
-#endif
sc->sc_session = 0;
/* notify upper layer */
@@ -1411,85 +1294,6 @@ pppoe_send_padt(unsigned int ifidx, u_int session, const u_int8_t *dest)
return (ret);
}
-#ifdef PPPOE_SERVER
-/* Send a PADO packet. */
-static int
-pppoe_send_pado(struct pppoe_softc *sc)
-{
- struct mbuf *m0;
- size_t len;
- u_int8_t *p;
-
- if (sc->sc_state != PPPOE_STATE_PADO_SENT)
- return (EIO);
-
- /* calc length */
- len = 0;
- /* include ac_cookie */
- len += 2 + 2 + sizeof(sc->sc_unique);
- /* include hunique */
- len += 2 + 2 + sc->sc_hunique_len;
-
- m0 = pppoe_get_mbuf(len + PPPOE_HEADERLEN);
- if (m0 == NULL)
- return (ENOBUFS);
-
- p = mtod(m0, u_int8_t *);
- PPPOE_ADD_HEADER(p, PPPOE_CODE_PADO, 0, len);
- PPPOE_ADD_16(p, PPPOE_TAG_ACCOOKIE);
- PPPOE_ADD_16(p, sizeof(sc->sc_unique));
- memcpy(p, &sc, sizeof(sc->sc_unique));
- p += sizeof(sc->sc_unique);
- PPPOE_ADD_16(p, PPPOE_TAG_HUNIQUE);
- PPPOE_ADD_16(p, sc->sc_hunique_len);
- memcpy(p, sc->sc_hunique, sc->sc_hunique_len);
-
- return (pppoe_output(sc, m0));
-}
-
-/* Send a PADS packet. */
-static int
-pppoe_send_pads(struct pppoe_softc *sc)
-{
- struct mbuf *m0;
- size_t len, l1;
- u_int8_t *p;
-
- if (sc->sc_state != PPPOE_STATE_PADO_SENT)
- return (EIO);
-
- sc->sc_session = mono_time.tv_sec % 0xff + 1;
-
- /* calc length */
- len = 0;
- /* include hunique */
- len += 2 + 2 + 2 + 2 + sc->sc_hunique_len; /* service name, host unique */
- if (sc->sc_service_name != NULL) { /* service name tag maybe empty */
- l1 = strlen(sc->sc_service_name);
- len += l1;
- }
-
- m0 = pppoe_get_mbuf(len + PPPOE_HEADERLEN);
- if (m0 == NULL)
- return (ENOBUFS);
-
- p = mtod(m0, u_int8_t *);
- PPPOE_ADD_HEADER(p, PPPOE_CODE_PADS, sc->sc_session, len);
- PPPOE_ADD_16(p, PPPOE_TAG_SNAME);
- if (sc->sc_service_name != NULL) {
- PPPOE_ADD_16(p, l1);
- memcpy(p, sc->sc_service_name, l1);
- p += l1;
- } else {
- PPPOE_ADD_16(p, 0);
- }
- PPPOE_ADD_16(p, PPPOE_TAG_HUNIQUE);
- PPPOE_ADD_16(p, sc->sc_hunique_len);
- memcpy(p, sc->sc_hunique, sc->sc_hunique_len);
-
- return (pppoe_output(sc, m0));
-}
-#endif
/* this-layer-start function */
static void