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

2015-09-26 Thread Felix Fietkau
On 2015-09-14 11:53, Dmitry Ivanov wrote:
> 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.
Applied with some modifications. Again, please don't repeat the message
subject in the email text, as it gets duplicated in the git commit.

- Felix
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


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

2015-09-14 Thread Dmitry Ivanov
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 
---
 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(>interfaces, >node, vif->name);
 }
 
-- 
2.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel