summaryrefslogtreecommitdiff
path: root/promisc.c
diff options
context:
space:
mode:
Diffstat (limited to 'promisc.c')
-rw-r--r--promisc.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/promisc.c b/promisc.c
new file mode 100644
index 0000000..721da18
--- /dev/null
+++ b/promisc.c
@@ -0,0 +1,25 @@
+#include <string.h>
+
+#include "promisc.h"
+#include "xutils.h"
+
+short enter_promiscuous_mode(char *ifname)
+{
+ short ifflags;
+
+ if (!strncmp("any", ifname, strlen("any")))
+ return 0;
+
+ ifflags = device_get_flags(ifname);
+ device_set_flags(ifname, ifflags | IFF_PROMISC);
+
+ return ifflags;
+}
+
+void leave_promiscuous_mode(char *ifname, short oldflags)
+{
+ if (!strncmp("any", ifname, strlen("any")))
+ return;
+
+ device_set_flags(ifname, oldflags);
+}