summaryrefslogtreecommitdiff
path: root/dev.c
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2013-08-09 12:04:49 +0200
committerTobias Klauser <tklauser@distanz.ch>2013-08-09 12:04:49 +0200
commita2e70ae5b06ac6fa09cce3848c2ed795967b174f (patch)
tree214b9c1e15a502f4cb57939fceec371c1a970f83 /dev.c
parentaf0c1f5f89750f16054c988937e180764c411c20 (diff)
dev: Integrate `promisc' module into `dev' module
Since entering/leaving promiscuous mode also is a device specific function and all users of the `promisc' module also use `dev', integrate it there. Also rename the functions to have a `device_' prefix like the other functions in the module. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'dev.c')
-rw-r--r--dev.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/dev.c b/dev.c
index 9c7af15..b3249e6 100644
--- a/dev.c
+++ b/dev.c
@@ -189,3 +189,24 @@ u32 device_bitrate(const char *ifname)
return scopper ? : swireless;
}
+
+short device_enter_promiscuous_mode(const 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 device_leave_promiscuous_mode(const char *ifname, short oldflags)
+{
+ if (!strncmp("any", ifname, strlen("any")))
+ return;
+
+ device_set_flags(ifname, oldflags);
+}