Source-Changes-HG archive

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

[src/netbsd-8]: src/sys Pull up following revision(s) (requested by roy in ti...



details:   https://anonhg.NetBSD.org/src/rev/6f0a141c7523
branches:  netbsd-8
changeset: 940509:6f0a141c7523
user:      martin <martin%NetBSD.org@localhost>
date:      Thu Oct 08 18:06:12 2020 +0000

description:
Pull up following revision(s) (requested by roy in ticket #1613):

        sys/netinet/in.c: revision 1.241
        sys/netinet6/in6.c: revision 1.282

inet: Treat LINK_STATE_UNKNOWN as LINK_STATE_UP when changing

It's something we have always done.
it's really rare for anything to transition to UNKNOWN from either
UP or DOWN, but technically it is possible.

diffstat:

 sys/netinet/in.c   |  17 +++++++++--------
 sys/netinet6/in6.c |  17 +++++++++--------
 2 files changed, 18 insertions(+), 16 deletions(-)

diffs (80 lines):

diff -r d8cef6e6b1fe -r 6f0a141c7523 sys/netinet/in.c
--- a/sys/netinet/in.c  Thu Oct 08 17:50:11 2020 +0000
+++ b/sys/netinet/in.c  Thu Oct 08 18:06:12 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: in.c,v 1.203.2.13 2018/04/09 04:04:21 snj Exp $        */
+/*     $NetBSD: in.c,v 1.203.2.14 2020/10/08 18:06:12 martin Exp $     */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.203.2.13 2018/04/09 04:04:21 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.203.2.14 2020/10/08 18:06:12 martin Exp $");
 
 #include "arp.h"
 
@@ -1553,14 +1553,15 @@
 in_if_link_state_change(struct ifnet *ifp, int link_state)
 {
 
-       switch (link_state) {
-       case LINK_STATE_DOWN:
+       /*
+        * Treat LINK_STATE_UNKNOWN as UP.
+        * LINK_STATE_UNKNOWN transitions to LINK_STATE_DOWN when
+        * if_link_state_change() transitions to LINK_STATE_UP.
+        */
+       if (link_state == LINK_STATE_DOWN)
                in_if_link_down(ifp);
-               break;
-       case LINK_STATE_UP:
+       else
                in_if_link_up(ifp);
-               break;
-       }
 }
 
 /*
diff -r d8cef6e6b1fe -r 6f0a141c7523 sys/netinet6/in6.c
--- a/sys/netinet6/in6.c        Thu Oct 08 17:50:11 2020 +0000
+++ b/sys/netinet6/in6.c        Thu Oct 08 18:06:12 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: in6.c,v 1.245.2.12 2018/11/06 14:38:58 martin Exp $    */
+/*     $NetBSD: in6.c,v 1.245.2.13 2020/10/08 18:06:13 martin Exp $    */
 /*     $KAME: in6.c,v 1.198 2001/07/18 09:12:38 itojun Exp $   */
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.245.2.12 2018/11/06 14:38:58 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.245.2.13 2020/10/08 18:06:13 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -2325,14 +2325,15 @@
 in6_if_link_state_change(struct ifnet *ifp, int link_state)
 {
 
-       switch (link_state) {
-       case LINK_STATE_DOWN:
+       /*
+        * Treat LINK_STATE_UNKNOWN as UP.
+        * LINK_STATE_UNKNOWN transitions to LINK_STATE_DOWN when
+        * if_link_state_change() transitions to LINK_STATE_UP.
+        */
+       if (link_state == LINK_STATE_DOWN)
                in6_if_link_down(ifp);
-               break;
-       case LINK_STATE_UP:
+       else
                in6_if_link_up(ifp);
-               break;
-       }
 }
 
 /*



Home | Main Index | Thread Index | Old Index