Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/a33d441d10b1
branches:  netbsd-9
changeset: 940505:a33d441d10b1
user:      martin <martin%NetBSD.org@localhost>
date:      Thu Oct 08 18:04:59 2020 +0000

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

        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 7643b1cbd5db -r a33d441d10b1 sys/netinet/in.c
--- a/sys/netinet/in.c  Thu Oct 08 17:49:03 2020 +0000
+++ b/sys/netinet/in.c  Thu Oct 08 18:04:59 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: in.c,v 1.234 2019/04/29 11:57:22 roy Exp $     */
+/*     $NetBSD: in.c,v 1.234.2.1 2020/10/08 18:04:59 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.234 2019/04/29 11:57:22 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.234.2.1 2020/10/08 18:04:59 martin Exp $");
 
 #include "arp.h"
 
@@ -1555,14 +1555,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 7643b1cbd5db -r a33d441d10b1 sys/netinet6/in6.c
--- a/sys/netinet6/in6.c        Thu Oct 08 17:49:03 2020 +0000
+++ b/sys/netinet6/in6.c        Thu Oct 08 18:04:59 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: in6.c,v 1.275 2019/04/29 11:57:22 roy Exp $    */
+/*     $NetBSD: in6.c,v 1.275.2.1 2020/10/08 18:04:59 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.275 2019/04/29 11:57:22 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.275.2.1 2020/10/08 18:04:59 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -2324,14 +2324,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