Source-Changes-HG archive

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

[src/trunk]: src/sys/net Drop packets that have no NCP not to start auto-dial



details:   https://anonhg.NetBSD.org/src/rev/d70e2356654d
branches:  trunk
changeset: 983239:d70e2356654d
user:      yamaguchi <yamaguchi%NetBSD.org@localhost>
date:      Tue May 11 06:33:17 2021 +0000

description:
Drop packets that have no NCP not to start auto-dial

diffstat:

 sys/net/if_spppsubr.c |  16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diffs (37 lines):

diff -r 4aa40f2f1e70 -r d70e2356654d sys/net/if_spppsubr.c
--- a/sys/net/if_spppsubr.c     Tue May 11 06:27:18 2021 +0000
+++ b/sys/net/if_spppsubr.c     Tue May 11 06:33:17 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_spppsubr.c,v 1.235 2021/05/11 06:27:18 yamaguchi Exp $       */
+/*     $NetBSD: if_spppsubr.c,v 1.236 2021/05/11 06:33:17 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.235 2021/05/11 06:27:18 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.236 2021/05/11 06:33:17 yamaguchi Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -809,6 +809,18 @@
        }
 
        if ((ifp->if_flags & (IFF_RUNNING | IFF_AUTO)) == IFF_AUTO) {
+               /* ignore packets that have no enabled NCP */
+               if ((dst->sa_family == AF_INET &&
+                   !ISSET(sp->pp_ncpflags, SPPP_NCP_IPCP)) ||
+                   (dst->sa_family == AF_INET6 &&
+                   !ISSET(sp->pp_ncpflags, SPPP_NCP_IPV6CP))) {
+                       SPPP_UNLOCK(sp);
+                       splx(s);
+
+                       m_freem(m);
+                       if_statinc(ifp, if_oerrors);
+                       return (ENETDOWN);
+               }
                /*
                 * Interface is not yet running, but auto-dial.  Need
                 * to start LCP for it.



Home | Main Index | Thread Index | Old Index