board.d: merge ucidef_add_switch() and ucidef_add_switch_ports()

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
v19.07.3_mercusys_ac12_duma
Jo-Philipp Wich 9 years ago
parent d17a64c7c0
commit 9b02e73188

@ -82,35 +82,6 @@ ucidef_set_interfaces_lan_wan() {
json_select .. 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() { _ucidef_add_switch_port() {
# inherited: $num $device $need_tag $role $index $prev_role # inherited: $num $device $need_tag $role $index $prev_role
# inherited: $n_cpu $n_ports $n_vlan $cpu0 $cpu1 $cpu2 $cpu3 $cpu4 $cpu5 # inherited: $n_cpu $n_ports $n_vlan $cpu0 $cpu1 $cpu2 $cpu3 $cpu4 $cpu5
@ -205,50 +176,69 @@ _ucidef_finish_switch_roles() {
done done
} }
ucidef_add_switch_ports() { ucidef_add_switch() {
local name="$1"; shift local name="$1"; shift
local port num role device index need_tag prev_role local port num role device index need_tag prev_role
local cpu0 cpu1 cpu2 cpu3 cpu4 cpu5 local cpu0 cpu1 cpu2 cpu3 cpu4 cpu5
local n_cpu=0 n_vlan=0 n_ports=0 local n_cpu=0 n_vlan=0 n_ports=0
json_select_object switch json_select_object switch
json_select_object "$name" json_select_object "$name"
json_add_boolean enable 1
for port in "$@"; do json_add_boolean reset 1
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 for port in "$@"; do
done 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 .. json_select ..
_ucidef_finish_switch_roles _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() { ucidef_add_switch_port_attr() {
local name="$1" local name="$1"
local port="$2" local port="$2"

@ -25,24 +25,21 @@ ubnt-unifi-outdoor)
ap132 |\ ap132 |\
wlr8100) wlr8100)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "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"
;; ;;
esr1750 |\ esr1750 |\
epg5000) epg5000)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "switch0" \
"0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan" "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan"
;; ;;
ap136-010 |\ ap136-010 |\
ap147-010) ap147-010)
ucidef_set_interfaces_lan_wan "eth0" "eth1" ucidef_set_interfaces_lan_wan "eth0" "eth1"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "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"
;; ;;
@ -51,8 +48,7 @@ ap135-020 |\
tl-wr1043nd-v2 |\ tl-wr1043nd-v2 |\
wzr-450hp2) wzr-450hp2)
ucidef_set_interfaces_lan_wan "eth1" "eth0" ucidef_set_interfaces_lan_wan "eth1" "eth0"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "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"
;; ;;
@ -60,30 +56,26 @@ archer-c5 |\
archer-c7 |\ archer-c7 |\
tl-wdr4900-v2) tl-wdr4900-v2)
ucidef_set_interfaces_lan_wan "eth1" "eth0" ucidef_set_interfaces_lan_wan "eth1" "eth0"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "switch0" \
"0@eth1" "2:lan" "3:lan" "4:lan" "5:lan" "6@eth0" "1:wan" "0@eth1" "2:lan" "3:lan" "4:lan" "5:lan" "6@eth0" "1:wan"
;; ;;
bsb) bsb)
ucidef_set_interfaces_lan_wan "eth1" "eth0" ucidef_set_interfaces_lan_wan "eth1" "eth0"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "switch0" \
"0@eth1" "1:lan" "3:lan" # XXX: confirm cpu port! "0@eth1" "1:lan" "3:lan" # XXX: confirm cpu port!
ucidef_set_interface_wlan ucidef_set_interface_wlan
;; ;;
cpe510) cpe510)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "switch0" \
"0@eth0" "5:lan" "4:wan" "0@eth0" "5:lan" "4:wan"
;; ;;
airgatewaypro) airgatewaypro)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "switch0" \
"0@eth0" "4:lan" "5:wan" "0@eth0" "4:lan" "5:wan"
;; ;;
@ -94,52 +86,46 @@ rb-2011uias |\
rb-2011uas-2hnd|\ rb-2011uas-2hnd|\
rb-2011uias-2hnd) rb-2011uias-2hnd)
ucidef_set_interfaces_lan_wan "eth0.1 eth1" "eth0.2" ucidef_set_interfaces_lan_wan "eth0.1 eth1" "eth0.2"
ucidef_add_switch "switch0" "1" "1"
case "$board" in case "$board" in
rb-2011uas* | rb-2011uias | rb-2011uias-2hnd) 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" "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
;; ;;
esac esac
ucidef_add_switch "switch1" "1" "1" ucidef_add_switch "switch1" \
ucidef_add_switch_ports "switch1" \
"0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:lan" "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:lan"
;; ;;
dir-825-b1|\ dir-825-b1|\
tew-673gru) tew-673gru)
ucidef_set_interfaces_lan_wan "eth0" "eth1" ucidef_set_interfaces_lan_wan "eth0" "eth1"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "switch0" \
"0:lan" "1:lan" "2:lan" "3:lan" "5@eth0" "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
;; ;;
f9k1115v2) f9k1115v2)
ucidef_set_interfaces_lan_wan "eth1" "eth0" ucidef_set_interfaces_lan_wan "eth1" "eth0"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "switch0" \
"2:lan" "3:lan" "4:lan" "5:lan" "6@eth1" \ "2:lan" "3:lan" "4:lan" "5:lan" "6@eth1" \
"0@eth0" "1:wan" # XXX: confirm cpu ports! "0@eth0" "1:wan" # XXX: confirm cpu ports!
;; ;;
nbg460n_550n_550nh) nbg460n_550n_550nh)
ucidef_set_interfaces_lan_wan "eth0" "eth1" ucidef_set_interfaces_lan_wan "eth0" "eth1"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "switch0" \
"0:lan" "1:lan" "2:lan" "3:lan" "5@eth0" "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
;; ;;
nbg6616 |\ nbg6616 |\
nbg6716) nbg6716)
ucidef_set_interfaces_lan_wan "eth0" "eth1" ucidef_set_interfaces_lan_wan "eth0" "eth1"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "switch0" \
"0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" \ "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" \
"5:wan" "6@eth1" "5:wan" "6@eth1"
;; ;;
@ -148,30 +134,26 @@ ap143 |\
rb-433 |\ rb-433 |\
rb-433u) rb-433u)
ucidef_set_interfaces_lan_wan "eth1" "eth0" ucidef_set_interfaces_lan_wan "eth1" "eth0"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "switch0" \
"1:lan" "2:lan" "5@eth1" "1:lan" "2:lan" "5@eth1"
;; ;;
rb-435g) rb-435g)
ucidef_set_interfaces_lan_wan "eth1" "eth0" ucidef_set_interfaces_lan_wan "eth1" "eth0"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "switch0" \
"0@eth1" "1:lan" "2:lan" # XXX: confirm! "0@eth1" "1:lan" "2:lan" # XXX: confirm!
;; ;;
rb-450) rb-450)
ucidef_set_interfaces_lan_wan "eth1" "eth0" ucidef_set_interfaces_lan_wan "eth1" "eth0"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "switch0" \
"0:lan" "1:lan" "2:lan" "3:lan" "5@eth1" "0:lan" "1:lan" "2:lan" "3:lan" "5@eth1"
;; ;;
rb-450g |\ rb-450g |\
routerstation-pro) routerstation-pro)
ucidef_set_interfaces_lan_wan "eth1" "eth0" ucidef_set_interfaces_lan_wan "eth1" "eth0"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "switch0" \
"0@eth1" "2:lan:3" "3:lan:2" "4:lan:1" "0@eth1" "2:lan:3" "3:lan:2" "4:lan:1"
;; ;;
@ -181,8 +163,7 @@ rb-751g |\
rb-951g-2hnd |\ rb-951g-2hnd |\
wzr-hp-g450h) wzr-hp-g450h)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "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"
;; ;;
@ -192,11 +173,9 @@ rb-951ui-2hnd)
rb-493g) rb-493g)
ucidef_set_interfaces_lan_wan "eth0 eth1.1" "eth1.2" ucidef_set_interfaces_lan_wan "eth0 eth1.1" "eth1.2"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "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 "switch1" \
ucidef_add_switch_ports "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"
;; ;;
@ -204,37 +183,32 @@ wzr-hp-g300nh2 |\
pb92 |\ pb92 |\
ap113) ap113)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "switch0" \
"0@eth0" "1:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "2:wan" "0@eth0" "1:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "2:wan"
;; ;;
el-m150) el-m150)
ucidef_set_interfaces_lan_wan "eth1" "eth0" ucidef_set_interfaces_lan_wan "eth1" "eth0"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "switch0" \
"0:lan" "1:lan" "3@eth1" # XXX: confirm! "0:lan" "1:lan" "3@eth1" # XXX: confirm!
;; ;;
tl-wdr4300|\ tl-wdr4300|\
tl-wr1041n-v2) tl-wr1041n-v2)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "switch0" \
"0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan" "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan"
;; ;;
tl-wr1043nd) tl-wr1043nd)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "switch0" \
"1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0"
;; ;;
tl-wr2543n) tl-wr2543n)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "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"
;; ;;
@ -259,36 +233,31 @@ wnr2200 |\
wnr612-v2 |\ wnr612-v2 |\
wnr1000-v2) wnr1000-v2)
ucidef_set_interfaces_lan_wan "eth1" "eth0" ucidef_set_interfaces_lan_wan "eth1" "eth0"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "switch0" \
"0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth1" # XXX: confirm! "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth1" # XXX: confirm!
;; ;;
uap-pro) uap-pro)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "switch0" \
"0@eth0" "1:lan" "2:wan" "0@eth0" "1:lan" "2:wan"
;; ;;
nanostation-m-xw) nanostation-m-xw)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "switch0" \
"0@eth0" "5:lan" "1:wan" "0@eth0" "5:lan" "1:wan"
;; ;;
wrt160nl) wrt160nl)
ucidef_set_interfaces_lan_wan "eth0" "eth1" ucidef_set_interfaces_lan_wan "eth0" "eth1"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "switch0" \
"0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth0" "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4@eth0"
;; ;;
wzr-hp-g300nh) wzr-hp-g300nh)
ucidef_set_interfaces_lan_wan "eth0.1" "eth1" ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "switch0" \
"0:lan" "1:lan" "2:lan" "3:lan" "5@eth0" "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
;; ;;
@ -296,8 +265,7 @@ dgl-5500-a1 |\
dir-825-c1) dir-825-c1)
local mac local mac
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "switch0" \
"0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
mac=$(mtd_get_mac_ascii nvram "wan_mac") mac=$(mtd_get_mac_ascii nvram "wan_mac")
[ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac" [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
@ -306,8 +274,7 @@ dir-825-c1)
mynet-n750) mynet-n750)
local mac local mac
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "switch0" \
"0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
mac=$(mtd_get_mac_ascii devdata "wanmac") mac=$(mtd_get_mac_ascii devdata "wanmac")
[ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac" [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
@ -322,8 +289,7 @@ dir-835-a1 |\
wndr3700v4 | \ wndr3700v4 | \
wndr4300) wndr4300)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "switch0" \
"0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
mac_lan=$(mtd_get_mac_binary caldata 0) mac_lan=$(mtd_get_mac_binary caldata 0)
[ -n "$mac_lan" ] && ucidef_set_interface_macaddr "lan" "$mac_lan" [ -n "$mac_lan" ] && ucidef_set_interface_macaddr "lan" "$mac_lan"
@ -334,8 +300,7 @@ wndr4300)
esr900) esr900)
local mac local mac
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "switch0" \
"0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
mac=$(mtd_get_mac_ascii u-boot-env "wanaddr") mac=$(mtd_get_mac_ascii u-boot-env "wanaddr")
[ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac" [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
@ -425,15 +390,13 @@ wpe72)
gl-ar300) gl-ar300)
ucidef_set_interfaces_lan_wan "eth1" "eth0" ucidef_set_interfaces_lan_wan "eth1" "eth0"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "switch0" \
"0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan"
;; ;;
wpj344) wpj344)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "switch0" \
"0@eth0" "3:lan" "2:wan" "0@eth0" "3:lan" "2:wan"
;; ;;
@ -443,8 +406,7 @@ wpj531)
wpj558) wpj558)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "switch0" \
"5:lan" "1:wan" "6@eth0" "5:lan" "1:wan" "6@eth0"
;; ;;
@ -482,35 +444,30 @@ whr-hp-g300n |\
whr-hp-gn |\ whr-hp-gn |\
wzr-hp-ag300h) wzr-hp-ag300h)
ucidef_set_interfaces_lan_wan "eth0" "eth1" ucidef_set_interfaces_lan_wan "eth0" "eth1"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "switch0" \
"0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
;; ;;
wzr-hp-g450h) wzr-hp-g450h)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "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"
;; ;;
ew-dorin) ew-dorin)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "switch0" \
"0@eth0" "1:lan" "2:lan" "3:wan" "0@eth0" "1:lan" "2:lan" "3:wan"
;; ;;
ew-dorin-router) ew-dorin-router)
ucidef_set_interfaces_lan_wan "eth0" "eth1" ucidef_set_interfaces_lan_wan "eth0" "eth1"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" "0@eth0" "2:lan" "3:lan"
ucidef_add_switch_ports "switch0" "0@eth0" "2:lan" "3:lan"
;; ;;
wndr3700) wndr3700)
ucidef_set_interfaces_lan_wan "eth0" "eth1" ucidef_set_interfaces_lan_wan "eth0" "eth1"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "switch0" \
"0:lan" "1:lan" "2:lan" "3:lan" "5@eth0" "0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
# Blinkrate: 0=43ms; 1=84ms; 2=120ms; 3=170ms; 4=340ms; 5=670ms # Blinkrate: 0=43ms; 1=84ms; 2=120ms; 3=170ms; 4=340ms; 5=670ms

@ -29,12 +29,11 @@ esac
ucidef_set_interface_loopback ucidef_set_interface_loopback
ucidef_set_interfaces_lan_wan "$ifname.1" "$ifname.2" 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) # Workaround for devices using CPU port 8 (connected to eth2)
case "$board" in case "$board" in
netgear,r8000) netgear,r8000)
ucidef_add_switch_ports "switch0" \ ucidef_add_switch "switch0" \
"0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "5t@$ifname" "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "5t@$ifname"
board_config_flush board_config_flush
exit 0 exit 0
@ -50,18 +49,18 @@ vlan1ports="$(echo $(nvram get vlan1ports | tr " " "\n" | sort))"
vlan2ports="$(echo $(nvram get vlan2ports | tr " " "\n" | sort))" vlan2ports="$(echo $(nvram get vlan2ports | tr " " "\n" | sort))"
if echo "$vlan1ports" | egrep -q "^1 2 3 4 5" && \ if echo "$vlan1ports" | egrep -q "^1 2 3 4 5" && \
echo "$vlan2ports" | egrep -q "^0 5"; then 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" "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5t@$ifname"
elif echo "$vlan1ports" | egrep -q "^1 2 3 5 7" && \ elif echo "$vlan1ports" | egrep -q "^1 2 3 5 7" && \
echo "$vlan2ports" | egrep -q "^0 7"; then 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" "1:lan" "2:lan" "3:lan" "5:lan" "0:wan" "7t@$ifname"
elif echo "$vlan1ports" | egrep -q "^0 1 2 3 5 7 8" && \ elif echo "$vlan1ports" | egrep -q "^0 1 2 3 5 7 8" && \
echo "$vlan2ports" | egrep -q "^4 8"; then 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" "0:lan" "1:lan" "2:lan" "3:lan" "5:lan" "7:lan" "4:wan" "8t@$ifname"
else else
ucidef_add_switch_ports "switch0" \ ucidef_add_switch "switch0" \
"0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "5t@$ifname" "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "5t@$ifname"
fi fi

@ -15,8 +15,7 @@ board=$(mpc85xx_board_name)
case "$board" in case "$board" in
tl-wdr4900-v1) tl-wdr4900-v1)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "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"
;; ;;
*) *)

@ -24,8 +24,7 @@ armada-385-linksys-shelby)
;; ;;
armada-xp-linksys-mamba) armada-xp-linksys-mamba)
ucidef_set_interfaces_lan_wan "eth0" "eth1" ucidef_set_interfaces_lan_wan "eth0" "eth1"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "switch0" \
"0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5@eth0" "4:wan" "6@eth1" "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5@eth0" "4:wan" "6@eth1"
;; ;;
armada-385-db-ap) armada-385-db-ap)

@ -25,8 +25,7 @@ ramips_setup_rt3x5x_vlans()
fi fi
done done
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "rt305x" "1" "1" ucidef_add_switch "rt305x" $lanports $wanports "6@eth0"
ucidef_add_switch_ports "rt305x" $lanports $wanports "6@eth0"
} }
ramips_setup_interfaces() ramips_setup_interfaces()
@ -88,14 +87,12 @@ ramips_setup_interfaces()
zbt-wg2626|\ zbt-wg2626|\
youku-yk1) youku-yk1)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "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"
;; ;;
a5-v11) a5-v11)
ucidef_set_interface_lan "eth0.1" ucidef_set_interface_lan "eth0.1"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "switch0" \
"0:lan" "6t@eth0" "0:lan" "6t@eth0"
;; ;;
ar670w|\ ar670w|\
@ -103,16 +100,14 @@ ramips_setup_interfaces()
rt-n15|\ rt-n15|\
wl-351) wl-351)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "switch0" \
"0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "5@eth0" "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "5@eth0"
;; ;;
asl26555|\ asl26555|\
re6500|\ re6500|\
rp-n53) rp-n53)
ucidef_set_interface_lan "eth0.1" ucidef_set_interface_lan "eth0.1"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "switch0" \
"1:lan" "2:lan" "3:lan" "4:lan" "6t@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "6t@eth0"
;; ;;
atp-52b|\ atp-52b|\
@ -129,14 +124,12 @@ ramips_setup_interfaces()
wt3020|\ wt3020|\
zbt-wa05) zbt-wa05)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "switch0" \
"1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "6@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "6@eth0"
;; ;;
awapn2403) awapn2403)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "switch0" \
"0:lan" "1:wan" "6@eth0" "0:lan" "1:wan" "6@eth0"
;; ;;
b2c|\ b2c|\
@ -150,20 +143,17 @@ ramips_setup_interfaces()
;; ;;
br-6475nd) br-6475nd)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "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"
;; ;;
cf-wr800n) cf-wr800n)
ucidef_set_interface_lan "eth0.1" ucidef_set_interface_lan "eth0.1"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "switch0" \
"4:lan" "6t@eth0" "4:lan" "6t@eth0"
;; ;;
cy-swr1100) cy-swr1100)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "switch0" \
"0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "9@eth0" "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "9@eth0"
;; ;;
d105|\ d105|\
@ -175,15 +165,13 @@ ramips_setup_interfaces()
e1700|\ e1700|\
mt7620a_mt7530) mt7620a_mt7530)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch1" "1" "1" ucidef_add_switch "switch1" \
ucidef_add_switch_ports "switch1" \
"0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6@eth0" "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6@eth0"
;; ;;
hc5*61|\ hc5*61|\
y1s) y1s)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "switch0" \
"1:lan" "2:lan" "3:lan" "4:lan" "5:lan" "0:wan" "6@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:lan" "0:wan" "6@eth0"
;; ;;
m2m) m2m)
@ -200,52 +188,44 @@ ramips_setup_interfaces()
mzk-dp150n|\ mzk-dp150n|\
vocore) vocore)
ucidef_set_interface_lan "eth0.1" ucidef_set_interface_lan "eth0.1"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "switch0" \
"0:lan" "4:lan" "6t@eth0" "0:lan" "4:lan" "6t@eth0"
;; ;;
rt-n56u) rt-n56u)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "switch0" \
"0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "8@eth0" "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "8@eth0"
;; ;;
tew-691gr|\ tew-691gr|\
tew-692gr) tew-692gr)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "switch0" \
"1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "0@eth0"
;; ;;
v11st-fe|\ v11st-fe|\
wzr-agl300nh) wzr-agl300nh)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "switch0" \
"1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0"
;; ;;
wcr-150gn) wcr-150gn)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "switch0" \
"0:lan" "6t@eth0" "0:lan" "6t@eth0"
;; ;;
whr-1166d) whr-1166d)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "switch0" \
"0:lan" "1:lan" "2:lan" "3:lan" "5:wan" "6@eth0" "0:lan" "1:lan" "2:lan" "3:lan" "5:wan" "6@eth0"
;; ;;
wizfi630a) wizfi630a)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "switch0" \
"1:lan" "2:lan" "0:wan" "6@eth0" "1:lan" "2:lan" "0:wan" "6@eth0"
;; ;;
zbt-wr8305rt) zbt-wr8305rt)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1" ucidef_add_switch "switch0" \
ucidef_add_switch_ports "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"
;; ;;
*) *)

Loading…
Cancel
Save