Source-Changes-HG archive

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

[src/trunk]: src/sys/net Added logs on dropping IPCP and IPv6CP packets



details:   https://anonhg.NetBSD.org/src/rev/f288bd64e3ed
branches:  trunk
changeset: 379204:f288bd64e3ed
user:      yamaguchi <yamaguchi%NetBSD.org@localhost>
date:      Wed May 19 02:02:46 2021 +0000

description:
Added logs on dropping IPCP and IPv6CP packets

diffstat:

 sys/net/if_spppsubr.c |  25 +++++++++++++++++--------
 1 files changed, 17 insertions(+), 8 deletions(-)

diffs (65 lines):

diff -r 951fd307edb4 -r f288bd64e3ed sys/net/if_spppsubr.c
--- a/sys/net/if_spppsubr.c     Wed May 19 01:54:09 2021 +0000
+++ b/sys/net/if_spppsubr.c     Wed May 19 02:02:46 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_spppsubr.c,v 1.243 2021/05/19 01:54:09 yamaguchi Exp $       */
+/*     $NetBSD: if_spppsubr.c,v 1.244 2021/05/19 02:02:46 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.243 2021/05/19 01:54:09 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.244 2021/05/19 02:02:46 yamaguchi Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -714,13 +714,14 @@ sppp_input(struct ifnet *ifp, struct mbu
                            &prot);
                        SPPP_DOWNGRADE(sp);
                }
-               if (debug)
+               if_statinc(ifp, if_noproto);
+               goto drop;
+       default:
+               if (debug) {
                        log(LOG_DEBUG,
                            "%s: invalid input protocol "
                            "<proto=0x%x>\n", ifp->if_xname, protocol);
-               if_statinc(ifp, if_noproto);
-               goto drop;
-       default:
+               }
                goto reject_protocol;
        case PPP_LCP:
                SPPP_UNLOCK(sp);
@@ -743,8 +744,12 @@ sppp_input(struct ifnet *ifp, struct mbu
                return;
 #ifdef INET
        case PPP_IPCP:
-               if (!ISSET(sp->pp_ncpflags, SPPP_NCP_IPCP))
+               if (!ISSET(sp->pp_ncpflags, SPPP_NCP_IPCP)) {
+                       log(LOG_INFO, "%s: reject IPCP packet "
+                           "because IPCP is disabled\n",
+                           ifp->if_xname);
                        goto reject_protocol;
+               }
                SPPP_UNLOCK(sp);
                if (sp->pp_phase == SPPP_PHASE_NETWORK) {
                        sppp_cp_input(&ipcp, sp, m);
@@ -762,8 +767,12 @@ sppp_input(struct ifnet *ifp, struct mbu
 #endif
 #ifdef INET6
        case PPP_IPV6CP:
-               if (!ISSET(sp->pp_ncpflags, SPPP_NCP_IPV6CP))
+               if (!ISSET(sp->pp_ncpflags, SPPP_NCP_IPV6CP)) {
+                       log(LOG_INFO, "%s: reject IPv6CP packet "
+                           "because IPv6CP is disabled\n",
+                           ifp->if_xname);
                        goto reject_protocol;
+               }
                SPPP_UNLOCK(sp);
                if (sp->pp_phase == SPPP_PHASE_NETWORK) {
                        sppp_cp_input(&ipv6cp, sp, m);



Home | Main Index | Thread Index | Old Index