Ensure the timer isn't running by using workqueue_waitdiff -r1.146 -r1.147 src/sys/net/if_bridge.c
(ozaki-r)
--- src/sys/net/if_bridge.c 2017/12/19 03:32:35 1.146
+++ src/sys/net/if_bridge.c 2017/12/28 07:06:36 1.147
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: if_bridge.c,v 1.146 2017/12/19 03:32:35 ozaki-r Exp $ */ | 1 | /* $NetBSD: if_bridge.c,v 1.147 2017/12/28 07:06:36 ozaki-r Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright 2001 Wasabi Systems, Inc. | 4 | * Copyright 2001 Wasabi Systems, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Written by Jason R. Thorpe for Wasabi Systems, Inc. | 7 | * Written by Jason R. Thorpe for Wasabi Systems, Inc. | |
8 | * | 8 | * | |
9 | * Redistribution and use in source and binary forms, with or without | 9 | * Redistribution and use in source and binary forms, with or without | |
10 | * modification, are permitted provided that the following conditions | 10 | * modification, are permitted provided that the following conditions | |
11 | * are met: | 11 | * are met: | |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the above copyright | 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
@@ -70,27 +70,27 @@ | @@ -70,27 +70,27 @@ | |||
70 | 70 | |||
71 | /* | 71 | /* | |
72 | * Network interface bridge support. | 72 | * Network interface bridge support. | |
73 | * | 73 | * | |
74 | * TODO: | 74 | * TODO: | |
75 | * | 75 | * | |
76 | * - Currently only supports Ethernet-like interfaces (Ethernet, | 76 | * - Currently only supports Ethernet-like interfaces (Ethernet, | |
77 | * 802.11, VLANs on Ethernet, etc.) Figure out a nice way | 77 | * 802.11, VLANs on Ethernet, etc.) Figure out a nice way | |
78 | * to bridge other types of interfaces (FDDI-FDDI, and maybe | 78 | * to bridge other types of interfaces (FDDI-FDDI, and maybe | |
79 | * consider heterogenous bridges). | 79 | * consider heterogenous bridges). | |
80 | */ | 80 | */ | |
81 | 81 | |||
82 | #include <sys/cdefs.h> | 82 | #include <sys/cdefs.h> | |
83 | __KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.146 2017/12/19 03:32:35 ozaki-r Exp $"); | 83 | __KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.147 2017/12/28 07:06:36 ozaki-r Exp $"); | |
84 | 84 | |||
85 | #ifdef _KERNEL_OPT | 85 | #ifdef _KERNEL_OPT | |
86 | #include "opt_bridge_ipf.h" | 86 | #include "opt_bridge_ipf.h" | |
87 | #include "opt_inet.h" | 87 | #include "opt_inet.h" | |
88 | #include "opt_net_mpsafe.h" | 88 | #include "opt_net_mpsafe.h" | |
89 | #endif /* _KERNEL_OPT */ | 89 | #endif /* _KERNEL_OPT */ | |
90 | 90 | |||
91 | #include <sys/param.h> | 91 | #include <sys/param.h> | |
92 | #include <sys/kernel.h> | 92 | #include <sys/kernel.h> | |
93 | #include <sys/mbuf.h> | 93 | #include <sys/mbuf.h> | |
94 | #include <sys/queue.h> | 94 | #include <sys/queue.h> | |
95 | #include <sys/socket.h> | 95 | #include <sys/socket.h> | |
96 | #include <sys/socketvar.h> /* for softnet_lock */ | 96 | #include <sys/socketvar.h> /* for softnet_lock */ | |
@@ -1348,27 +1348,28 @@ bridge_init(struct ifnet *ifp) | @@ -1348,27 +1348,28 @@ bridge_init(struct ifnet *ifp) | |||
1348 | /* | 1348 | /* | |
1349 | * bridge_stop: | 1349 | * bridge_stop: | |
1350 | * | 1350 | * | |
1351 | * Stop the bridge interface. | 1351 | * Stop the bridge interface. | |
1352 | */ | 1352 | */ | |
1353 | static void | 1353 | static void | |
1354 | bridge_stop(struct ifnet *ifp, int disable) | 1354 | bridge_stop(struct ifnet *ifp, int disable) | |
1355 | { | 1355 | { | |
1356 | struct bridge_softc *sc = ifp->if_softc; | 1356 | struct bridge_softc *sc = ifp->if_softc; | |
1357 | 1357 | |||
1358 | KASSERT((ifp->if_flags & IFF_RUNNING) != 0); | 1358 | KASSERT((ifp->if_flags & IFF_RUNNING) != 0); | |
1359 | ifp->if_flags &= ~IFF_RUNNING; | 1359 | ifp->if_flags &= ~IFF_RUNNING; | |
1360 | 1360 | |||
1361 | callout_stop(&sc->sc_brcallout); | 1361 | callout_halt(&sc->sc_brcallout, NULL); | |
1362 | workqueue_wait(sc->sc_rtage_wq, &sc->sc_rtage_wk); | |||
1362 | bstp_stop(sc); | 1363 | bstp_stop(sc); | |
1363 | bridge_rtflush(sc, IFBF_FLUSHDYN); | 1364 | bridge_rtflush(sc, IFBF_FLUSHDYN); | |
1364 | } | 1365 | } | |
1365 | 1366 | |||
1366 | /* | 1367 | /* | |
1367 | * bridge_enqueue: | 1368 | * bridge_enqueue: | |
1368 | * | 1369 | * | |
1369 | * Enqueue a packet on a bridge member interface. | 1370 | * Enqueue a packet on a bridge member interface. | |
1370 | */ | 1371 | */ | |
1371 | void | 1372 | void | |
1372 | bridge_enqueue(struct bridge_softc *sc, struct ifnet *dst_ifp, struct mbuf *m, | 1373 | bridge_enqueue(struct bridge_softc *sc, struct ifnet *dst_ifp, struct mbuf *m, | |
1373 | int runfilt) | 1374 | int runfilt) | |
1374 | { | 1375 | { |
--- src/sys/net/if_spppsubr.c 2017/12/11 03:29:20 1.177
+++ src/sys/net/if_spppsubr.c 2017/12/28 07:06:36 1.178
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: if_spppsubr.c,v 1.177 2017/12/11 03:29:20 ozaki-r Exp $ */ | 1 | /* $NetBSD: if_spppsubr.c,v 1.178 2017/12/28 07:06:36 ozaki-r Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Synchronous PPP/Cisco link level subroutines. | 4 | * Synchronous PPP/Cisco link level subroutines. | |
5 | * Keepalive protocol implemented in both Cisco and PPP modes. | 5 | * Keepalive protocol implemented in both Cisco and PPP modes. | |
6 | * | 6 | * | |
7 | * Copyright (C) 1994-1996 Cronyx Engineering Ltd. | 7 | * Copyright (C) 1994-1996 Cronyx Engineering Ltd. | |
8 | * Author: Serge Vakulenko, <vak@cronyx.ru> | 8 | * Author: Serge Vakulenko, <vak@cronyx.ru> | |
9 | * | 9 | * | |
10 | * Heavily revamped to conform to RFC 1661. | 10 | * Heavily revamped to conform to RFC 1661. | |
11 | * Copyright (C) 1997, Joerg Wunsch. | 11 | * Copyright (C) 1997, Joerg Wunsch. | |
12 | * | 12 | * | |
13 | * RFC2472 IPv6CP support. | 13 | * RFC2472 IPv6CP support. | |
14 | * Copyright (C) 2000, Jun-ichiro itojun Hagino <itojun@iijlab.net>. | 14 | * Copyright (C) 2000, Jun-ichiro itojun Hagino <itojun@iijlab.net>. | |
@@ -31,27 +31,27 @@ | @@ -31,27 +31,27 @@ | |||
31 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 31 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
32 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 32 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
33 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 33 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
34 | * POSSIBILITY OF SUCH DAMAGE. | 34 | * POSSIBILITY OF SUCH DAMAGE. | |
35 | * | 35 | * | |
36 | * From: Version 2.4, Thu Apr 30 17:17:21 MSD 1997 | 36 | * From: Version 2.4, Thu Apr 30 17:17:21 MSD 1997 | |
37 | * | 37 | * | |
38 | * From: if_spppsubr.c,v 1.39 1998/04/04 13:26:03 phk Exp | 38 | * From: if_spppsubr.c,v 1.39 1998/04/04 13:26:03 phk Exp | |
39 | * | 39 | * | |
40 | * From: Id: if_spppsubr.c,v 1.23 1999/02/23 14:47:50 hm Exp | 40 | * From: Id: if_spppsubr.c,v 1.23 1999/02/23 14:47:50 hm Exp | |
41 | */ | 41 | */ | |
42 | 42 | |||
43 | #include <sys/cdefs.h> | 43 | #include <sys/cdefs.h> | |
44 | __KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.177 2017/12/11 03:29:20 ozaki-r Exp $"); | 44 | __KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.178 2017/12/28 07:06:36 ozaki-r Exp $"); | |
45 | 45 | |||
46 | #if defined(_KERNEL_OPT) | 46 | #if defined(_KERNEL_OPT) | |
47 | #include "opt_inet.h" | 47 | #include "opt_inet.h" | |
48 | #include "opt_modular.h" | 48 | #include "opt_modular.h" | |
49 | #include "opt_compat_netbsd.h" | 49 | #include "opt_compat_netbsd.h" | |
50 | #include "opt_net_mpsafe.h" | 50 | #include "opt_net_mpsafe.h" | |
51 | #endif | 51 | #endif | |
52 | 52 | |||
53 | 53 | |||
54 | #include <sys/param.h> | 54 | #include <sys/param.h> | |
55 | #include <sys/proc.h> | 55 | #include <sys/proc.h> | |
56 | #include <sys/systm.h> | 56 | #include <sys/systm.h> | |
57 | #include <sys/kernel.h> | 57 | #include <sys/kernel.h> | |
@@ -1063,26 +1063,27 @@ sppp_detach(struct ifnet *ifp) | @@ -1063,26 +1063,27 @@ sppp_detach(struct ifnet *ifp) | |||
1063 | SPPPQ_UNLOCK(); | 1063 | SPPPQ_UNLOCK(); | |
1064 | 1064 | |||
1065 | if (! spppq) { | 1065 | if (! spppq) { | |
1066 | /* Stop keepalive handler. */ | 1066 | /* Stop keepalive handler. */ | |
1067 | callout_stop(&keepalive_ch); | 1067 | callout_stop(&keepalive_ch); | |
1068 | mutex_obj_free(spppq_lock); | 1068 | mutex_obj_free(spppq_lock); | |
1069 | spppq_lock = NULL; | 1069 | spppq_lock = NULL; | |
1070 | } | 1070 | } | |
1071 | 1071 | |||
1072 | SPPP_LOCK(sp, RW_WRITER); | 1072 | SPPP_LOCK(sp, RW_WRITER); | |
1073 | 1073 | |||
1074 | /* to avoid workqueue enqueued */ | 1074 | /* to avoid workqueue enqueued */ | |
1075 | atomic_swap_uint(&sp->ipcp.update_addrs_enqueued, 1); | 1075 | atomic_swap_uint(&sp->ipcp.update_addrs_enqueued, 1); | |
1076 | workqueue_wait(sp->ipcp.update_addrs_wq, &sp->ipcp.update_addrs_wk); | |||
1076 | workqueue_destroy(sp->ipcp.update_addrs_wq); | 1077 | workqueue_destroy(sp->ipcp.update_addrs_wq); | |
1077 | pcq_destroy(sp->ipcp.update_addrs_q); | 1078 | pcq_destroy(sp->ipcp.update_addrs_q); | |
1078 | 1079 | |||
1079 | callout_stop(&sp->ch[IDX_LCP]); | 1080 | callout_stop(&sp->ch[IDX_LCP]); | |
1080 | callout_stop(&sp->ch[IDX_IPCP]); | 1081 | callout_stop(&sp->ch[IDX_IPCP]); | |
1081 | callout_stop(&sp->ch[IDX_PAP]); | 1082 | callout_stop(&sp->ch[IDX_PAP]); | |
1082 | callout_stop(&sp->ch[IDX_CHAP]); | 1083 | callout_stop(&sp->ch[IDX_CHAP]); | |
1083 | #ifdef INET6 | 1084 | #ifdef INET6 | |
1084 | callout_stop(&sp->ch[IDX_IPV6CP]); | 1085 | callout_stop(&sp->ch[IDX_IPV6CP]); | |
1085 | #endif | 1086 | #endif | |
1086 | callout_stop(&sp->pap_my_to_ch); | 1087 | callout_stop(&sp->pap_my_to_ch); | |
1087 | 1088 | |||
1088 | /* free authentication info */ | 1089 | /* free authentication info */ |