diff --git a/sys/net/if.c b/sys/net/if.c index 7c7a5daf6aed..41f4e0151565 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $NetBSD: if.c,v 1.480 2020/09/26 11:57:05 roy Exp $ */ +/* $NetBSD: if.c,v 1.481 2020/09/26 18:35:12 roy Exp $ */ /*- * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc. @@ -90,7 +90,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.480 2020/09/26 11:57:05 roy Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.481 2020/09/26 18:35:12 roy Exp $"); #if defined(_KERNEL_OPT) #include "opt_inet.h" @@ -1212,6 +1212,8 @@ if_deactivate(struct ifnet *ifp) ifp->if_slowtimo = if_nullslowtimo; ifp->if_drain = if_nulldrain; + ifp->if_link_state_changed = NULL; + /* No more packets may be enqueued. */ ifp->if_snd.ifq_maxlen = 0; @@ -2415,6 +2417,9 @@ if_link_state_change_process(struct ifnet *ifp, int link_state) carp_carpdev_state(ifp); #endif + if (ifp->if_link_state_changed != NULL) + ifp->if_link_state_changed(ifp, link_state); + DOMAIN_FOREACH(dp) { if (dp->dom_if_link_state_change != NULL) dp->dom_if_link_state_change(ifp, link_state); diff --git a/sys/net/if.h b/sys/net/if.h index 02ed595612d9..11748ef5894c 100644 --- a/sys/net/if.h +++ b/sys/net/if.h @@ -1,4 +1,4 @@ -/* $NetBSD: if.h,v 1.286 2020/09/26 11:57:05 roy Exp $ */ +/* $NetBSD: if.h,v 1.287 2020/09/26 18:35:12 roy Exp $ */ /*- * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc. @@ -419,6 +419,7 @@ typedef struct ifnet { uint16_t if_link_queue; /* q: masked link state change queue */ /* q: is link state work scheduled? */ bool if_link_scheduled; + void (*if_link_state_changed)(struct ifnet *, int); struct pslist_entry if_pslist_entry;/* i: */ struct psref_target