summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>2001-04-02 21:49:40 +0000
committerbrian <brian@FreeBSD.org>2001-04-02 21:49:40 +0000
commitc7f3f4f6921573ef6761629ae1b756376e15cc3a (patch)
tree70c8c49a34a87d9cc29c768eb726b74c500f0bc5
parent146874eeb60194504260bddae9aade5f1222d6bb (diff)
downloadFreeBSD-src-c7f3f4f6921573ef6761629ae1b756376e15cc3a.zip
FreeBSD-src-c7f3f4f6921573ef6761629ae1b756376e15cc3a.tar.gz
If ifpromisc() fails the SIOCSIFFLAGS ioctl, put ifp->if_flags
back the way we found them.
-rw-r--r--sys/net/if.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index 2598907..08c4a1f2 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1016,7 +1016,9 @@ ifpromisc(ifp, pswitch)
{
struct ifreq ifr;
int error;
+ int oldflags;
+ oldflags = ifp->if_flags;
if (pswitch) {
/*
* If the device is not configured up, we cannot put it in
@@ -1040,6 +1042,8 @@ ifpromisc(ifp, pswitch)
error = (*ifp->if_ioctl)(ifp, SIOCSIFFLAGS, (caddr_t)&ifr);
if (error == 0)
rt_ifmsg(ifp);
+ else
+ ifp->if_flags = oldflags;
return error;
}
OpenPOWER on IntegriCloud