summaryrefslogtreecommitdiff
path: root/sys/net/if.c
diff options
context:
space:
mode:
authorMaxim Sobolev <sobomax@FreeBSD.org>2002-08-19 15:16:38 +0000
committerMaxim Sobolev <sobomax@FreeBSD.org>2002-08-19 15:16:38 +0000
commitffb079be0c99ee646d51ffd744daaa50fd86b886 (patch)
tree2e1436eccf89dbd4a420091b15a0d5dd78911874 /sys/net/if.c
parent5a155b405e954207b870900889cabf117029c1d6 (diff)
Notes
Diffstat (limited to 'sys/net/if.c')
-rw-r--r--sys/net/if.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index 969963de5bff..a55114818e07 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1291,6 +1291,12 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, struct thread *td)
}
ifp->if_flags = (ifp->if_flags & IFF_CANTCHANGE) |
(new_flags &~ IFF_CANTCHANGE);
+ if (new_flags & IFF_PPROMISC) {
+ /* Permanently promiscuous mode requested */
+ ifp->if_flags |= IFF_PROMISC;
+ } else if (ifp->if_pcount == 0) {
+ ifp->if_flags &= ~IFF_PROMISC;
+ }
if (ifp->if_ioctl)
(void) (*ifp->if_ioctl)(ifp, cmd, data);
getmicrotime(&ifp->if_lastchange);
@@ -1561,6 +1567,11 @@ ifpromisc(ifp, pswitch)
oldpcount = ifp->if_pcount;
oldflags = ifp->if_flags;
+ if (ifp->if_flags & IFF_PPROMISC) {
+ /* Do nothing if device is in permanently promiscuous mode */
+ ifp->if_pcount += pswitch ? 1 : -1;
+ return (0);
+ }
if (pswitch) {
/*
* If the device is not configured up, we cannot put it in