board.d: merge ucidef_add_switch() and ucidef_add_switch_ports()
authorJo-Philipp Wich <jow@openwrt.org>
Thu, 3 Dec 2015 17:30:24 +0000 (17:30 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Thu, 3 Dec 2015 17:30:24 +0000 (17:30 +0000)
This changes uci-defaults-new.sh, config_generate and all relevant board.d
files in order combine ucidef_add_switch() and ucidef_add_switch_ports() into
a single function.

Also removes now superfluous enable and reset arguments.

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
SVN-Revision: 47721

package/base-files/files/lib/functions/uci-defaults-new.sh
target/linux/ar71xx/base-files/etc/board.d/02_network
target/linux/bcm53xx/base-files/etc/board.d/02_network
target/linux/mpc85xx/base-files/etc/board.d/02_network
target/linux/mvebu/base-files/etc/board.d/02_network
target/linux/ramips/base-files/etc/board.d/02_network

index e652a8b52170a598f691b920cc32c03603c41d54..f025cb696efe63e3a9945fade60b4e74a985ca48 100755 (executable)
@@ -82,35 +82,6 @@ ucidef_set_interfaces_lan_wan() {
        json_select ..
 }
 
-ucidef_add_switch() {
-       local name="$1"
-
-       json_select_object switch
-               json_select_object "$name"
-                       json_add_boolean enable 1
-                       json_add_boolean reset 1
-               json_select ..
-       json_select ..
-}
-
-ucidef_add_switch_attr() {
-       local name="$1"
-       local key="$2"
-       local val="$3"
-
-       json_select_object switch
-               json_select_object "$name"
-
-               case "$val" in
-                       true|false) [ "$val" != "true" ]; json_add_boolean "$key" $? ;;
-                       [0-9]) json_add_int "$key" "$val" ;;
-                       *) json_add_string "$key" "$val" ;;
-               esac
-
-               json_select ..
-       json_select ..
-}
-
 _ucidef_add_switch_port() {
        # inherited: $num $device $need_tag $role $index $prev_role
        # inherited: $n_cpu $n_ports $n_vlan $cpu0 $cpu1 $cpu2 $cpu3 $cpu4 $cpu5
@@ -205,50 +176,69 @@ _ucidef_finish_switch_roles() {
        done
 }
 
-ucidef_add_switch_ports() {
+ucidef_add_switch() {
        local name="$1"; shift
        local port num role device index need_tag prev_role
        local cpu0 cpu1 cpu2 cpu3 cpu4 cpu5
        local n_cpu=0 n_vlan=0 n_ports=0
 
        json_select_object switch
-       json_select_object "$name"
-
-       for port in "$@"; do
-               case "$port" in
-                       [0-9]*@*)
-                               num="${port%%@*}"
-                               device="${port##*@}"
-                               need_tag=0
-                               [ "${num%t}" != "$num" ] && {
-                                       num="${num%t}"
-                                       need_tag=1
-                               }
-                       ;;
-                       [0-9]*:*:[0-9]*)
-                               num="${port%%:*}"
-                               index="${port##*:}"
-                               role="${port#[0-9]*:}"; role="${role%:*}"
-                       ;;
-                       [0-9]*:*)
-                               num="${port%%:*}"
-                               role="${port##*:}"
-                       ;;
-               esac
-
-               if [ -n "$num" ] && [ -n "$device$role" ]; then
-                       _ucidef_add_switch_port
-               fi
+               json_select_object "$name"
+                       json_add_boolean enable 1
+                       json_add_boolean reset 1
 
-               unset num device role index need_tag
-       done
+                       for port in "$@"; do
+                               case "$port" in
+                                       [0-9]*@*)
+                                               num="${port%%@*}"
+                                               device="${port##*@}"
+                                               need_tag=0
+                                               [ "${num%t}" != "$num" ] && {
+                                                       num="${num%t}"
+                                                       need_tag=1
+                                               }
+                                       ;;
+                                       [0-9]*:*:[0-9]*)
+                                               num="${port%%:*}"
+                                               index="${port##*:}"
+                                               role="${port#[0-9]*:}"; role="${role%:*}"
+                                       ;;
+                                       [0-9]*:*)
+                                               num="${port%%:*}"
+                                               role="${port##*:}"
+                                       ;;
+                               esac
+
+                               if [ -n "$num" ] && [ -n "$device$role" ]; then
+                                       _ucidef_add_switch_port
+                               fi
 
-       json_select ..
+                               unset num device role index need_tag
+                       done
+               json_select ..
        json_select ..
 
        _ucidef_finish_switch_roles
 }
 
+ucidef_add_switch_attr() {
+       local name="$1"
+       local key="$2"
+       local val="$3"
+
+       json_select_object switch
+               json_select_object "$name"
+
+               case "$val" in
+                       true|false) [ "$val" != "true" ]; json_add_boolean "$key" $? ;;
+                       [0-9]) json_add_int "$key" "$val" ;;
+                       *) json_add_string "$key" "$val" ;;
+               esac
+
+               json_select ..
+       json_select ..
+}
+
 ucidef_add_switch_port_attr() {
        local name="$1"
        local port="$2"
index 707f7d67987ef435592989be66d3a38b2eb9918e..b88b6bb046bb58404b8b7fdb219cc41c3294bbce 100755 (executable)
@@ -25,24 +25,21 @@ ubnt-unifi-outdoor)
 ap132 |\
 wlr8100)
        ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
-       ucidef_add_switch "switch0" "1" "1"
-       ucidef_add_switch_ports "switch0" \
+       ucidef_add_switch "switch0" \
                "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
        ;;
 
 esr1750 |\
 epg5000)
        ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
-       ucidef_add_switch "switch0" "1" "1"
-       ucidef_add_switch_ports "switch0" \
+       ucidef_add_switch "switch0" \
                "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan"
        ;;
 
 ap136-010 |\
 ap147-010)
        ucidef_set_interfaces_lan_wan "eth0" "eth1"
-       ucidef_add_switch "switch0" "1" "1"
-       ucidef_add_switch_ports "switch0" \
+       ucidef_add_switch "switch0" \
                "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "6@eth1"
        ;;
 
@@ -51,8 +48,7 @@ ap135-020 |\
 tl-wr1043nd-v2 |\
 wzr-450hp2)
        ucidef_set_interfaces_lan_wan "eth1" "eth0"
-       ucidef_add_switch "switch0" "1" "1"
-       ucidef_add_switch_ports "switch0" \
+       ucidef_add_switch "switch0" \
                "0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan" "6@eth0"
        ;;
 
@@ -60,30 +56,26 @@ archer-c5 |\
 archer-c7 |\
 tl-wdr4900-v2)
        ucidef_set_interfaces_lan_wan "eth1" "eth0"
-       ucidef_add_switch "switch0" "1" "1"
-       ucidef_add_switch_ports "switch0" \
+       ucidef_add_switch "switch0" \
                "0@eth1" "2:lan" "3:lan" "4:lan" "5:lan" "6@eth0" "1:wan"
        ;;
 
 bsb)
        ucidef_set_interfaces_lan_wan "eth1" "eth0"
-       ucidef_add_switch "switch0" "1" "1"
-       ucidef_add_switch_ports "switch0" \
+       ucidef_add_switch "switch0" \
                "0@eth1" "1:lan" "3:lan"  # XXX: confirm cpu port!
        ucidef_set_interface_wlan
        ;;
 
 cpe510)
        ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
-       ucidef_add_switch "switch0" "1" "1"
-       ucidef_add_switch_ports "switch0" \
+       ucidef_add_switch "switch0" \
                "0@eth0" "5:lan" "4:wan"
        ;;
 
 airgatewaypro)
        ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
-       ucidef_add_switch "switch0" "1" "1"
-       ucidef_add_switch_ports "switch0" \
+       ucidef_add_switch "switch0" \
                "0@eth0" "4:lan" "5:wan"
        ;;
 
@@ -94,52 +86,46 @@ rb-2011uias |\
 rb-2011uas-2hnd|\
 rb-2011uias-2hnd)
        ucidef_set_interfaces_lan_wan "eth0.1 eth1" "eth0.2"
-       ucidef_add_switch "switch0" "1" "1"
 
        case "$board" in
        rb-2011uas* | rb-2011uias | rb-2011uias-2hnd)
-               ucidef_add_switch_ports "switch0" \
+               ucidef_add_switch "switch0" \
                        "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan" "6:sfp"
        ;;
        *)
-               ucidef_add_switch_ports "switch0" \
+               ucidef_add_switch "switch0" \
                        "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
        ;;
        esac
 
-       ucidef_add_switch "switch1" "1" "1"
-       ucidef_add_switch_ports "switch1" \
+       ucidef_add_switch "switch1" \
                "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:lan"
        ;;
 
 dir-825-b1|\
 tew-673gru)
        ucidef_set_interfaces_lan_wan "eth0" "eth1"
-       ucidef_add_switch "switch0" "1" "1"
-       ucidef_add_switch_ports "switch0" \
+       ucidef_add_switch "switch0" \
                "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
        ;;
 
 f9k1115v2)
        ucidef_set_interfaces_lan_wan "eth1" "eth0"
-       ucidef_add_switch "switch0" "1" "1"
-       ucidef_add_switch_ports "switch0" \
+       ucidef_add_switch "switch0" \
                "2:lan" "3:lan" "4:lan" "5:lan" "6@eth1" \
                "0@eth0" "1:wan"  # XXX: confirm cpu ports!
        ;;
 
 nbg460n_550n_550nh)
        ucidef_set_interfaces_lan_wan "eth0" "eth1"
-       ucidef_add_switch "switch0" "1" "1"
-       ucidef_add_switch_ports "switch0" \
+       ucidef_add_switch "switch0" \
                "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
        ;;
 
 nbg6616 |\
 nbg6716)
        ucidef_set_interfaces_lan_wan "eth0" "eth1"
-       ucidef_add_switch "switch0" "1" "1"
-       ucidef_add_switch_ports "switch0" \
+       ucidef_add_switch "switch0" \
                "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" \
                "5:wan" "6@eth1"
        ;;
@@ -148,30 +134,26 @@ ap143 |\
 rb-433 |\
 rb-433u)
        ucidef_set_interfaces_lan_wan "eth1" "eth0"
-       ucidef_add_switch "switch0" "1" "1"
-       ucidef_add_switch_ports "switch0" \
+       ucidef_add_switch "switch0" \
                "1:lan" "2:lan" "5@eth1"
        ;;
 
 rb-435g)
        ucidef_set_interfaces_lan_wan "eth1" "eth0"
-       ucidef_add_switch "switch0" "1" "1"
-       ucidef_add_switch_ports "switch0" \
+       ucidef_add_switch "switch0" \
                "0@eth1" "1:lan" "2:lan" # XXX: confirm!
        ;;
 
 rb-450)
        ucidef_set_interfaces_lan_wan "eth1" "eth0"
-       ucidef_add_switch "switch0" "1" "1"
-       ucidef_add_switch_ports "switch0" \
+       ucidef_add_switch "switch0" \
                "0:lan" "1:lan" "2:lan" "3:lan" "5@eth1"
        ;;
 
 rb-450g |\
 routerstation-pro)
        ucidef_set_interfaces_lan_wan "eth1" "eth0"
-       ucidef_add_switch "switch0" "1" "1"
-       ucidef_add_switch_ports "switch0" \
+       ucidef_add_switch "switch0" \
                "0@eth1" "2:lan:3" "3:lan:2" "4:lan:1"
        ;;
 
@@ -181,8 +163,7 @@ rb-751g |\
 rb-951g-2hnd |\
 wzr-hp-g450h)
        ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
-       ucidef_add_switch "switch0" "1" "1"
-       ucidef_add_switch_ports "switch0" \
+       ucidef_add_switch "switch0" \
                "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
        ;;
 
@@ -192,11 +173,9 @@ rb-951ui-2hnd)
 
 rb-493g)
        ucidef_set_interfaces_lan_wan "eth0 eth1.1" "eth1.2"
-       ucidef_add_switch "switch0" "1" "1"
-       ucidef_add_switch_ports "switch0" \
+       ucidef_add_switch "switch0" \
                "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
-       ucidef_add_switch "switch1" "1" "1"
-       ucidef_add_switch_ports "switch1" \
+       ucidef_add_switch "switch1" \
                "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
        ;;
 
@@ -204,37 +183,32 @@ wzr-hp-g300nh2 |\
 pb92 |\
 ap113)
        ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
-       ucidef_add_switch "switch0" "1" "1"
-       ucidef_add_switch_ports "switch0" \
+       ucidef_add_switch "switch0" \
                "0@eth0" "1:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "2:wan"
        ;;
 
 el-m150)
        ucidef_set_interfaces_lan_wan "eth1" "eth0"
-       ucidef_add_switch "switch0" "1" "1"
-       ucidef_add_switch_ports "switch0" \
+       ucidef_add_switch "switch0" \
                "0:lan" "1:lan" "3@eth1" # XXX: confirm!
        ;;
 
 tl-wdr4300|\
 tl-wr1041n-v2)
        ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
-       ucidef_add_switch "switch0" "1" "1"
-       ucidef_add_switch_ports "switch0" \
+       ucidef_add_switch "switch0" \
                "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan"
        ;;
 
 tl-wr1043nd)
        ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
-       ucidef_add_switch "switch0" "1" "1"
-       ucidef_add_switch_ports "switch0" \
+       ucidef_add_switch "switch0" \
                "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0"
        ;;
 
 tl-wr2543n)
        ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
-       ucidef_add_switch "switch0" "1" "1"
-       ucidef_add_switch_ports "switch0" \
+       ucidef_add_switch "switch0" \
                "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9@eth0"
        ;;
 
@@ -259,36 +233,31 @@ wnr2200 |\
 wnr612-v2 |\
 wnr1000-v2)
        ucidef_set_interfaces_lan_wan "eth1" "eth0"
-       ucidef_add_switch "switch0" "1" "1"
-       ucidef_add_switch_ports "switch0" \
+       ucidef_add_switch "switch0" \
                "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth1" # XXX: confirm!
        ;;
 
 uap-pro)
        ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
-       ucidef_add_switch "switch0" "1" "1"
-       ucidef_add_switch_ports "switch0" \
+       ucidef_add_switch "switch0" \
                "0@eth0" "1:lan" "2:wan"
        ;;
 
 nanostation-m-xw)
        ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
-       ucidef_add_switch "switch0" "1" "1"
-       ucidef_add_switch_ports "switch0" \
+       ucidef_add_switch "switch0" \
                "0@eth0" "5:lan" "1:wan"
        ;;
 
 wrt160nl)
        ucidef_set_interfaces_lan_wan "eth0" "eth1"
-       ucidef_add_switch "switch0" "1" "1"
-       ucidef_add_switch_ports "switch0" \
+       ucidef_add_switch "switch0" \
                "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth0"
        ;;
 
 wzr-hp-g300nh)
        ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
-       ucidef_add_switch "switch0" "1" "1"
-       ucidef_add_switch_ports "switch0" \
+       ucidef_add_switch "switch0" \
                "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
        ;;
 
@@ -296,8 +265,7 @@ dgl-5500-a1 |\
 dir-825-c1)
        local mac
        ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
-       ucidef_add_switch "switch0" "1" "1"
-       ucidef_add_switch_ports "switch0" \
+       ucidef_add_switch "switch0" \
                "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
        mac=$(mtd_get_mac_ascii nvram "wan_mac")
        [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
@@ -306,8 +274,7 @@ dir-825-c1)
 mynet-n750)
        local mac
        ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
-       ucidef_add_switch "switch0" "1" "1"
-       ucidef_add_switch_ports "switch0" \
+       ucidef_add_switch "switch0" \
                "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
        mac=$(mtd_get_mac_ascii devdata "wanmac")
        [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
@@ -322,8 +289,7 @@ dir-835-a1 |\
 wndr3700v4 | \
 wndr4300)
        ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
-       ucidef_add_switch "switch0" "1" "1"
-       ucidef_add_switch_ports "switch0" \
+       ucidef_add_switch "switch0" \
                "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
        mac_lan=$(mtd_get_mac_binary caldata 0)
        [ -n "$mac_lan" ] && ucidef_set_interface_macaddr "lan" "$mac_lan"
@@ -334,8 +300,7 @@ wndr4300)
 esr900)
        local mac
        ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
-       ucidef_add_switch "switch0" "1" "1"
-       ucidef_add_switch_ports "switch0" \
+       ucidef_add_switch "switch0" \
                "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
        mac=$(mtd_get_mac_ascii u-boot-env "wanaddr")
        [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
@@ -425,15 +390,13 @@ wpe72)
 
 gl-ar300)
        ucidef_set_interfaces_lan_wan "eth1" "eth0"
-       ucidef_add_switch "switch0" "1" "1"
-       ucidef_add_switch_ports "switch0" \
+       ucidef_add_switch "switch0" \
                "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan"
        ;;
 
 wpj344)
        ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
-       ucidef_add_switch "switch0" "1" "1"
-       ucidef_add_switch_ports "switch0" \
+       ucidef_add_switch "switch0" \
                "0@eth0" "3:lan" "2:wan"
        ;;
 
@@ -443,8 +406,7 @@ wpj531)
 
 wpj558)
        ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
-       ucidef_add_switch "switch0" "1" "1"
-       ucidef_add_switch_ports "switch0" \
+       ucidef_add_switch "switch0" \
                "5:lan" "1:wan" "6@eth0"
        ;;
 
@@ -482,35 +444,30 @@ whr-hp-g300n |\
 whr-hp-gn |\
 wzr-hp-ag300h)
        ucidef_set_interfaces_lan_wan "eth0" "eth1"
-       ucidef_add_switch "switch0" "1" "1"
-       ucidef_add_switch_ports "switch0" \
+       ucidef_add_switch "switch0" \
                "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
        ;;
 
 wzr-hp-g450h)
        ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
-       ucidef_add_switch "switch0" "1" "1"
-       ucidef_add_switch_ports "switch0" \
+       ucidef_add_switch "switch0" \
                "0@eth0" "2:lan:1 3:lan:2 4:lan:3 5:lan:4" "1:wan"
        ;;
 
 ew-dorin)
        ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
-       ucidef_add_switch "switch0" "1" "1"
-       ucidef_add_switch_ports "switch0" \
+       ucidef_add_switch "switch0" \
                "0@eth0" "1:lan" "2:lan" "3:wan"
        ;;
 
 ew-dorin-router)
        ucidef_set_interfaces_lan_wan "eth0" "eth1"
-       ucidef_add_switch "switch0" "1" "1"
-       ucidef_add_switch_ports "switch0" "0@eth0" "2:lan" "3:lan"
+       ucidef_add_switch "switch0" "0@eth0" "2:lan" "3:lan"
        ;;
 
 wndr3700)
        ucidef_set_interfaces_lan_wan "eth0" "eth1"
-       ucidef_add_switch "switch0" "1" "1"
-       ucidef_add_switch_ports "switch0" \
+       ucidef_add_switch "switch0" \
                "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
 
        # Blinkrate: 0=43ms; 1=84ms; 2=120ms; 3=170ms; 4=340ms; 5=670ms
index 338e71134c0c3fdf6edc98075ff823cafd0e6b9f..5abb0610df984dc02cf3f0e78f56d8265004de86 100755 (executable)
@@ -29,12 +29,11 @@ esac
 
 ucidef_set_interface_loopback
 ucidef_set_interfaces_lan_wan "$ifname.1" "$ifname.2"
-ucidef_add_switch "switch0" "1" "1"
 
 # Workaround for devices using CPU port 8 (connected to eth2)
 case "$board" in
 netgear,r8000)
-       ucidef_add_switch_ports "switch0" \
+       ucidef_add_switch "switch0" \
                "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "5t@$ifname"
        board_config_flush
        exit 0
@@ -50,18 +49,18 @@ vlan1ports="$(echo $(nvram get vlan1ports | tr " " "\n" | sort))"
 vlan2ports="$(echo $(nvram get vlan2ports | tr " " "\n" | sort))"
 if echo "$vlan1ports" | egrep -q "^1 2 3 4 5" && \
    echo "$vlan2ports" | egrep -q "^0 5"; then
-       ucidef_add_switch_ports "switch0" \
+       ucidef_add_switch "switch0" \
                "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5t@$ifname"
 elif echo "$vlan1ports" | egrep -q "^1 2 3 5 7" && \
      echo "$vlan2ports" | egrep -q "^0 7"; then
-       ucidef_add_switch_ports "switch0" \
+       ucidef_add_switch "switch0" \
                "1:lan" "2:lan" "3:lan" "5:lan" "0:wan" "7t@$ifname"
 elif echo "$vlan1ports" | egrep -q "^0 1 2 3 5 7 8" && \
      echo "$vlan2ports" | egrep -q "^4 8"; then
-       ucidef_add_switch_ports "switch0" \
+       ucidef_add_switch "switch0" \
                "0:lan" "1:lan" "2:lan" "3:lan" "5:lan" "7:lan" "4:wan" "8t@$ifname"
 else
-       ucidef_add_switch_ports "switch0" \
+       ucidef_add_switch "switch0" \
                "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "5t@$ifname"
 fi
 
index af2c1e05b2d063f9e5bd2a612c6aa9030b574dc6..5aab17c0a2f2bbf95408118b2ea654407b3d0e01 100755 (executable)
@@ -15,8 +15,7 @@ board=$(mpc85xx_board_name)
 case "$board" in
 tl-wdr4900-v1)
        ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
-       ucidef_add_switch "switch0" "1" "1"
-       ucidef_add_switch_ports "switch0" \
+       ucidef_add_switch "switch0" \
                "0@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "1:wan"
        ;;
 *)
index b07091d74fee4026537c5f2541eb5f5bf733ad47..20cc3f5ccf88a773c7a6f5adb3fb2e7fe3131722 100755 (executable)
@@ -24,8 +24,7 @@ armada-385-linksys-shelby)
        ;;
 armada-xp-linksys-mamba)
        ucidef_set_interfaces_lan_wan "eth0" "eth1"
-       ucidef_add_switch "switch0" "1" "1"
-       ucidef_add_switch_ports "switch0" \
+       ucidef_add_switch "switch0" \
                "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5@eth0" "4:wan" "6@eth1"
        ;;
 armada-385-db-ap)
index c8bdc77a69f17976f4143d1f24eb62502c63cad3..3cfb6bac6687c2c8bfc0dd0a797c75c2e37e3bd0 100755 (executable)
@@ -25,8 +25,7 @@ ramips_setup_rt3x5x_vlans()
                fi
        done
        ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
-       ucidef_add_switch "rt305x" "1" "1"
-       ucidef_add_switch_ports "rt305x" $lanports $wanports "6@eth0"
+       ucidef_add_switch "rt305x" $lanports $wanports "6@eth0"
 }
 
 ramips_setup_interfaces()
@@ -88,14 +87,12 @@ ramips_setup_interfaces()
        zbt-wg2626|\
        youku-yk1)
                ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
-               ucidef_add_switch "switch0" "1" "1"
-               ucidef_add_switch_ports "switch0" \
+               ucidef_add_switch "switch0" \
                        "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6@eth0"
                ;;
        a5-v11)
                ucidef_set_interface_lan "eth0.1"
-               ucidef_add_switch "switch0" "1" "1"
-               ucidef_add_switch_ports "switch0" \
+               ucidef_add_switch "switch0" \
                        "0:lan" "6t@eth0"
                ;;
        ar670w|\
@@ -103,16 +100,14 @@ ramips_setup_interfaces()
        rt-n15|\
        wl-351)
                ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
-               ucidef_add_switch "switch0" "1" "1"
-               ucidef_add_switch_ports "switch0" \
+               ucidef_add_switch "switch0" \
                        "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "5@eth0"
                ;;
        asl26555|\
        re6500|\
        rp-n53)
                ucidef_set_interface_lan "eth0.1"
-               ucidef_add_switch "switch0" "1" "1"
-               ucidef_add_switch_ports "switch0" \
+               ucidef_add_switch "switch0" \
                        "1:lan" "2:lan" "3:lan" "4:lan" "6t@eth0"
                ;;
        atp-52b|\
@@ -129,14 +124,12 @@ ramips_setup_interfaces()
        wt3020|\
        zbt-wa05)
                ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
-               ucidef_add_switch "switch0" "1" "1"
-               ucidef_add_switch_ports "switch0" \
+               ucidef_add_switch "switch0" \
                        "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "6@eth0"
                ;;
        awapn2403)
                ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
-               ucidef_add_switch "switch0" "1" "1"
-               ucidef_add_switch_ports "switch0" \
+               ucidef_add_switch "switch0" \
                        "0:lan" "1:wan" "6@eth0"
                ;;
        b2c|\
@@ -150,20 +143,17 @@ ramips_setup_interfaces()
                ;;
        br-6475nd)
                ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
-               ucidef_add_switch "switch0" "1" "1"
-               ucidef_add_switch_ports "switch0" \
+               ucidef_add_switch "switch0" \
                        "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9@eth0"
                ;;
        cf-wr800n)
                ucidef_set_interface_lan "eth0.1"
-               ucidef_add_switch "switch0" "1" "1"
-               ucidef_add_switch_ports "switch0" \
+               ucidef_add_switch "switch0" \
                        "4:lan" "6t@eth0"
                ;;
        cy-swr1100)
                ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
-               ucidef_add_switch "switch0" "1" "1"
-               ucidef_add_switch_ports "switch0" \
+               ucidef_add_switch "switch0" \
                        "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "9@eth0"
                ;;
        d105|\
@@ -175,15 +165,13 @@ ramips_setup_interfaces()
        e1700|\
        mt7620a_mt7530)
                ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
-               ucidef_add_switch "switch1" "1" "1"
-               ucidef_add_switch_ports "switch1" \
+               ucidef_add_switch "switch1" \
                        "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6@eth0"
                ;;
        hc5*61|\
        y1s)
                ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
-               ucidef_add_switch "switch0" "1" "1"
-               ucidef_add_switch_ports "switch0" \
+               ucidef_add_switch "switch0" \
                        "1:lan" "2:lan" "3:lan" "4:lan" "5:lan" "0:wan" "6@eth0"
                ;;
        m2m)
@@ -200,52 +188,44 @@ ramips_setup_interfaces()
        mzk-dp150n|\
        vocore)
                ucidef_set_interface_lan "eth0.1"
-               ucidef_add_switch "switch0" "1" "1"
-               ucidef_add_switch_ports "switch0" \
+               ucidef_add_switch "switch0" \
                        "0:lan" "4:lan" "6t@eth0"
                ;;
        rt-n56u)
                ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
-               ucidef_add_switch "switch0" "1" "1"
-               ucidef_add_switch_ports "switch0" \
+               ucidef_add_switch "switch0" \
                        "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "8@eth0"
                ;;
        tew-691gr|\
        tew-692gr)
                ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
-               ucidef_add_switch "switch0" "1" "1"
-               ucidef_add_switch_ports "switch0" \
+               ucidef_add_switch "switch0" \
                        "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "0@eth0"
                ;;
        v11st-fe|\
        wzr-agl300nh)
                ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
-               ucidef_add_switch "switch0" "1" "1"
-               ucidef_add_switch_ports "switch0" \
+               ucidef_add_switch "switch0" \
                        "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0"
                ;;
        wcr-150gn)
                ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
-               ucidef_add_switch "switch0" "1" "1"
-               ucidef_add_switch_ports "switch0" \
+               ucidef_add_switch "switch0" \
                        "0:lan" "6t@eth0"
                ;;
        whr-1166d)
                ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
-               ucidef_add_switch "switch0" "1" "1"
-               ucidef_add_switch_ports "switch0" \
+               ucidef_add_switch "switch0" \
                        "0:lan" "1:lan" "2:lan" "3:lan" "5:wan" "6@eth0"
                ;;
        wizfi630a)
                ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
-               ucidef_add_switch "switch0" "1" "1"
-               ucidef_add_switch_ports "switch0" \
+               ucidef_add_switch "switch0" \
                        "1:lan" "2:lan" "0:wan" "6@eth0"
                ;;
        zbt-wr8305rt)
                ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
-               ucidef_add_switch "switch0" "1" "1"
-               ucidef_add_switch_ports "switch0" \
+               ucidef_add_switch "switch0" \
                        "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6@eth0"
                ;;
        *)