aboutsummaryrefslogtreecommitdiff
path: root/sys/netgraph
diff options
context:
space:
mode:
authorJeffrey Hsu <hsu@FreeBSD.org>2002-12-22 05:35:03 +0000
committerJeffrey Hsu <hsu@FreeBSD.org>2002-12-22 05:35:03 +0000
commitb30a244c34af22d80a4fcba8aa7b423947f8ef42 (patch)
treed0f9ee7e6f9d8014e6f8f94ab6965e85c268792e /sys/netgraph
parent9991ea71785cc4e8661e8fee0aa7475726c7ad87 (diff)
downloadsrc-b30a244c34af22d80a4fcba8aa7b423947f8ef42.tar.gz
src-b30a244c34af22d80a4fcba8aa7b423947f8ef42.zip
SMP locking for ifnet list.
Notes
Notes: svn path=/head/; revision=108172
Diffstat (limited to 'sys/netgraph')
-rw-r--r--sys/netgraph/ng_ether.c2
-rw-r--r--sys/netgraph/ng_gif.c2
-rw-r--r--sys/netgraph/ng_source.c2
3 files changed, 6 insertions, 0 deletions
diff --git a/sys/netgraph/ng_ether.c b/sys/netgraph/ng_ether.c
index da2012f08439..041999c6092a 100644
--- a/sys/netgraph/ng_ether.c
+++ b/sys/netgraph/ng_ether.c
@@ -728,11 +728,13 @@ ng_ether_mod_event(module_t mod, int event, void *data)
ng_ether_input_orphan_p = ng_ether_input_orphan;
/* Create nodes for any already-existing Ethernet interfaces */
+ IFNET_RLOCK();
TAILQ_FOREACH(ifp, &ifnet, if_link) {
if (ifp->if_type == IFT_ETHER
|| ifp->if_type == IFT_L2VLAN)
ng_ether_attach(ifp);
}
+ IFNET_RUNLOCK();
break;
case MOD_UNLOAD:
diff --git a/sys/netgraph/ng_gif.c b/sys/netgraph/ng_gif.c
index c2c87eb75dd6..2d999590f412 100644
--- a/sys/netgraph/ng_gif.c
+++ b/sys/netgraph/ng_gif.c
@@ -564,10 +564,12 @@ ng_gif_mod_event(module_t mod, int event, void *data)
ng_gif_input_orphan_p = ng_gif_input_orphan;
/* Create nodes for any already-existing gif interfaces */
+ IFNET_RLOCK();
TAILQ_FOREACH(ifp, &ifnet, if_link) {
if (ifp->if_type == IFT_GIF)
ng_gif_attach(ifp);
}
+ IFNET_RUNLOCK();
break;
case MOD_UNLOAD:
diff --git a/sys/netgraph/ng_source.c b/sys/netgraph/ng_source.c
index b2e976c10f6f..78525e89672d 100644
--- a/sys/netgraph/ng_source.c
+++ b/sys/netgraph/ng_source.c
@@ -481,10 +481,12 @@ ng_source_store_output_ifp(sc_p sc, struct ng_mesg *msg)
* way of verifying if_index is valid since if_indexlim is
* local to if_attach()
*/
+ IFNET_RLOCK();
TAILQ_FOREACH(ifp, &ifnet, if_link) {
if (ifp->if_index == if_index)
break;
}
+ IFNET_RUNLOCK();
if (ifp == NULL) {
printf("%s: can't find interface %d\n", __FUNCTION__, if_index);