From ece49e245405525cdd3b9fb5ebbe105fb81e076c Mon Sep 17 00:00:00 2001 From: Tim Niemeyer Date: Sat, 16 Aug 2014 01:11:18 +0200 Subject: [PATCH] bsp/def/network.sh: configure switch based on HW name Signed-off-by: Tim Niemeyer --- bsp/default/root_file_system/etc/network.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bsp/default/root_file_system/etc/network.sh b/bsp/default/root_file_system/etc/network.sh index f1d43f4f..24a30b91 100644 --- a/bsp/default/root_file_system/etc/network.sh +++ b/bsp/default/root_file_system/etc/network.sh @@ -5,13 +5,17 @@ if ! uci get nodewatcher.@network[0].client_interfaces; then fi if ! uci get network.$SWITCHDEV.ifname; then + + SWITCHHW=$(swconfig list | awk '{ print $4 }') + uci set network.$SWITCHDEV=switch + uci set network.$SWITCHDEV.name=$SWITCHHW uci set network.$SWITCHDEV.enable=1 uci set network.$SWITCHDEV.reset=1 uci set network.$SWITCHDEV.enable_vlan=1 uci set network.${SWITCHDEV}_1=switch_vlan - uci set network.${SWITCHDEV}_1.device=$SWITCHDEV + uci set network.${SWITCHDEV}_1.device=$SWITCHHW uci set network.${SWITCHDEV}_1.vlan=1 uci set network.${SWITCHDEV}_1.ports="$CLIENT_PORTS" @@ -19,7 +23,7 @@ if ! uci get network.$SWITCHDEV.ifname; then if [[ "$WANDEV" = "$SWITCHDEV" ]]; then uci set network.${SWITCHDEV}_2=switch_vlan - uci set network.${SWITCHDEV}_2.device=$SWITCHDEV + uci set network.${SWITCHDEV}_2.device=$SWITCHHW uci set network.${SWITCHDEV}_2.vlan=2 uci set network.${SWITCHDEV}_2.ports="$WAN_PORTS" @@ -35,7 +39,7 @@ if ! uci get network.$SWITCHDEV.ifname; then fi uci set network.${SWITCHDEV}_3=switch_vlan - uci set network.${SWITCHDEV}_3.device=$SWITCHDEV + uci set network.${SWITCHDEV}_3.device=$SWITCHHW uci set network.${SWITCHDEV}_3.vlan=3 uci set network.${SWITCHDEV}_3.ports="$BATMAN_PORTS"