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.
This commit is contained in:
roy 2020-09-29 19:33:36 +00:00
parent 67eca6e99d
commit 76faeff505
2 changed files with 18 additions and 16 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: in.c,v 1.240 2020/09/11 15:22:12 roy Exp $ */
/* $NetBSD: in.c,v 1.241 2020/09/29 19:33:36 roy 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.240 2020/09/11 15:22:12 roy Exp $");
__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.241 2020/09/29 19:33:36 roy Exp $");
#include "arp.h"
@ -1579,14 +1579,15 @@ void
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;
}
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: in6.c,v 1.281 2020/06/16 17:12:18 maxv Exp $ */
/* $NetBSD: in6.c,v 1.282 2020/09/29 19:33:36 roy 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.281 2020/06/16 17:12:18 maxv Exp $");
__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.282 2020/09/29 19:33:36 roy Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@ -2250,14 +2250,15 @@ void
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;
}
}
int