wireless: only enable proxyarp/isolate for AP vifs
authorFelix Fietkau <nbd@nbd.name>
Mon, 20 Sep 2021 16:00:03 +0000 (18:00 +0200)
committerFelix Fietkau <nbd@nbd.name>
Mon, 20 Sep 2021 16:00:05 +0000 (18:00 +0200)
The settings might be present in the config as leftovers when switching
a vif from AP to sta mode. In that case, they will not be applied by wpad,
so they also must not be used by netifd

Signed-off-by: Felix Fietkau <nbd@nbd.name>
wireless.c

index 29feb6aad7a9da5ef2c6659a3ebdd83696702635..fbd42ed3faaa02b9567188e18dd28bdbff2464af 100644 (file)
@@ -793,6 +793,13 @@ wireless_interface_init_config(struct wireless_interface *vif)
        if ((cur = tb[VIF_ATTR_NETWORK]))
                vif->network = cur;
 
+       cur = tb[VIF_ATTR_MODE];
+       if (cur)
+               vif->ap_mode = !strcmp(blobmsg_get_string(cur), "ap");
+
+       if (!vif->ap_mode)
+               return;
+
        cur = tb[VIF_ATTR_ISOLATE];
        if (cur)
                vif->isolate = blobmsg_get_bool(cur);
@@ -801,9 +808,6 @@ wireless_interface_init_config(struct wireless_interface *vif)
        if (cur)
                vif->proxyarp = blobmsg_get_bool(cur);
 
-       cur = tb[VIF_ATTR_MODE];
-       if (cur)
-               vif->ap_mode = !strcmp(blobmsg_get_string(cur), "ap");
 }
 
 /* vlist update call for wireless interface list */