diff options
author | Mike Belopuhov <mikeb@cvs.openbsd.org> | 2016-12-21 13:13:02 +0000 |
---|---|---|
committer | Mike Belopuhov <mikeb@cvs.openbsd.org> | 2016-12-21 13:13:02 +0000 |
commit | ded6784166a750fabf7284d2a7a2156a11f40388 (patch) | |
tree | 6dd2f1225e1c1068bd68564a6ee32d60394ca149 /sys/net/if_tun.c | |
parent | 17a48737d240e9344679e68a7d691f8cd69a5f39 (diff) |
Grab the netlock when opened and closed; ok mpi, rzalamena
Diffstat (limited to 'sys/net/if_tun.c')
-rw-r--r-- | sys/net/if_tun.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c index 05e812d35fe..9529a29e84f 100644 --- a/sys/net/if_tun.c +++ b/sys/net/if_tun.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_tun.c,v 1.170 2016/12/12 09:51:30 mpi Exp $ */ +/* $OpenBSD: if_tun.c,v 1.171 2016/12/21 13:13:01 mikeb Exp $ */ /* $NetBSD: if_tun.c,v 1.24 1996/05/07 02:40:48 thorpej Exp $ */ /* @@ -319,9 +319,9 @@ tunopen(dev_t dev, int flag, int mode, struct proc *p) int s, error; snprintf(xname, sizeof(xname), "%s%d", "tun", minor(dev)); - s = splsoftnet(); + NET_LOCK(s); error = if_clone_create(xname, rdomain); - splx(s); + NET_UNLOCK(s); if (error != 0) return (error); @@ -344,9 +344,9 @@ tapopen(dev_t dev, int flag, int mode, struct proc *p) int s, error; snprintf(xname, sizeof(xname), "%s%d", "tap", minor(dev)); - s = splsoftnet(); + NET_LOCK(s); error = if_clone_create(xname, rdomain); - splx(s); + NET_UNLOCK(s); if (error != 0) return (error); @@ -427,9 +427,9 @@ tun_dev_close(struct tun_softc *tp, int flag, int mode, struct proc *p) TUNDEBUG(("%s: closed\n", ifp->if_xname)); if (!(tp->tun_flags & TUN_STAYUP)) { - s = splsoftnet(); + NET_LOCK(s); error = if_clone_destroy(ifp->if_xname); - splx(s); + NET_UNLOCK(s); } else { tp->tun_pgid = 0; selwakeup(&tp->tun_rsel); |