ramips: remove default switch setup in 02_network

ramips images now relies on explicit switch setup for proper failsafe
functionality. Remove default cases where it relies on vlan setup in
dts and add switch setup for devices affected.

Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
This commit is contained in:
Chuanhong Guo 2020-04-29 07:23:34 +08:00
parent 597df570f3
commit a43cbfe2e3
5 changed files with 95 additions and 93 deletions

View File

@ -16,11 +16,15 @@ ramips_setup_interfaces()
dlink,dwr-116-a1|\ dlink,dwr-116-a1|\
dlink,dwr-921-c1|\ dlink,dwr-921-c1|\
dlink,dwr-922-e2|\ dlink,dwr-922-e2|\
dovado,tiny-ac|\
ohyeah,oy-0001|\ ohyeah,oy-0001|\
phicomm,psg1208|\ phicomm,psg1208|\
phicomm,psg1218a|\ phicomm,psg1218a|\
planex,db-wrt01|\ planex,db-wrt01|\
planex,mzk-750dhp|\ planex,mzk-750dhp|\
ralink,mt7620a-evb|\
ralink,mt7620a-mt7610e-evb|\
ralink,mt7620a-v22sg-evb|\
sanlinking,d240|\ sanlinking,d240|\
youku,yk1|\ youku,yk1|\
zbtlink,zbt-ape522ii|\ zbtlink,zbt-ape522ii|\
@ -71,18 +75,17 @@ ramips_setup_interfaces()
"1:lan" "2:lan" "3:lan" "4:lan" "6t@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "6t@eth0"
;; ;;
asus,rt-ac51u|\ asus,rt-ac51u|\
asus,rt-ac54u) asus,rt-ac54u|\
ucidef_add_switch "switch0" \
"0:wan" "1:lan" "2:lan" "3:lan" "4:lan" "6t@eth0"
;;
asus,rt-n14u|\ asus,rt-n14u|\
bdcom,wap2100-sk|\ bdcom,wap2100-sk|\
edimax,ew-7478apc|\
glinet,gl-mt300a|\ glinet,gl-mt300a|\
glinet,gl-mt300n|\ glinet,gl-mt300n|\
glinet,gl-mt750|\ glinet,gl-mt750|\
hiwifi,hc5661|\ hiwifi,hc5661|\
wrtnode,wrtnode|\ wrtnode,wrtnode|\
zbtlink,zbt-wa05) zbtlink,zbt-wa05|\
zyxel,keenetic-omni-ii)
ucidef_add_switch "switch0" \ ucidef_add_switch "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"
;; ;;
@ -213,17 +216,10 @@ ramips_setup_interfaces()
ucidef_add_switch "switch0" \ ucidef_add_switch "switch0" \
"0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4:wan:5" "6@eth0" "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4:wan:5" "6@eth0"
;; ;;
zyxel,keenetic-omni-ii)
ucidef_add_switch "switch0" \
"0:wan" "1:lan" "2:lan" "3:lan" "4:lan" "6@eth0"
;;
zyxel,keenetic-viva) zyxel,keenetic-viva)
ucidef_add_switch "switch1" \ ucidef_add_switch "switch1" \
"0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "7t@eth0" "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "7t@eth0"
;; ;;
*)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
;;
esac esac
} }

View File

@ -122,9 +122,6 @@ ramips_setup_interfaces()
ucidef_add_switch "switch0" \ ucidef_add_switch "switch0" \
"0:lan:2" "1:lan:1" "4:wan" "6@eth0" "0:lan:2" "1:lan:1" "4:wan" "6@eth0"
;; ;;
*)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
;;
esac esac
} }

View File

@ -28,9 +28,6 @@ ramips_setup_interfaces()
dlink,dap-1522-a1) dlink,dap-1522-a1)
ucidef_set_interface_lan "eth0" ucidef_set_interface_lan "eth0"
;; ;;
*)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
;;
esac esac
} }

View File

@ -4,47 +4,22 @@
. /lib/functions/uci-defaults.sh . /lib/functions/uci-defaults.sh
. /lib/functions/system.sh . /lib/functions/system.sh
ramips_setup_rt3x5x_vlans()
{
if [ ! -x /sbin/swconfig ]; then
# legacy default
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
return
fi
local wanports=""
local lanports=""
for port in 5 4 3 2 1 0; do
if [ "$(swconfig dev rt305x port $port get disable)" = "1" ]; then
continue
fi
if [ "$(swconfig dev rt305x port $port get lan)" = "0" ]; then
wanports="$port:wan $wanports"
else
lanports="$port:lan $lanports"
fi
done
ucidef_add_switch "rt305x" $lanports $wanports "6t@eth0"
}
ramips_setup_interfaces() ramips_setup_interfaces()
{ {
local board="$1" local board="$1"
case $board in case $board in
accton,wr6202|\ 7links,px-4885-4m|\
alfa-network,w502u|\ 7links,px-4885-8m|\
netcore,nw718|\
petatel,psr-680w|\
skyline,sl-r7205|\
upvel,ur-336un)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
;;
allnet,all0256n-4m|\ allnet,all0256n-4m|\
allnet,all0256n-8m|\ allnet,all0256n-8m|\
allnet,all5002|\ allnet,all5002|\
allnet,all5003|\ allnet,all5003|\
belkin,f7c027|\
dlink,dcs-930l-b1|\ dlink,dcs-930l-b1|\
dlink,dcs-930|\ dlink,dcs-930|\
edimax,3g-6200nl|\
hame,mpr-a1|\
hame,mpr-a2|\ hame,mpr-a2|\
hauppauge,broadway|\ hauppauge,broadway|\
hootoo,ht-tm02|\ hootoo,ht-tm02|\
@ -54,6 +29,7 @@ ramips_setup_interfaces()
tenda,3g150b|\ tenda,3g150b|\
tenda,3g300m|\ tenda,3g300m|\
tenda,w150m|\ tenda,w150m|\
trendnet,tew-714tru|\
unbranded,a5-v11|\ unbranded,a5-v11|\
wansview,ncs601w|\ wansview,ncs601w|\
zorlik,zl5900v2) zorlik,zl5900v2)
@ -61,51 +37,102 @@ ramips_setup_interfaces()
ucidef_add_switch_attr "switch0" "enable" "false" ucidef_add_switch_attr "switch0" "enable" "false"
ucidef_set_interface_lan "eth0" ucidef_set_interface_lan "eth0"
;; ;;
8devices,carambola)
ucidef_add_switch "switch0" \
"0:lan" "1:lan" "6@eth0"
;;
accton,wr6202|\
alfa-network,w502u|\
argus,atp-52b|\
asiarf,awm002-evb-4m|\
asiarf,awm002-evb-8m|\
asus,rt-n10-plus|\
asus,wl-330n|\
asus,wl-330n3g|\
aztech,hw550-3g|\
engenius,esr-9753|\
jcg,jhr-n805r|\
jcg,jhr-n825r|\
jcg,jhr-n926r|\
petatel,psr-680w|\
planex,mzk-wdpr|\
skyline,sl-r7205|\
teltonika,rut5xx|\
tenda,w306r-v2|\
unbranded,xdx-rn502j|\
upvel,ur-326n4g)
ucidef_add_switch "switch0" \
"1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "6@eth0"
;;
airlive,air3gii|\
asus,rt-g32-b1|\
asus,rt-n13u|\
aximcom,mr-102n|\
buffalo,whr-g300n|\
dlink,dap-1350|\
dlink,dir-300-b1|\
dlink,dir-300-b7|\
dlink,dir-320-b1|\
dlink,dir-600-b1|\
dlink,dir-610-a1|\
dlink,dir-615-d|\
dlink,dir-620-a1|\
dlink,dir-620-d1|\
dlink,dwr-512-b|\
easyacc,wizard-8800|\
edimax,3g-6200n|\
fon,fonera-20n|\
hilink,hlk-rm04|\
mofinetwork,mofi3500-3gn|\
netcore,nw718|\
nexaira,bc2|\
nixcore,x1-16m|\
nixcore,x1-8m|\
olimex,rt5350f-olinuxino|\
olimex,rt5350f-olinuxino-evb|\
omnima,miniembplug|\
omnima,miniembwifi|\
planex,mzk-w300nh2|\
poray,ip2202|\
poray,m3|\
poray,m4-4m|\
poray,m4-8m|\
poray,x5|\
poray,x8|\
prolink,pwh2004|\
ralink,v22rw-2x2|\
unbranded,wr512-3gn-4m|\
unbranded,wr512-3gn-8m|\
upvel,ur-336un|\
zyxel,keenetic|\
zyxel,nbg-419n|\
zyxel,nbg-419n-v2)
ucidef_add_switch "switch0" \
"0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6@eth0"
;;
alphanetworks,asl26555-8m|\ alphanetworks,asl26555-8m|\
alphanetworks,asl26555-16m) alphanetworks,asl26555-16m)
ucidef_add_switch "switch0" \ ucidef_add_switch "switch0" \
"1:lan" "2:lan" "3:lan" "4:lan" "6t@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "6t@eth0"
;; ;;
argus,atp-52b|\ arcwireless,freestation5)
asiarf,awm002-evb-4m|\ # FIXME: Which is the actual wan port?
asiarf,awm002-evb-8m|\
jcg,jhr-n805r|\
jcg,jhr-n825r|\
jcg,jhr-n926r|\
planex,mzk-wdpr|\
upvel,ur-326n4g)
ucidef_add_switch "switch0" \ ucidef_add_switch "switch0" \
"1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "6@eth0" "0:lan" "1:wan" "2:wan" "3:wan" "4:wan" "6@eth0"
;; ;;
asiarf,awapn2403) asiarf,awapn2403)
ucidef_add_switch "switch0" \ ucidef_add_switch "switch0" \
"0:lan" "1:wan" "6@eth0" "0:lan" "1:wan" "6@eth0"
;; ;;
asus,wl-330n|\ aximcom,mr-102n|\
easyacc,wizard-8800) trendnet,tew-638apb-v2)
ucidef_set_interface_lan "eth0.1" ucidef_add_switch "switch0" \
"4:lan" "6@eth0"
;; ;;
aximcom,mr-102n) belkin,f5d8235-v2)
ucidef_set_interface_lan "eth0.2"
;;
belkin,f5d8235-v2|\
trendnet,tew-714tru)
ucidef_add_switch "switch0" \ ucidef_add_switch "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"
;; ;;
buffalo,whr-g300n|\
dlink,dir-300-b7|\
dlink,dir-320-b1|\
dlink,dir-610-a1|\
edimax,3g-6200n|\
hilink,hlk-rm04|\
nixcore,x1-16m|\
nixcore,x1-8m|\
planex,mzk-w300nh2|\
zyxel,keenetic)
ucidef_add_switch "switch0" \
"0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6@eth0"
;;
dlink,dir-615-h1) dlink,dir-615-h1)
ucidef_add_switch "switch0" \ ucidef_add_switch "switch0" \
"0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4:wan:5" "6@eth0" "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4:wan:5" "6@eth0"
@ -133,10 +160,6 @@ ramips_setup_interfaces()
ucidef_add_switch "switch0" \ ucidef_add_switch "switch0" \
"0:lan" "6t@eth0" "0:lan" "6t@eth0"
;; ;;
trendnet,tew-638apb-v2)
ucidef_add_switch "switch0" \
"4:lan" "6@eth0"
;;
wiznet,wizfi630a) wiznet,wizfi630a)
ucidef_add_switch "switch0" \ ucidef_add_switch "switch0" \
"0:lan" "1:lan" "2:wan" "6@eth0" "0:lan" "1:lan" "2:wan" "6@eth0"
@ -145,14 +168,6 @@ ramips_setup_interfaces()
ucidef_add_switch "switch0" \ ucidef_add_switch "switch0" \
"0:lan:3" "1:lan:2" "2:lan:1" "3:lan:0" "4:wan" "6@eth0" "0:lan:3" "1:lan:2" "2:lan:1" "3:lan:0" "4:wan" "6@eth0"
;; ;;
*)
RT3X5X=$(grep -E "(RT3.5|RT5350)" /proc/cpuinfo)
if [ -n "${RT3X5X}" ]; then
ramips_setup_rt3x5x_vlans
else
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
fi
;;
esac esac
} }

View File

@ -39,9 +39,6 @@ ramips_setup_interfaces()
ucidef_add_switch "switch0" \ ucidef_add_switch "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"
;; ;;
*)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
;;
esac esac
} }