Author: hauke
Date: 2014-07-05 14:15:03 +0200 (Sat, 05 Jul 2014)
New Revision: 41512

Modified:
   trunk/target/linux/brcm47xx/base-files/etc/init.d/netconfig
Log:
brcm47xx: get switch name from swconfig first

Without this patch the switch config for the adm switch did not worked, 
because hey are not names eth0.

Signed-off-by: Hauke Mehrtens <[email protected]>


Modified: trunk/target/linux/brcm47xx/base-files/etc/init.d/netconfig
===================================================================
--- trunk/target/linux/brcm47xx/base-files/etc/init.d/netconfig 2014-07-05 
12:13:56 UTC (rev 41511)
+++ trunk/target/linux/brcm47xx/base-files/etc/init.d/netconfig 2014-07-05 
12:15:03 UTC (rev 41512)
@@ -45,6 +45,8 @@
 
        local cpuport=5
        [ -e /sbin/swconfig ] && cpuport=$(swconfig dev switch0 help 
2>/dev/null | sed -ne "s|.*cpu @ \([0-9]*\).*|\1|p")
+       local switchname=eth0
+       [ -e /sbin/swconfig ] && switchname=$(swconfig dev switch0 help 
2>/dev/null | sed -ne "s|switch0: \([^\\\\(]*\).*|\1|p")
        local model=$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /machine/ {print $2}' 
/proc/cpuinfo)
 
        local network_defs=`(
@@ -224,14 +226,14 @@
        eval "$network_defs"
 
        [ -n "$vlan1ports" -o -n "$vlan2ports" ] && {
-               local cfg=`ucidef_add_switch "eth0" 1 1`
+               local cfg=`ucidef_add_switch "$switchname" 1 1`
                [ -n "$cfg" ] && uci rename network.$cfg=eth0
                [ -n "$vlan1ports" ] && {
-                       cfg=`ucidef_add_switch_vlan "eth0" 1 "$vlan1ports"`
+                       cfg=`ucidef_add_switch_vlan "$switchname" 1 
"$vlan1ports"`
                        [ -n "$cfg" ] && uci rename network.$cfg=eth0_1
                }
                [ -n "$vlan2ports" ] && {
-                       cfg=`ucidef_add_switch_vlan "eth0" 2 "$vlan2ports"`
+                       cfg=`ucidef_add_switch_vlan "$switchname" 2 
"$vlan2ports"`
                        [ -n "$cfg" ] && uci rename network.$cfg=eth0_2
                }
        }
_______________________________________________
openwrt-commits mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-commits

Reply via email to