[OpenWrt-Devel] [PATCH v2][netifd] Initialize wireless interface attributes in proper function

Dmitry Ivanov dmitrijs.ivanovs at ubnt.com
Mon Sep 14 05:53:14 EDT 2015


Initialize wireless interface attributes in proper function.

Currently multicast to unicast feature may be configured for incorrect wireless interface in case of reconfiguration.

Test case:

Initial wireless configuration:

config wifi-iface
  option mode ap
  option disabled 1

config wifi-iface
  option mode sta
  option disabled 0

config wifi-iface
  option mode ap
  option disabled 0

After reboot, multicast to unicast feature is configured for interface #3 (wlan0-1) only.

Next, enable interface #1 and issue "wifi" command. Now, multicast to unicast feature is configured for interface #2 (wlan0) which is wrong.
It should be configured for interfaces #1 and #3 only. This patch resolves this problem.


Signed-off-by: Dmitry Ivanov <dima at ubnt.com>
---
 wireless.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/wireless.c b/wireless.c
index dcadfad..f0b19aa 100644
--- a/wireless.c
+++ b/wireless.c
@@ -559,6 +559,14 @@ wireless_interface_init_config(struct wireless_interface *vif)
 
 	if ((cur = tb[VIF_ATTR_NETWORK]))
 		vif->network = cur;
+
+	cur = tb[VIF_ATTR_ISOLATE];
+	if (cur && blobmsg_get_bool(cur))
+		vif->isolate = blobmsg_get_bool(cur);
+
+	cur = tb[VIF_ATTR_MODE];
+	if (cur)
+		vif->ap_mode = !strcmp(blobmsg_get_string(cur), "ap");
 }
 
 static void
@@ -715,14 +723,6 @@ void wireless_interface_create(struct wireless_device *wdev, struct blob_attr *d
 	vif->section = section;
 	vif->isolate = false;
 
-	cur = tb[VIF_ATTR_ISOLATE];
-	if (cur && blobmsg_get_bool(cur))
-		vif->isolate = blobmsg_get_bool(cur);
-
-	cur = tb[VIF_ATTR_MODE];
-	if (cur && !strcmp(blobmsg_get_string(cur), "ap"))
-		vif->ap_mode = true;
-
 	vlist_add(&wdev->interfaces, &vif->node, vif->name);
 }
 
-- 
2.1.4
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list