summaryrefslogtreecommitdiffstats
path: root/sys/net/bpf.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2007-08-06 14:26:03 +0000
committerrwatson <rwatson@FreeBSD.org>2007-08-06 14:26:03 +0000
commit23574c86734ab5cb088584d30345e698cbbeaef2 (patch)
tree63e9e0c42ec5669b83e25b5f9cbdcbee7e1be6dc /sys/net/bpf.c
parent5f4b9d20fc4bf36bf86f78bb1622ee474a93dc56 (diff)
downloadFreeBSD-src-23574c86734ab5cb088584d30345e698cbbeaef2.zip
FreeBSD-src-23574c86734ab5cb088584d30345e698cbbeaef2.tar.gz
Remove the now-unused NET_{LOCK,UNLOCK,ASSERT}_GIANT() macros, which
previously conditionally acquired Giant based on debug.mpsafenet. As that has now been removed, they are no longer required. Removing them significantly simplifies error-handling in the socket layer, eliminated quite a bit of unwinding of locking in error cases. While here clean up the now unneeded opt_net.h, which previously was used for the NET_WITH_GIANT kernel option. Clean up some related gotos for consistency. Reviewed by: bz, csjp Tested by: kris Approved by: re (kensmith)
Diffstat (limited to 'sys/net/bpf.c')
-rw-r--r--sys/net/bpf.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/sys/net/bpf.c b/sys/net/bpf.c
index 08ec25a..5d6dc02 100644
--- a/sys/net/bpf.c
+++ b/sys/net/bpf.c
@@ -645,16 +645,12 @@ bpfwrite(struct cdev *dev, struct uio *uio, int ioflag)
BPFD_UNLOCK(d);
#endif
- NET_LOCK_GIANT();
error = (*ifp->if_output)(ifp, m, &dst, NULL);
- NET_UNLOCK_GIANT();
if (mc != NULL) {
- if (error == 0) {
- NET_LOCK_GIANT();
+ if (error == 0)
(*ifp->if_input)(ifp, mc);
- NET_UNLOCK_GIANT();
- } else
+ else
m_freem(mc);
}
@@ -776,10 +772,8 @@ 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;
}
@@ -837,9 +831,7 @@ bpfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags,
break;
}
if (d->bd_promisc == 0) {
- NET_LOCK_GIANT();
error = ifpromisc(d->bd_bif->bif_ifp, 1);
- NET_UNLOCK_GIANT();
if (error == 0)
d->bd_promisc = 1;
}
OpenPOWER on IntegriCloud