diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2019-02-14 18:19:14 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2019-02-14 18:19:14 +0000 |
commit | 6fb206e1e9f8f2e247e313f7f53378ae120d1504 (patch) | |
tree | 5c8e75e9e1b393c1c670655e3b2c1caccbf5666b /sys/net/if_bridge.c | |
parent | f1b77f7173fcac1dc64eac58234281d5b9abcdcb (diff) |
Use timeout_barrier() when bringing the bridge(4) down and only execute
the timeout handler if the interface is running.
ok claudio@
Diffstat (limited to 'sys/net/if_bridge.c')
-rw-r--r-- | sys/net/if_bridge.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c index 3c59874b615..ca8f61acde1 100644 --- a/sys/net/if_bridge.c +++ b/sys/net/if_bridge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bridge.c,v 1.320 2019/02/14 17:51:25 mpi Exp $ */ +/* $OpenBSD: if_bridge.c,v 1.321 2019/02/14 18:19:13 mpi Exp $ */ /* * Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net) @@ -682,14 +682,15 @@ bridge_init(struct bridge_softc *sc) { struct ifnet *ifp = &sc->sc_if; - if ((ifp->if_flags & IFF_RUNNING) == IFF_RUNNING) + if (ISSET(ifp->if_flags, IFF_RUNNING)) return; - ifp->if_flags |= IFF_RUNNING; bstp_initialization(sc->sc_stp); if (sc->sc_brttimeout != 0) timeout_add_sec(&sc->sc_brtimeout, sc->sc_brttimeout); + + SET(ifp->if_flags, IFF_RUNNING); } /* @@ -700,17 +701,15 @@ bridge_stop(struct bridge_softc *sc) { struct ifnet *ifp = &sc->sc_if; - /* - * If we're not running, there's nothing to do. - */ - if ((ifp->if_flags & IFF_RUNNING) == 0) + if (!ISSET(ifp->if_flags, IFF_RUNNING)) return; - timeout_del(&sc->sc_brtimeout); + CLR(ifp->if_flags, IFF_RUNNING); - bridge_rtflush(sc, IFBF_FLUSHDYN); + if (!timeout_del(&sc->sc_brtimeout)) + timeout_barrier(&sc->sc_brtimeout); - ifp->if_flags &= ~IFF_RUNNING; + bridge_rtflush(sc, IFBF_FLUSHDYN); } /* |