From 87f7ed9683e78c17df66b66b123b47a2bd89a7ce Mon Sep 17 00:00:00 2001 From: maniacikarus Date: Tue, 19 Feb 2008 20:09:19 +0000 Subject: [PATCH] fixed wirelesscontrol and included in core 8 git-svn-id: http://svn.ipfire.org/svn/ipfire/branches/2.1/trunk@1223 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8 --- config/rootfiles/common/ntfs-3g | 4 +-- config/rootfiles/core/8/files | 1 + config/rootfiles/core/8/update.sh | 2 ++ src/misc-progs/wirelessctrl.c | 44 +++++++++++++------------------ 4 files changed, 23 insertions(+), 28 deletions(-) diff --git a/config/rootfiles/common/ntfs-3g b/config/rootfiles/common/ntfs-3g index b8f85cd25f..d51d88019e 100644 --- a/config/rootfiles/common/ntfs-3g +++ b/config/rootfiles/common/ntfs-3g @@ -2,8 +2,8 @@ bin/ntfs-3g #lib/libntfs-3g.a #lib/libntfs-3g.la lib/libntfs-3g.so -lib/libntfs-3g.so.21 -lib/libntfs-3g.so.21.0.0 +lib/libntfs-3g.so.23 +lib/libntfs-3g.so.23.0.0 sbin/mount.ntfs-3g #usr/include/ntfs-3g #usr/include/ntfs-3g/attrib.h diff --git a/config/rootfiles/core/8/files b/config/rootfiles/core/8/files index f0753cb430..989570be02 100644 --- a/config/rootfiles/core/8/files +++ b/config/rootfiles/core/8/files @@ -4,3 +4,4 @@ lib/modules/2.6.16.57-ipfire-smp/kernel/drivers/net/r8169.ko lib/modules/2.6.16.57-ipfire-smp/kernel/drivers/net/r8168.ko srv/web/ipfire/cgi-bin/logs.cgi/log.dat etc/ntp +usr/local/bin/wirelessctrl diff --git a/config/rootfiles/core/8/update.sh b/config/rootfiles/core/8/update.sh index 996249fa7a..2e88c6ce9a 100644 --- a/config/rootfiles/core/8/update.sh +++ b/config/rootfiles/core/8/update.sh @@ -2,3 +2,5 @@ . /opt/pakfire/lib/functions.sh extract_files depmod -a +echo "DROPWIRELESSFORWARD=on" >> /var/ipfire/optionsfw/settings +echo "DROPWIRELESSINPUT=on" >> /var/ipfire/optionsfw/settings diff --git a/src/misc-progs/wirelessctrl.c b/src/misc-progs/wirelessctrl.c index 321addf905..cfc6192832 100644 --- a/src/misc-progs/wirelessctrl.c +++ b/src/misc-progs/wirelessctrl.c @@ -25,30 +25,6 @@ FILE *fd = NULL; char blue_dev[STRING_SIZE] = ""; char command[STRING_SIZE]; -void exithandler(void) -{ - struct keyvalue *kv = NULL; - char buffer[STRING_SIZE]; - if(strlen(blue_dev)) - { - if(findkey(kv, "DROPWIRELESSINPUT", buffer) && !strcmp(buffer,"on")){ - snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSINPUT -i %s -j LOG --log-prefix 'DROP_Wirelessinput'", blue_dev); - safe_system(command); - } - if(findkey(kv, "DROPWIRELESSFORWARD", buffer) && !strcmp(buffer,"on")){ - snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSFORWARD -i %s -j LOG --log-prefix 'DROP_Wirelessforward'", blue_dev); - safe_system(command); - } - snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSINPUT -i %s -j DROP -m comment --comment 'DROP_Wirelessinput'", blue_dev); - safe_system(command); - snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSINPUT -i %s -j DROP -m comment --comment 'DROP_Wirelessforward'", blue_dev); - safe_system(command); - } - - if (fd) - fclose(fd); -} - int main(void) { char green_dev[STRING_SIZE] = ""; @@ -110,8 +86,24 @@ int main(void) exit(0); } - /* register exit handler to ensure the block rule is always present */ - atexit(exithandler); + if(strlen(blue_dev)) + { + if(findkey(kv, "DROPWIRELESSINPUT", buffer) && !strcmp(buffer,"on")){ + snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSINPUT -i %s -j LOG --log-prefix 'DROP_Wirelessinput'", blue_dev); + safe_system(command); + } + if(findkey(kv, "DROPWIRELESSFORWARD", buffer) && !strcmp(buffer,"on")){ + snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSFORWARD -i %s -j LOG --log-prefix 'DROP_Wirelessforward'", blue_dev); + safe_system(command); + } + snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSINPUT -i %s -j DROP -m comment --comment 'DROP_Wirelessinput'", blue_dev); + safe_system(command); + snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSFORWARD -i %s -j DROP -m comment --comment 'DROP_Wirelessforward'", blue_dev); + safe_system(command); + } + + if (fd) + fclose(fd); if (!(fd = fopen(CONFIG_ROOT "/wireless/config", "r"))) { -- 2.39.2