diff options
author | sobomax <sobomax@FreeBSD.org> | 2002-08-19 15:16:38 +0000 |
---|---|---|
committer | sobomax <sobomax@FreeBSD.org> | 2002-08-19 15:16:38 +0000 |
commit | e50e3b03ec109b238fb7d960a5be0b08961b41d4 (patch) | |
tree | 2e1436eccf89dbd4a420091b15a0d5dd78911874 /sbin | |
parent | be3fb716390064e92134d98e272ab35537b33ce9 (diff) | |
download | FreeBSD-src-e50e3b03ec109b238fb7d960a5be0b08961b41d4.zip FreeBSD-src-e50e3b03ec109b238fb7d960a5be0b08961b41d4.tar.gz |
Implement user-setable promiscuous mode (a new `promisc' flag for ifconfig(8)).
Also, for all interfaces in this mode pass all ethernet frames to upper layer,
even those not addressed to our own MAC, which allows packets encapsulated
in those frames be processed with packet filters (ipfw(8) et al).
Emphatically requested by: Anton Turygin <pa3op@ukr-link.net>
Valuable suggestions by: fenner
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/ifconfig/ifconfig.8 | 4 | ||||
-rw-r--r-- | sbin/ifconfig/ifconfig.c | 4 |
2 files changed, 7 insertions, 1 deletions
diff --git a/sbin/ifconfig/ifconfig.8 b/sbin/ifconfig/ifconfig.8 index be8fd50..39761fb 100644 --- a/sbin/ifconfig/ifconfig.8 +++ b/sbin/ifconfig/ifconfig.8 @@ -237,6 +237,10 @@ Enable driver dependent debugging code; usually, this turns on extra console error logging. .It Fl debug Disable driver dependent debugging code. +.It Cm promisc +Put interface into permanently promiscuous mode. +.It Fl promisc +Disable permanently promiscuous mode. .It Cm delete Another name for the .Fl alias diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c index 67c293e..c9ab382 100644 --- a/sbin/ifconfig/ifconfig.c +++ b/sbin/ifconfig/ifconfig.c @@ -202,6 +202,8 @@ struct cmd { { "-arp", IFF_NOARP, setifflags }, { "debug", IFF_DEBUG, setifflags }, { "-debug", -IFF_DEBUG, setifflags }, + { "promisc", IFF_PPROMISC, setifflags }, + { "-promisc", -IFF_PPROMISC, setifflags }, { "add", IFF_UP, notealias }, { "alias", IFF_UP, notealias }, { "-alias", -IFF_UP, notealias }, @@ -999,7 +1001,7 @@ setifflags(const char *vname, int value, int s, const struct afswtch *afp) exit(1); } strncpy(my_ifr.ifr_name, name, sizeof (my_ifr.ifr_name)); - flags = (my_ifr.ifr_flags & 0xffff) | (my_ifr.ifr_flagshigh << 16); + flags = (my_ifr.ifr_flags & 0xffff) | (my_ifr.ifr_flagshigh << 16); if (value < 0) { value = -value; |