summaryrefslogtreecommitdiffstats
path: root/sys/net/bpf.c
diff options
context:
space:
mode:
authorcsjp <csjp@FreeBSD.org>2007-06-15 02:53:51 +0000
committercsjp <csjp@FreeBSD.org>2007-06-15 02:53:51 +0000
commitbc108718c3d31b2745c2045d1712663fabe2cc72 (patch)
treead8469ac2968f9e92df0c7506f3b7de5df4437af /sys/net/bpf.c
parentce1333d9af56208b084f03dd3d826d6e4cb7d516 (diff)
downloadFreeBSD-src-bc108718c3d31b2745c2045d1712663fabe2cc72.zip
FreeBSD-src-bc108718c3d31b2745c2045d1712663fabe2cc72.tar.gz
- Conditionally pickup Giant around the network interface
ioctl routines if we are running with !mpsafenet - Change un-conditional Giant acquisition around ifpromisc to occur only if we are running with !mpsafenet With these locking bits in place, we can now remove the Giant requirement from BPF, so drop the D_NEEDGIANT device flag. This change removes Giant acquisitions around BPF device handlers (read, write, ioctl etc). MFC after: 1 month Discussed with: rwatson
Diffstat (limited to 'sys/net/bpf.c')
-rw-r--r--sys/net/bpf.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/net/bpf.c b/sys/net/bpf.c
index 728bac2..506d15f 100644
--- a/sys/net/bpf.c
+++ b/sys/net/bpf.c
@@ -144,7 +144,6 @@ static d_kqfilter_t bpfkqfilter;
static struct cdevsw bpf_cdevsw = {
.d_version = D_VERSION,
- .d_flags = D_NEEDGIANT,
.d_open = bpfopen,
.d_close = bpfclose,
.d_read = bpfread,
@@ -775,8 +774,10 @@ bpfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags,
if (d->bd_bif == NULL)
error = EINVAL;
else {
+ NET_LOCK_GIANT();
ifp = d->bd_bif->bif_ifp;
error = (*ifp->if_ioctl)(ifp, cmd, addr);
+ NET_UNLOCK_GIANT();
}
break;
}
@@ -834,9 +835,9 @@ bpfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags,
break;
}
if (d->bd_promisc == 0) {
- mtx_lock(&Giant);
+ NET_LOCK_GIANT();
error = ifpromisc(d->bd_bif->bif_ifp, 1);
- mtx_unlock(&Giant);
+ NET_UNLOCK_GIANT();
if (error == 0)
d->bd_promisc = 1;
}
OpenPOWER on IntegriCloud