diff options
author | yar <yar@FreeBSD.org> | 2005-10-03 01:47:43 +0000 |
---|---|---|
committer | yar <yar@FreeBSD.org> | 2005-10-03 01:47:43 +0000 |
commit | 8b308662cd9807a1704b529ddd0e145f51e34b3d (patch) | |
tree | fe985399329ae4e20989877f4657a8522c218a9e /sys | |
parent | 3589b746602ed1ef8d395a1c37417654f0b93120 (diff) | |
download | FreeBSD-src-8b308662cd9807a1704b529ddd0e145f51e34b3d.zip FreeBSD-src-8b308662cd9807a1704b529ddd0e145f51e34b3d.tar.gz |
Log a message about entering or leaving permanently promiscuous mode,
as it is done for usual promiscuous mode already. This info is important
because promiscuous mode in the hands of a malicious party can jeopardize
the whole network.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net/if.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/sys/net/if.c b/sys/net/if.c index b5c8295..bc51abe 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1266,14 +1266,18 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, struct thread *td) if_up(ifp); splx(s); } + /* See if permanently promiscuous mode bit is about to flip */ + if ((ifp->if_flags ^ new_flags) & IFF_PPROMISC) { + if (new_flags & IFF_PPROMISC) + ifp->if_flags |= IFF_PROMISC; + else if (ifp->if_pcount == 0) + ifp->if_flags &= ~IFF_PROMISC; + log(LOG_INFO, "%s: permanently promiscuous mode %s\n", + ifp->if_xname, + (new_flags & IFF_PPROMISC) ? "enabled" : "disabled"); + } 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) { IFF_LOCKGIANT(ifp); (void) (*ifp->if_ioctl)(ifp, cmd, data); |