Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net remove PP_CISCO that was used in obsoleted drivers e...



details:   https://anonhg.NetBSD.org/src/rev/f23f98a85006
branches:  trunk
changeset: 1021481:f23f98a85006
user:      yamaguchi <yamaguchi%NetBSD.org@localhost>
date:      Tue Jun 01 04:55:55 2021 +0000

description:
remove PP_CISCO that was used in obsoleted drivers e.g. lmc(4)

diffstat:

 sys/net/if_spppsubr.c |  350 ++++++++++----------------------------------------
 sys/net/if_spppvar.h  |    4 +-
 2 files changed, 72 insertions(+), 282 deletions(-)

diffs (truncated from 463 to 300 lines):

diff -r cec8c0ffc76c -r f23f98a85006 sys/net/if_spppsubr.c
--- a/sys/net/if_spppsubr.c     Tue Jun 01 04:45:22 2021 +0000
+++ b/sys/net/if_spppsubr.c     Tue Jun 01 04:55:55 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_spppsubr.c,v 1.250 2021/06/01 04:45:22 yamaguchi Exp $       */
+/*     $NetBSD: if_spppsubr.c,v 1.251 2021/06/01 04:55:55 yamaguchi Exp $       */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.250 2021/06/01 04:45:22 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.251 2021/06/01 04:55:55 yamaguchi Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -346,9 +346,6 @@
 static int sppp_output(struct ifnet *, struct mbuf *,
                       const struct sockaddr *, const struct rtentry *);
 
-static void sppp_cisco_send(struct sppp *, int, int32_t, int32_t);
-static void sppp_cisco_input(struct sppp *, struct mbuf *);
-
 static void sppp_cp_init(const struct cp *, struct sppp *);
 static void sppp_cp_fini(const struct cp *, struct sppp *);
 static void sppp_cp_input(const struct cp *, struct sppp *,
@@ -655,49 +652,17 @@
                case PPP_ALLSTATIONS:
                        if (h->control != PPP_UI)
                                goto invalid;
-                       if (sp->pp_flags & PP_CISCO) {
-                               if (debug)
-                                       log(LOG_DEBUG,
-                                           "%s: PPP packet in Cisco mode "
-                                           "<addr=0x%x ctrl=0x%x proto=0x%x>\n",
-                                           ifp->if_xname,
-                                           h->address, h->control, ntohs(h->protocol));
-                               goto drop;
-                       }
                        break;
                case CISCO_MULTICAST:
                case CISCO_UNICAST:
                        /* Don't check the control field here (RFC 1547). */
-                       if (! (sp->pp_flags & PP_CISCO)) {
-                               if (debug)
-                                       log(LOG_DEBUG,
-                                           "%s: Cisco packet in PPP mode "
-                                           "<addr=0x%x ctrl=0x%x proto=0x%x>\n",
-                                           ifp->if_xname,
-                                           h->address, h->control, ntohs(h->protocol));
-                               goto drop;
-                       }
-                       switch (ntohs(h->protocol)) {
-                       default:
-                               if_statinc(ifp, if_noproto);
-                               goto invalid;
-                       case CISCO_KEEPALIVE:
-                               SPPP_UNLOCK(sp);
-                               sppp_cisco_input((struct sppp *) ifp, m);
-                               m_freem(m);
-                               return;
-#ifdef INET
-                       case ETHERTYPE_IP:
-                               pktq = ip_pktq;
-                               break;
-#endif
-#ifdef INET6
-                       case ETHERTYPE_IPV6:
-                               pktq = ip6_pktq;
-                               break;
-#endif
-                       }
-                       goto queue_pkt;
+                       if (debug)
+                               log(LOG_DEBUG,
+                                   "%s: Cisco packet in PPP mode "
+                                   "<addr=0x%x ctrl=0x%x proto=0x%x>\n",
+                                   ifp->if_xname,
+                                   h->address, h->control, ntohs(h->protocol));
+                       goto drop;
                default:        /* Invalid PPP packet. */
                  invalid:
                        if (debug)
@@ -799,7 +764,6 @@
 #endif
        }
 
-queue_pkt:
        if ((ifp->if_flags & IFF_UP) == 0 || (!inq && !pktq)) {
                goto drop;
        }
@@ -979,74 +943,61 @@
                 * (albeit due to the implementation it's always enough)
                 */
                h = mtod(m, struct ppp_header *);
-               if (sp->pp_flags & PP_CISCO) {
-                       h->address = CISCO_UNICAST;        /* unicast address */
-                       h->control = 0;
-               } else {
-                       h->address = PPP_ALLSTATIONS;        /* broadcast address */
-                       h->control = PPP_UI;                 /* Unnumbered Info */
-               }
+               h->address = PPP_ALLSTATIONS;        /* broadcast address */
+               h->control = PPP_UI;                 /* Unnumbered Info */
        }
 
        switch (dst->sa_family) {
 #ifdef INET
        case AF_INET:   /* Internet Protocol */
-               if (sp->pp_flags & PP_CISCO)
-                       protocol = htons(ETHERTYPE_IP);
-               else {
-                       /*
-                        * Don't choke with an ENETDOWN early.  It's
-                        * possible that we just started dialing out,
-                        * so don't drop the packet immediately.  If
-                        * we notice that we run out of buffer space
-                        * below, we will however remember that we are
-                        * not ready to carry IP packets, and return
-                        * ENETDOWN, as opposed to ENOBUFS.
-                        */
-                       protocol = htons(PPP_IP);
-                       if (sp->scp[IDX_IPCP].state != STATE_OPENED) {
-                               if (ifp->if_flags & IFF_AUTO) {
-                                       error = ENETDOWN;
-                               } else {
-                                       IF_DROP(&ifp->if_snd);
-                                       SPPP_UNLOCK(sp);
-                                       splx(s);
-
-                                       m_freem(m);
-                                       if_statinc(ifp, if_oerrors);
-                                       return (ENETDOWN);
-                               }
+               /*
+                * Don't choke with an ENETDOWN early.  It's
+                * possible that we just started dialing out,
+                * so don't drop the packet immediately.  If
+                * we notice that we run out of buffer space
+                * below, we will however remember that we are
+                * not ready to carry IP packets, and return
+                * ENETDOWN, as opposed to ENOBUFS.
+                */
+               protocol = htons(PPP_IP);
+               if (sp->scp[IDX_IPCP].state != STATE_OPENED) {
+                       if (ifp->if_flags & IFF_AUTO) {
+                               error = ENETDOWN;
+                       } else {
+                               IF_DROP(&ifp->if_snd);
+                               SPPP_UNLOCK(sp);
+                               splx(s);
+
+                               m_freem(m);
+                               if_statinc(ifp, if_oerrors);
+                               return (ENETDOWN);
                        }
                }
                break;
 #endif
 #ifdef INET6
        case AF_INET6:   /* Internet Protocol version 6 */
-               if (sp->pp_flags & PP_CISCO)
-                       protocol = htons(ETHERTYPE_IPV6);
-               else {
-                       /*
-                        * Don't choke with an ENETDOWN early.  It's
-                        * possible that we just started dialing out,
-                        * so don't drop the packet immediately.  If
-                        * we notice that we run out of buffer space
-                        * below, we will however remember that we are
-                        * not ready to carry IP packets, and return
-                        * ENETDOWN, as opposed to ENOBUFS.
-                        */
-                       protocol = htons(PPP_IPV6);
-                       if (sp->scp[IDX_IPV6CP].state != STATE_OPENED) {
-                               if (ifp->if_flags & IFF_AUTO) {
-                                       error = ENETDOWN;
-                               } else {
-                                       IF_DROP(&ifp->if_snd);
-                                       SPPP_UNLOCK(sp);
-                                       splx(s);
-
-                                       m_freem(m);
-                                       if_statinc(ifp, if_oerrors);
-                                       return (ENETDOWN);
-                               }
+               /*
+                * Don't choke with an ENETDOWN early.  It's
+                * possible that we just started dialing out,
+                * so don't drop the packet immediately.  If
+                * we notice that we run out of buffer space
+                * below, we will however remember that we are
+                * not ready to carry IP packets, and return
+                * ENETDOWN, as opposed to ENOBUFS.
+                */
+               protocol = htons(PPP_IPV6);
+               if (sp->scp[IDX_IPV6CP].state != STATE_OPENED) {
+                       if (ifp->if_flags & IFF_AUTO) {
+                               error = ENETDOWN;
+                       } else {
+                               IF_DROP(&ifp->if_snd);
+                               SPPP_UNLOCK(sp);
+                               splx(s);
+
+                               m_freem(m);
+                               if_statinc(ifp, if_oerrors);
+                               return (ENETDOWN);
                        }
                }
                break;
@@ -1259,8 +1210,7 @@
         * Do always serve all three queues in Cisco mode.
         */
        IF_DEQUEUE(&sp->pp_cpq, m);
-       if (m == NULL &&
-           (sppp_cp_check(sp, CP_NCP) || (sp->pp_flags & PP_CISCO) != 0)) {
+       if (m == NULL && sppp_cp_check(sp, CP_NCP)) {
                IF_DEQUEUE(&sp->pp_fastq, m);
                if (m == NULL)
                        IFQ_DEQUEUE(&sp->pp_if.if_snd, m);
@@ -1313,10 +1263,8 @@
                if (going_up && newmode == 0) {
                        /* neither auto-dial nor passive */
                        ifp->if_flags |= IFF_RUNNING;
-                       if (!(sp->pp_flags & PP_CISCO)) {
-                               sppp_wq_add(sp->wq_cp,
-                                   &sp->scp[IDX_LCP].work_open);
-                       }
+                       sppp_wq_add(sp->wq_cp,
+                           &sp->scp[IDX_LCP].work_open);
                } else if (going_down) {
                        SPPP_UNLOCK(sp);
                        sppp_flush(ifp);
@@ -1431,158 +1379,6 @@
 }
 
 /*
- * Cisco framing implementation.
- */
-
-/*
- * Handle incoming Cisco keepalive protocol packets.
- */
-static void
-sppp_cisco_input(struct sppp *sp, struct mbuf *m)
-{
-       STDDCL;
-       struct cisco_packet *h;
-#ifdef INET
-       uint32_t me, mymask = 0;        /* XXX: GCC */
-#endif
-
-       SPPP_LOCK(sp, RW_WRITER);
-
-       if (m->m_pkthdr.len < CISCO_PACKET_LEN) {
-               if (debug)
-                       log(LOG_DEBUG,
-                           "%s: cisco invalid packet length: %d bytes\n",
-                           ifp->if_xname, m->m_pkthdr.len);
-               SPPP_UNLOCK(sp);
-               return;
-       }
-       h = mtod(m, struct cisco_packet *);
-       if (debug)
-               log(LOG_DEBUG,
-                   "%s: cisco input: %d bytes "
-                   "<0x%x 0x%x 0x%x 0x%x 0x%x-0x%x>\n",
-                   ifp->if_xname, m->m_pkthdr.len,
-                   ntohl(h->type), h->par1, h->par2, (u_int)h->rel,
-                   (u_int)h->time0, (u_int)h->time1);
-       switch (ntohl(h->type)) {
-       default:
-               if (debug)
-                       addlog("%s: cisco unknown packet type: 0x%x\n",
-                              ifp->if_xname, ntohl(h->type));
-               break;
-       case CISCO_ADDR_REPLY:
-               /* Reply on address request, ignore */
-               break;
-       case CISCO_KEEPALIVE_REQ:
-               sp->pp_alivecnt = 0;
-               sp->scp[IDX_LCP].rseq = ntohl(h->par1);
-               if (sp->scp[IDX_LCP].seq == sp->scp[IDX_LCP].rseq) {
-                       /* Local and remote sequence numbers are equal.
-                        * Probably, the line is in loopback mode. */
-                       if (sp->pp_loopcnt >= LOOPALIVECNT) {
-                               printf ("%s: loopback\n",
-                                       ifp->if_xname);
-                               sp->pp_loopcnt = 0;
-
-                               if (sp->pp_flags & PP_LOOPBACK_IFDOWN) {
-                                       sp->pp_flags |= PP_LOOPBACK;
-                                       sppp_wq_add(sp->wq_cp,
-                                           &sp->work_ifdown);
-                               }
-
-                               sppp_wq_add(sp->wq_cp,
-                                   &sp->scp[IDX_LCP].work_close);



Home | Main Index | Thread Index | Old Index