mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-13 20:42:58 +02:00
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
This commit is contained in:
@@ -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")))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user