promisc: Constify `ifname' parameters to {enter,leave}_promiscuous_mode()
[netsniff-ng.git] / promisc.c
blob56f6e4beb678588c45487004079bde7767f1575e
1 #include <string.h>
2 #include <sys/socket.h>
3 #include <linux/if.h>
5 #include "promisc.h"
6 #include "dev.h"
8 short enter_promiscuous_mode(const char *ifname)
10 short ifflags;
12 if (!strncmp("any", ifname, strlen("any")))
13 return 0;
15 ifflags = device_get_flags(ifname);
16 device_set_flags(ifname, ifflags | IFF_PROMISC);
18 return ifflags;
21 void leave_promiscuous_mode(const char *ifname, short oldflags)
23 if (!strncmp("any", ifname, strlen("any")))
24 return;
26 device_set_flags(ifname, oldflags);