]> git.ipfire.org Git - people/ms/ipfire-2.x.git/commitdiff
wirelessctrl: Disable MAC filter on blue if captive portal is enabled
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 4 Feb 2016 14:29:57 +0000 (14:29 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 4 Feb 2016 14:29:57 +0000 (14:29 +0000)
Fixes #11038

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/misc-progs/wirelessctrl.c

index 4a2e6dc862d371f6cb9647766de2a9fd809df11b..7d46e1ea761570695d62a718d7a81ac6140b6942 100644 (file)
@@ -43,6 +43,7 @@ int main(void) {
        char buffer[STRING_SIZE];
        char *index, *ipaddress, *macaddress, *enabled;
        struct keyvalue *kv = NULL;
+       struct keyvalue* captive_settings = NULL;
 
        if (!(initsetuid()))
                exit(1);
@@ -68,6 +69,13 @@ int main(void) {
                exit(1);
        }
 
+       // Read captive portal settings
+       captive_settings = initkeyvalues();
+       if (!readkeyvalues(captive_settings, CONFIG_ROOT "/captive/settings")) {
+               fprintf(stderr, "Could not read captive portal settings\n");
+               exit(1);
+       }
+
        /* Get the GREEN interface details */
        if (findkey(kv, "GREEN_DEV", green_dev) > 0) {
                if (!VALID_DEVICE(green_dev)) {
@@ -88,6 +96,15 @@ int main(void) {
                exit(0);
        }
 
+       // Check if the captive portal is enabled on blue. If so, we will
+       // just keep the chains flushed and do not add any rules.
+       char captive_enabled[STRING_SIZE];
+       if (findkey(captive_settings, "ENABLE_BLUE", captive_enabled) > 0) {
+               if (strcmp(captive_enabled, "on") == 0) {
+                       return 0;
+               }
+       }
+
        if ((fd = fopen(CONFIG_ROOT "/wireless/nodrop", "r")))
                return 0;