X-Git-Url: http://git.ipfire.org/?p=people%2Fpmueller%2Fipfire-2.x.git;a=blobdiff_plain;f=src%2Fmisc-progs%2Fwirelessctrl.c;h=12b954baa3f8509ae088fa7990694fd2f2f6dc63;hp=bfd4527041fe437c5658998b8851eb87aa66b8d1;hb=45f26735547337cc1398c98af4f986be2939f55e;hpb=d7501a96b72a4c0d2602230cf6cb7a17fa39b8fe diff --git a/src/misc-progs/wirelessctrl.c b/src/misc-progs/wirelessctrl.c index bfd4527041..12b954baa3 100644 --- a/src/misc-progs/wirelessctrl.c +++ b/src/misc-progs/wirelessctrl.c @@ -101,6 +101,9 @@ int main(void) exit(0); } + if ((fd = fopen(CONFIG_ROOT "/wireless/nodrop", "r"))) + return 0; + /* register exit handler to ensure the block rule is always present */ atexit(exithandler); @@ -148,7 +151,7 @@ int main(void) /* both specified, added security */ if ((strlen(macaddress) == 17) && - (VALID_IP(ipaddress))) { + (VALID_IP_AND_MASK(ipaddress))) { snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSINPUT -m mac --mac-source %s -s %s -i %s -j ACCEPT", macaddress, ipaddress, blue_dev); safe_system(command); snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSFORWARD -m mac --mac-source %s -s %s -i %s ! -o %s -j ACCEPT", macaddress, ipaddress, blue_dev, green_dev); @@ -167,7 +170,7 @@ int main(void) safe_system(command); } - if (VALID_IP(ipaddress)) { + if (VALID_IP_AND_MASK(ipaddress)) { snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSINPUT -s %s -i %s -j ACCEPT", ipaddress, blue_dev); safe_system(command); snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSFORWARD -s %s -i %s ! -o %s -j ACCEPT", ipaddress, blue_dev, green_dev);