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
-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
_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
-ucidef_add_switch_ports() {
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
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
+ unset num device role index need_tag
+ done
+ json_select ..
json_select ..
_ucidef_finish_switch_roles
}
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"
ucidef_add_switch_port_attr() {
local name="$1"
local port="$2"
ap132 |\
wlr8100)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
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"
"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"
"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"
;;
"0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "6@eth1"
;;
tl-wr1043nd-v2 |\
wzr-450hp2)
ucidef_set_interfaces_lan_wan "eth1" "eth0"
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"
;;
"0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan" "6@eth0"
;;
archer-c7 |\
tl-wdr4900-v2)
ucidef_set_interfaces_lan_wan "eth1" "eth0"
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"
"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"
"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"
"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"
;;
"0@eth0" "4:lan" "5:wan"
;;
rb-2011uas-2hnd|\
rb-2011uias-2hnd)
ucidef_set_interfaces_lan_wan "eth0.1 eth1" "eth0.2"
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)
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"
;;
*)
"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
"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"
"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"
"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"
"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"
"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"
;;
"0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" \
"5:wan" "6@eth1"
;;
rb-433 |\
rb-433u)
ucidef_set_interfaces_lan_wan "eth1" "eth0"
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"
"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"
"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"
"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"
;;
"0@eth1" "2:lan:3" "3:lan:2" "4:lan:1"
;;
rb-951g-2hnd |\
wzr-hp-g450h)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
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"
;;
"0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
;;
rb-493g)
ucidef_set_interfaces_lan_wan "eth0 eth1.1" "eth1.2"
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"
"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"
;;
"0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
;;
pb92 |\
ap113)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
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"
"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"
"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"
"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"
"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"
;;
"1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9@eth0"
;;
wnr612-v2 |\
wnr1000-v2)
ucidef_set_interfaces_lan_wan "eth1" "eth0"
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"
"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"
"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"
"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"
"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"
;;
"0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
;;
dir-825-c1)
local mac
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
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"
"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"
mynet-n750)
local mac
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
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"
"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"
wndr3700v4 | \
wndr4300)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
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"
"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"
esr900)
local mac
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
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"
"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"
gl-ar300)
ucidef_set_interfaces_lan_wan "eth1" "eth0"
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"
"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"
;;
"0@eth0" "3:lan" "2:wan"
;;
wpj558)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
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"
;;
"5:lan" "1:wan" "6@eth0"
;;
whr-hp-gn |\
wzr-hp-ag300h)
ucidef_set_interfaces_lan_wan "eth0" "eth1"
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"
"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"
"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"
"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"
;;
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
"0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
# Blinkrate: 0=43ms; 1=84ms; 2=120ms; 3=170ms; 4=340ms; 5=670ms
ucidef_set_interface_loopback
ucidef_set_interfaces_lan_wan "$ifname.1" "$ifname.2"
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)
# 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
"0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "5t@$ifname"
board_config_flush
exit 0
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
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
"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
"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
"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
"0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "5t@$ifname"
fi
case "$board" in
tl-wdr4900-v1)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
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"
;;
*)
"0@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "1:wan"
;;
*)
;;
armada-xp-linksys-mamba)
ucidef_set_interfaces_lan_wan "eth0" "eth1"
;;
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)
"0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5@eth0" "4:wan" "6@eth1"
;;
armada-385-db-ap)
fi
done
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
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()
}
ramips_setup_interfaces()
zbt-wg2626|\
youku-yk1)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
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"
"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|\
"0:lan" "6t@eth0"
;;
ar670w|\
rt-n15|\
wl-351)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
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"
"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|\
"1:lan" "2:lan" "3:lan" "4:lan" "6t@eth0"
;;
atp-52b|\
wt3020|\
zbt-wa05)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
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"
"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|\
"0:lan" "1:wan" "6@eth0"
;;
b2c|\
;;
br-6475nd)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
;;
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"
"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"
"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|\
"0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "9@eth0"
;;
d105|\
e1700|\
mt7620a_mt7530)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
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"
"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)
"1:lan" "2:lan" "3:lan" "4:lan" "5:lan" "0:wan" "6@eth0"
;;
m2m)
mzk-dp150n|\
vocore)
ucidef_set_interface_lan "eth0.1"
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"
"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"
"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"
"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"
"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"
"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"
"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"
"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"
;;
*)
"0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6@eth0"
;;
*)