diff --git a/sys/net/lagg/if_lagg.c b/sys/net/lagg/if_lagg.c index e3527b269b95..735b58c5387f 100644 --- a/sys/net/lagg/if_lagg.c +++ b/sys/net/lagg/if_lagg.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_lagg.c,v 1.20 2021/11/08 06:29:16 yamaguchi Exp $ */ +/* $NetBSD: if_lagg.c,v 1.21 2021/11/11 01:10:09 yamaguchi Exp $ */ /* * Copyright (c) 2005, 2006 Reyk Floeter @@ -20,7 +20,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_lagg.c,v 1.20 2021/11/08 06:29:16 yamaguchi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_lagg.c,v 1.21 2021/11/11 01:10:09 yamaguchi Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -2091,15 +2091,21 @@ lagg_port_setsadl(struct lagg_port *lp, uint8_t *lladdr, lagg_chg_sadl(ifp_port, lladdr, ETHER_ADDR_LEN); - if (!ISSET(ifp_port->if_flags, IFF_RUNNING)) { - break; - } + if (ifp_port->if_init != NULL) { + error = 0; + if (ISSET(ifp_port->if_flags, IFF_RUNNING)) + error = ifp_port->if_init(ifp_port); - error = ifp_port->if_init(ifp_port); - if (error != 0) { - lagg_log(lp->lp_softc, LOG_WARNING, - "%s failed to if_init() on %d\n", - ifp_port->if_xname, error); + if (error != 0) { + lagg_log(lp->lp_softc, LOG_WARNING, + "%s failed to if_init() on %d\n", + ifp_port->if_xname, error); + } + } else { + if (lp->lp_promisc == false) { + ifpromisc_locked(ifp_port, 1); + lp->lp_promisc = true; + } } break; default: @@ -2131,15 +2137,21 @@ lagg_port_unsetsadl(struct lagg_port *lp) lagg_chg_sadl(ifp_port, lp->lp_lladdr, ETHER_ADDR_LEN); - if (!ISSET(ifp_port->if_flags, IFF_RUNNING)) { - break; - } + if (ifp_port->if_init != NULL) { + error = 0; + if (ISSET(ifp_port->if_flags, IFF_RUNNING)) + error = ifp_port->if_init(ifp_port); - error = ifp_port->if_init(ifp_port); - if (error != 0) { - lagg_log(lp->lp_softc, LOG_WARNING, - "%s failed to if_init() on %d\n", - ifp_port->if_xname, error); + if (error != 0) { + lagg_log(lp->lp_softc, LOG_WARNING, + "%s failed to if_init() on %d\n", + ifp_port->if_xname, error); + } + } else { + if (lp->lp_promisc == true) { + ifpromisc_locked(ifp_port, 0); + lp->lp_promisc = false; + } } break;