On 2011-06-01 8:28 PM, Robin Kuck wrote:
If the virtual interface is defined before the device itself in the UCI 
configuration, it is not spawned.
The patch allows to spawn virtual interfaces regardless of the order.
---
  package/base-files/files/sbin/wifi |    9 +++++++--
  1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/package/base-files/files/sbin/wifi 
b/package/base-files/files/sbin/wifi
index e2dd0a3..0b25503 100755
--- a/package/base-files/files/sbin/wifi
+++ b/package/base-files/files/sbin/wifi
@@ -164,6 +164,7 @@ scan_wifi() {
                 case "$type" in
                         wifi-device)
                                 append DEVICES "$section"
+                               config_get vifs "$CONFIG_SECTION" vifs ||
                                 config_set "$section" vifs ""
                                 config_set "$section" ht_capab ""
                         ;;
@@ -175,8 +176,12 @@ scan_wifi() {
                         wifi-iface)
                                 config_get device "$CONFIG_SECTION" device
                                 config_get vifs "$device" vifs
-                               append vifs "$CONFIG_SECTION"
-                               config_set "$device" vifs "$vifs"
+                               expr match "$vifs" \
+                                       ".*$CONFIG_SECTION.*">  /dev/null ||
+                               {
+                                       append vifs "$CONFIG_SECTION"
+                                       config_set "$device" vifs "$vifs"
+                               }
                         ;;
                 esac
         }
I don't think this is correct, it looks like this could easily break if multiple wifi-iface sections for multiple different wifi-devices show up before the actual devices. A better solution would be to rework the code to no longer use config_cb, but instead use config_foreach to iterate over wifi-device sections first, then over wifi-iface sections, or something like that.

- Felix
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to