summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarkus <markus@openbsd.org>2004-06-21 23:05:10 +0000
committermarkus <markus@openbsd.org>2004-06-21 23:05:10 +0000
commitbb9fc2dac9c0570be414e8ca12bec33c1a7ad0b1 (patch)
tree206a29e5bbb7590fdc312de36f9fe244a05232cb
parentadd bounded attribute to some functions. anil tested and ok'ed (diff)
downloadwireguard-openbsd-bb9fc2dac9c0570be414e8ca12bec33c1a7ad0b1.tar.xz
wireguard-openbsd-bb9fc2dac9c0570be414e8ca12bec33c1a7ad0b1.zip
move the IFF_UP check to bpfwrite; ok canacar@
-rw-r--r--sys/net/bpf.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/sys/net/bpf.c b/sys/net/bpf.c
index 872cc2ab1ae..d8f5ec3e1ea 100644
--- a/sys/net/bpf.c
+++ b/sys/net/bpf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bpf.c,v 1.48 2004/05/31 13:04:13 markus Exp $ */
+/* $OpenBSD: bpf.c,v 1.49 2004/06/21 23:05:10 markus Exp $ */
/* $NetBSD: bpf.c,v 1.33 1997/02/21 23:59:35 thorpej Exp $ */
/*
@@ -542,6 +542,9 @@ bpfwrite(dev, uio, ioflag)
ifp = d->bd_bif->bif_ifp;
+ if ((ifp->if_flags & IFF_UP) == 0)
+ return (ENETDOWN);
+
if (uio->uio_resid == 0)
return (0);
@@ -948,14 +951,10 @@ bpf_setif(d, ifr)
continue;
/*
* We found the requested interface.
- * If it's not up, return an error.
* Allocate the packet buffers if we need to.
* If we're already attached to requested interface,
* just flush the buffer.
*/
- if ((ifp->if_flags & IFF_UP) == 0)
- return (ENETDOWN);
-
if (d->bd_sbuf == 0) {
error = bpf_allocbufs(d);
if (error != 0)