if_spppsubr.c has:

revision 1.29
date: 2005/03/24 16:37:52;  author: claudio;  state: Exp;  lines: +15 -9;
Unbreak tree, mono_time may no longer be used because of timecounters.
Use getmicrouptime() instead. Found by grange@ and henning@.
OK henning@

It turns out PPPOE_SERVER paths have been broken since at least then
so let's remove them:

../../../../net/if_pppoe.c: In function 'pppoe_send_pads':
../../../../net/if_pppoe.c:1461: error: 'mono_time' undeclared (first use in 
this function)
../../../../net/if_pppoe.c:1461: error: (Each undeclared identifier is reported 
only once
../../../../net/if_pppoe.c:1461: error: for each function it appears in.)

Index: share/man/man4/pppoe.4
===================================================================
RCS file: /cvs/src/share/man/man4/pppoe.4,v
retrieving revision 1.29
diff -u -p -r1.29 pppoe.4
--- share/man/man4/pppoe.4      12 Aug 2015 09:15:49 -0000      1.29
+++ share/man/man4/pppoe.4      31 Mar 2016 06:39:05 -0000
@@ -153,19 +153,6 @@ driver with this option set will send a 
 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
Index: sys/net/if_ethersubr.c
===================================================================
RCS file: /cvs/src/sys/net/if_ethersubr.c,v
retrieving revision 1.234
diff -u -p -r1.234 if_ethersubr.c
--- sys/net/if_ethersubr.c      1 Mar 2016 01:48:14 -0000       1.234
+++ sys/net/if_ethersubr.c      31 Mar 2016 06:38:07 -0000
@@ -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);
Index: sys/net/if_pppoe.c
===================================================================
RCS file: /cvs/src/sys/net/if_pppoe.c,v
retrieving revision 1.52
diff -u -p -r1.52 if_pppoe.c
--- sys/net/if_pppoe.c  5 Dec 2015 10:07:55 -0000       1.52
+++ sys/net/if_pppoe.c  31 Mar 2016 06:35:54 -0000
@@ -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(stru
        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(stru
        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(stru
                                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(stru
 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_in
        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

Reply via email to