[OpenWrt-Devel] [PATCH] ramips: remove default switch setup in 02_network

Chuanhong Guo gch981213 at gmail.com
Tue Apr 28 19:49:48 EDT 2020


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 at gmail.com>
---
 .../mt7620/base-files/etc/board.d/02_network  |  20 +--
 .../mt76x8/base-files/etc/board.d/02_network  |   3 -
 .../rt288x/base-files/etc/board.d/02_network  |   3 -
 .../rt305x/base-files/etc/board.d/02_network  | 139 ++++++++++--------
 .../rt3883/base-files/etc/board.d/02_network  |   3 -
 5 files changed, 85 insertions(+), 83 deletions(-)

diff --git a/target/linux/ramips/mt7620/base-files/etc/board.d/02_network b/target/linux/ramips/mt7620/base-files/etc/board.d/02_network
index 8ae50b3df5..fe78bcd252 100755
--- a/target/linux/ramips/mt7620/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/mt7620/base-files/etc/board.d/02_network
@@ -16,11 +16,15 @@ ramips_setup_interfaces()
 	dlink,dwr-116-a1|\
 	dlink,dwr-921-c1|\
 	dlink,dwr-922-e2|\
+	dovado,tiny-ac|\
 	ohyeah,oy-0001|\
 	phicomm,psg1208|\
 	phicomm,psg1218a|\
 	planex,db-wrt01|\
 	planex,mzk-750dhp|\
+	ralink,mt7620a-evb|\
+	ralink,mt7620a-mt7610e-evb|\
+	ralink,mt7620a-v22sg-evb|\
 	sanlinking,d240|\
 	youku,yk1|\
 	zbtlink,zbt-ape522ii|\
@@ -70,18 +74,17 @@ ramips_setup_interfaces()
 		ucidef_add_switch "switch0" \
 			"1:lan" "2:lan" "3:lan" "4:lan" "6t at eth0"
 		;;
-	asus,rt-ac51u)
-		ucidef_add_switch "switch0" \
-			"0:wan" "1:lan" "2:lan" "3:lan" "4:lan" "6t at eth0"
-		;;
+	asus,rt-ac51u|\
 	asus,rt-n14u|\
 	bdcom,wap2100-sk|\
+	edimax,ew-7478apc|\
 	glinet,gl-mt300a|\
 	glinet,gl-mt300n|\
 	glinet,gl-mt750|\
 	hiwifi,hc5661|\
 	wrtnode,wrtnode|\
-	zbtlink,zbt-wa05)
+	zbtlink,zbt-wa05|\
+	zyxel,keenetic-omni-ii)
 		ucidef_add_switch "switch0" \
 			"1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "6 at eth0"
 		;;
@@ -210,17 +213,10 @@ ramips_setup_interfaces()
 		ucidef_add_switch "switch0" \
 			"0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4:wan:5" "6 at eth0"
 		;;
-	zyxel,keenetic-omni-ii)
-		ucidef_add_switch "switch0" \
-			"0:wan" "1:lan" "2:lan" "3:lan" "4:lan" "6 at eth0"
-		;;
 	zyxel,keenetic-viva)
 		ucidef_add_switch "switch1" \
 			"0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "7t at eth0"
 		;;
-	*)
-		ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
-		;;
 	esac
 }
 
diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network
index a6543fd38f..d758fe5543 100755
--- a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network
@@ -122,9 +122,6 @@ ramips_setup_interfaces()
 		ucidef_add_switch "switch0" \
 			"0:lan:2" "1:lan:1" "4:wan" "6 at eth0"
 		;;
-	*)
-		ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
-		;;
 	esac
 }
 
diff --git a/target/linux/ramips/rt288x/base-files/etc/board.d/02_network b/target/linux/ramips/rt288x/base-files/etc/board.d/02_network
index 0cc0e0b28b..134ac879cd 100755
--- a/target/linux/ramips/rt288x/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/rt288x/base-files/etc/board.d/02_network
@@ -28,9 +28,6 @@ ramips_setup_interfaces()
 	dlink,dap-1522-a1)
 		ucidef_set_interface_lan "eth0"
 		;;
-	*)
-		ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
-		;;
 	esac
 }
 
diff --git a/target/linux/ramips/rt305x/base-files/etc/board.d/02_network b/target/linux/ramips/rt305x/base-files/etc/board.d/02_network
index 5f18aa98f5..ae456077fa 100755
--- a/target/linux/ramips/rt305x/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/rt305x/base-files/etc/board.d/02_network
@@ -4,47 +4,22 @@
 . /lib/functions/uci-defaults.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 at eth0"
-}
-
 ramips_setup_interfaces()
 {
 	local board="$1"
 
 	case $board in
-	accton,wr6202|\
-	alfa-network,w502u|\
-	netcore,nw718|\
-	petatel,psr-680w|\
-	skyline,sl-r7205|\
-	upvel,ur-336un)
-		ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
-		;;
+	7links,px-4885-4m|\
+	7links,px-4885-8m|\
 	allnet,all0256n-4m|\
 	allnet,all0256n-8m|\
 	allnet,all5002|\
 	allnet,all5003|\
+	belkin,f7c027|\
 	dlink,dcs-930l-b1|\
 	dlink,dcs-930|\
+	edimax,3g-6200nl|\
+	hame,mpr-a1|\
 	hame,mpr-a2|\
 	hauppauge,broadway|\
 	hootoo,ht-tm02|\
@@ -54,6 +29,7 @@ ramips_setup_interfaces()
 	tenda,3g150b|\
 	tenda,3g300m|\
 	tenda,w150m|\
+	trendnet,tew-714tru|\
 	unbranded,a5-v11|\
 	wansview,ncs601w|\
 	zorlik,zl5900v2)
@@ -61,51 +37,102 @@ ramips_setup_interfaces()
 		ucidef_add_switch_attr "switch0" "enable" "false"
 		ucidef_set_interface_lan "eth0"
 		;;
-	alphanetworks,asl26555-8m|\
-	alphanetworks,asl26555-16m)
+	8devices,carambola)
 		ucidef_add_switch "switch0" \
-			"1:lan" "2:lan" "3:lan" "4:lan" "6t at eth0"
+			"0:lan" "1:lan" "6 at 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 at eth0"
 		;;
-	asiarf,awapn2403)
-		ucidef_add_switch "switch0" \
-			"0:lan" "1:wan" "6 at eth0"
-		;;
-	asus,wl-330n|\
-	easyacc,wizard-8800)
-		ucidef_set_interface_lan "eth0.1"
-		;;
-	aximcom,mr-102n)
-		ucidef_set_interface_lan "eth0.2"
-		;;
-	belkin,f5d8235-v2|\
-	trendnet,tew-714tru)
-		ucidef_add_switch "switch0" \
-			"1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5 at 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|\
-	zyxel,keenetic)
+	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 at eth0"
 		;;
+	alphanetworks,asl26555-8m|\
+	alphanetworks,asl26555-16m)
+		ucidef_add_switch "switch0" \
+			"1:lan" "2:lan" "3:lan" "4:lan" "6t at eth0"
+		;;
+	arcwireless,freestation5)
+		# FIXME: Which is the actual wan port?
+		ucidef_add_switch "switch0" \
+			"0:lan" "1:wan" "2:wan" "3:wan" "4:wan" "6 at eth0"
+		;;
+	asiarf,awapn2403)
+		ucidef_add_switch "switch0" \
+			"0:lan" "1:wan" "6 at eth0"
+		;;
+	aximcom,mr-102n|\
+	trendnet,tew-638apb-v2)
+		ucidef_add_switch "switch0" \
+			"4:lan" "6 at eth0"
+		;;
+	belkin,f5d8235-v2)
+		ucidef_add_switch "switch0" \
+			"1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5 at eth0"
+		;;
 	dlink,dir-615-h1)
 		ucidef_add_switch "switch0" \
 			"0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4:wan:5" "6 at eth0"
@@ -133,10 +160,6 @@ ramips_setup_interfaces()
 		ucidef_add_switch "switch0" \
 			"0:lan" "6t at eth0"
 		;;
-	trendnet,tew-638apb-v2)
-		ucidef_add_switch "switch0" \
-			"4:lan" "6 at eth0"
-		;;
 	wiznet,wizfi630a)
 		ucidef_add_switch "switch0" \
 			"0:lan" "1:lan" "2:wan" "6 at eth0"
@@ -145,14 +168,6 @@ ramips_setup_interfaces()
 		ucidef_add_switch "switch0" \
 			"0:lan:3" "1:lan:2" "2:lan:1" "3:lan:0" "4:wan" "6 at 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
 }
 
diff --git a/target/linux/ramips/rt3883/base-files/etc/board.d/02_network b/target/linux/ramips/rt3883/base-files/etc/board.d/02_network
index 873c72cea3..7b73f93944 100755
--- a/target/linux/ramips/rt3883/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/rt3883/base-files/etc/board.d/02_network
@@ -39,9 +39,6 @@ ramips_setup_interfaces()
 		ucidef_add_switch "switch0" \
 			"1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "0 at eth0"
 		;;
-	*)
-		ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
-		;;
 	esac
 }
 
-- 
2.26.1


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list