Source-Changes-HG archive

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

[src/trunk]: src/sys/net Added missing if_oerror incrementing



details:   https://anonhg.NetBSD.org/src/rev/f9fb2ebd7700
branches:  trunk
changeset: 379105:f9fb2ebd7700
user:      yamaguchi <yamaguchi%NetBSD.org@localhost>
date:      Tue May 11 06:27:18 2021 +0000

description:
Added missing if_oerror incrementing

diffstat:

 sys/net/if_spppsubr.c |  36 +++++++++++++++++++++++++++++-------
 1 files changed, 29 insertions(+), 7 deletions(-)

diffs (71 lines):

diff -r 99b69016c828 -r f9fb2ebd7700 sys/net/if_spppsubr.c
--- a/sys/net/if_spppsubr.c     Tue May 11 06:21:28 2021 +0000
+++ b/sys/net/if_spppsubr.c     Tue May 11 06:27:18 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_spppsubr.c,v 1.234 2021/05/11 06:21:28 yamaguchi Exp $       */
+/*     $NetBSD: if_spppsubr.c,v 1.235 2021/05/11 06:27:18 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.234 2021/05/11 06:21:28 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.235 2021/05/11 06:27:18 yamaguchi Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -804,7 +804,7 @@ sppp_output(struct ifnet *ifp, struct mb
                splx(s);
 
                m_freem(m);
-
+               if_statinc(ifp, if_oerrors);
                return (ENETDOWN);
        }
 
@@ -930,8 +930,19 @@ sppp_output(struct ifnet *ifp, struct mb
                         * ENETDOWN, as opposed to ENOBUFS.
                         */
                        protocol = htons(PPP_IP);
-                       if (sp->scp[IDX_IPCP].state != STATE_OPENED)
-                               error = ENETDOWN;
+                       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
@@ -950,8 +961,19 @@ sppp_output(struct ifnet *ifp, struct mb
                         * ENETDOWN, as opposed to ENOBUFS.
                         */
                        protocol = htons(PPP_IPV6);
-                       if (sp->scp[IDX_IPV6CP].state != STATE_OPENED)
-                               error = ENETDOWN;
+                       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;
 #endif



Home | Main Index | Thread Index | Old Index