diff mbox series

[OpenWrt-Devel] ramips: fix port setup for Ubiquiti EdgeRouter X (and SFP)

Message ID 20191216123110.22741-1-freifunk@adrianschmutzler.de
State Rejected
Delegated to: Adrian Schmutzler
Headers show
Series [OpenWrt-Devel] ramips: fix port setup for Ubiquiti EdgeRouter X (and SFP) | expand

Commit Message

Adrian Schmutzler Dec. 16, 2019, 12:31 p.m. UTC
The EdgeRouter only has LAN ports labelled eth0 to eth4 (plus
unsupported eth5 for SFP version). Thus, there is no reason to set
up one of them as WAN.

This patch sets all ports to "lan" and removes the unused wan_mac.

Actually, stock firmware on the EdgeRouter X assigns a specific MAC
address to each port:

eth0    *:f4 (label)
eth1    *:f5
eth2    *:f6
eth3    *:f7
eth4    *:f8
switch0 *:f9

(No data for SFP version)

Only the label MAC is stored on flash in factory 0x22.

OpenWrt currently sets &ethernet to this address, so all ports will
use that one in OpenWrt.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
---
 .../ramips/mt7621/base-files/etc/board.d/02_network   | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

Comments

Matthias Schiffer Dec. 16, 2019, 8:25 p.m. UTC | #1
On 12/16/19 1:31 PM, Adrian Schmutzler wrote:
> The EdgeRouter only has LAN ports labelled eth0 to eth4 (plus
> unsupported eth5 for SFP version). Thus, there is no reason to set
> up one of them as WAN.
> 
> This patch sets all ports to "lan" and removes the unused wan_mac.
> 
> Actually, stock firmware on the EdgeRouter X assigns a specific MAC
> address to each port:
> 
> eth0    *:f4 (label)
> eth1    *:f5
> eth2    *:f6
> eth3    *:f7
> eth4    *:f8
> switch0 *:f9
> 
> (No data for SFP version)
> 
> Only the label MAC is stored on flash in factory 0x22.
> 
> OpenWrt currently sets &ethernet to this address, so all ports will
> use that one in OpenWrt.
> 
> Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>

Having a WAN port by default is extremely useful (and necessary for easy
automatic configuration by OpenWrt-based frameworks like Gluon without
having to special-case many devices).

I would prefer if we could always make one port WAN as long as we have at
least two independently configurable ports, regardless of labeling - at
least that was my policy for creating new hardware support in the past.

Regards,
Matthias


> ---
>  .../ramips/mt7621/base-files/etc/board.d/02_network   | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
> index 5c6b5659cb..6dfe24e296 100755
> --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
> +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
> @@ -62,8 +62,6 @@ ramips_setup_interfaces()
>  	asus,rt-ac85p|\
>  	iptime,a6ns-m|\
>  	mikrotik,rb750gr3|\
> -	ubiquiti,edgerouterx|\
> -	ubiquiti,edgerouterx-sfp|\
>  	youhua,wr1200js)
>  		ucidef_add_switch "switch0" \
>  			"1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "6@eth0"
> @@ -124,6 +122,11 @@ ramips_setup_interfaces()
>  		ucidef_add_switch "switch0" \
>  			"0:lan" "6@eth0"
>  		;;
> +	ubiquiti,edgerouterx|\
> +	ubiquiti,edgerouterx-sfp)
> +		ucidef_add_switch "switch0" \
> +			"0:lan" "1:lan" "2:lan" "3:lan" "4:lan" "6@eth0"
> +		;;
>  	xiaomi,mir3g)
>  		ucidef_add_switch "switch0" \
>  			"2:lan:2" "3:lan:1" "1:wan" "6t@eth0"
> @@ -246,10 +249,6 @@ ramips_setup_macs()
>  	telco-electronics,x1)
>  		wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0xe006)" 1)
>  		;;
> -	ubiquiti,edgerouterx|\
> -	ubiquiti,edgerouterx-sfp)
> -		wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x22)" 1)
> -		;;
>  	wevo,11acnas|\
>  	wevo,w2914ns-v2|\
>  	zio,freezio)
>
Adrian Schmutzler Dec. 27, 2019, 8:04 p.m. UTC | #2
Hi,

> -----Original Message-----
> From: openwrt-devel [mailto:openwrt-devel-bounces@lists.openwrt.org]
> On Behalf Of Matthias Schiffer
> Sent: Montag, 16. Dezember 2019 21:25
> To: Adrian Schmutzler <freifunk@adrianschmutzler.de>
> Cc: openwrt-devel@lists.openwrt.org
> Subject: Re: [OpenWrt-Devel] [PATCH] ramips: fix port setup for Ubiquiti
> EdgeRouter X (and SFP)
> 
> On 12/16/19 1:31 PM, Adrian Schmutzler wrote:
> > The EdgeRouter only has LAN ports labelled eth0 to eth4 (plus
> > unsupported eth5 for SFP version). Thus, there is no reason to set up
> > one of them as WAN.
> >
> > This patch sets all ports to "lan" and removes the unused wan_mac.
> >
> > Actually, stock firmware on the EdgeRouter X assigns a specific MAC
> > address to each port:
> >
> > eth0    *:f4 (label)
> > eth1    *:f5
> > eth2    *:f6
> > eth3    *:f7
> > eth4    *:f8
> > switch0 *:f9
> >
> > (No data for SFP version)
> >
> > Only the label MAC is stored on flash in factory 0x22.
> >
> > OpenWrt currently sets &ethernet to this address, so all ports will
> > use that one in OpenWrt.
> >
> > Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
> 
> Having a WAN port by default is extremely useful (and necessary for easy
> automatic configuration by OpenWrt-based frameworks like Gluon without
> having to special-case many devices).
> 
> I would prefer if we could always make one port WAN as long as we have at
> least two independently configurable ports, regardless of labeling - at least
> that was my policy for creating new hardware support in the past.
> 
> Regards,
> Matthias

I received feedback from two people about this, and both were against merging this.

So I will not merge it and mark the patch as rejected.

Best

Adrian
diff mbox series

Patch

diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
index 5c6b5659cb..6dfe24e296 100755
--- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
@@ -62,8 +62,6 @@  ramips_setup_interfaces()
 	asus,rt-ac85p|\
 	iptime,a6ns-m|\
 	mikrotik,rb750gr3|\
-	ubiquiti,edgerouterx|\
-	ubiquiti,edgerouterx-sfp|\
 	youhua,wr1200js)
 		ucidef_add_switch "switch0" \
 			"1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "6@eth0"
@@ -124,6 +122,11 @@  ramips_setup_interfaces()
 		ucidef_add_switch "switch0" \
 			"0:lan" "6@eth0"
 		;;
+	ubiquiti,edgerouterx|\
+	ubiquiti,edgerouterx-sfp)
+		ucidef_add_switch "switch0" \
+			"0:lan" "1:lan" "2:lan" "3:lan" "4:lan" "6@eth0"
+		;;
 	xiaomi,mir3g)
 		ucidef_add_switch "switch0" \
 			"2:lan:2" "3:lan:1" "1:wan" "6t@eth0"
@@ -246,10 +249,6 @@  ramips_setup_macs()
 	telco-electronics,x1)
 		wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0xe006)" 1)
 		;;
-	ubiquiti,edgerouterx|\
-	ubiquiti,edgerouterx-sfp)
-		wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x22)" 1)
-		;;
 	wevo,11acnas|\
 	wevo,w2914ns-v2|\
 	zio,freezio)