From db0884c79eea53e26a846b817ef69caa67b48262 Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Mon, 15 Feb 2021 21:22:10 +0100 Subject: [PATCH 1/2] fff-network: don't hardcode eth0 for one-ports in configurenetwork We use the one-port implementation also on two-ports like the Nanostation M. Therefore, hard-coding eth0 in configurenetwork will break if the port implemented for the one-port setup (SWITCHDEV/WANDEV) is not eth0. Just use SWITCHDEV instead, like done for the rest of the one-port setup. Signed-off-by: Adrian Schmutzler --- src/packages/fff/fff-network/Makefile | 2 +- .../fff-network/files/usr/sbin/configurenetwork | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/packages/fff/fff-network/Makefile b/src/packages/fff/fff-network/Makefile index c97a816a..21af16af 100644 --- a/src/packages/fff/fff-network/Makefile +++ b/src/packages/fff/fff-network/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=fff-network -PKG_RELEASE:=31 +PKG_RELEASE:=32 include $(INCLUDE_DIR)/package.mk diff --git a/src/packages/fff/fff-network/files/usr/sbin/configurenetwork b/src/packages/fff/fff-network/files/usr/sbin/configurenetwork index c8a8ecc7..9821303d 100755 --- a/src/packages/fff/fff-network/files/usr/sbin/configurenetwork +++ b/src/packages/fff/fff-network/files/usr/sbin/configurenetwork @@ -118,12 +118,12 @@ if [ "$ONE_PORT" = "YES" ] && ( ! uci -q get network.$SWITCHDEV.ifname || [ "$FO uci set network.client.ifname="bat0" uci set network.wan.ifname="$WANDEV" uci del network.ethmesh.ifname - uci del network.eth0.macaddr + uci del network.${SWITCHDEV}.macaddr elif [ "$ETHMODE" = "CLIENT" ] ; then uci set network.client.ifname="bat0 $SWITCHDEV" uci set network.wan.ifname="eth2" #eth2 because it is default in config file uci del network.ethmesh.ifname - uci del network.eth0.macaddr + uci del network.${SWITCHDEV}.macaddr elif [ "$ETHMODE" = "BATMAN" ] ; then uci set network.client.ifname="bat0" uci set network.wan.ifname="eth2" #eth2 because it is default in config file @@ -172,14 +172,14 @@ if [ -n "$ROUTERMAC" ]; then fi if [ -n "$ETH0MAC" ]; then - echo "Fixing MAC on eth0" + echo "Fixing MAC on $SWITCHDEV" sleep 10 NEW_MACADDR=$(cat "/sys/class/net/${ETH0MAC}/address") - uci set network.eth0.macaddr=$NEW_MACADDR + uci set network.${SWITCHDEV}.macaddr=$NEW_MACADDR uci commit network - ifconfig eth0 down - ifconfig eth0 hw ether $NEW_MACADDR - ifconfig eth0 up + ifconfig $SWITCHDEV down + ifconfig $SWITCHDEV hw ether $NEW_MACADDR + ifconfig $SWITCHDEV up /etc/init.d/network restart fi -- 2.39.2 From b96e94367aff64cd9b7aa962f21020cf5d5729c4 Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Mon, 15 Feb 2021 21:53:20 +0100 Subject: [PATCH 2/2] fff-network: fix primary port for Nanostation M Migration from ar71xx to ath79 included changes to the ethernet/switch driver for the target. This introduced a peculiar issue where eth0 and eth1 are swapped for several devices. Most of the relevant cases were already covered in 1cf4d762ff09 ("treewide: move devices from ar71xx to ath79"). This switch also affects the Nanostation M, where the PoE-in port is now eth1 und the PoE-out port is eth0. However, no action was taken in the referenced patch, as nobody was aware of it then. Since the Nanostation M is a two-port device, which we cannot implement properly so far, it was implemented as a one-port with the "primary" PoE-in port so far. This was broken by the ath79 introduction and is now fixed in this patch by using the one-port setup on eth1. That way, the PoE-in port can now be switched by ETHMODE as usual again. Note that custom script, e.g. to set up the second port, need to be adjusted manually, as that one is eth0 now. Fixes: 1cf4d762ff09 ("treewide: move devices from ar71xx to ath79") Fixes: #109 (gitea) Signed-off-by: Adrian Schmutzler --- src/packages/fff/fff-network/Makefile | 2 +- src/packages/fff/fff-network/mips/network.ubnt,nanostation-m | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/packages/fff/fff-network/Makefile b/src/packages/fff/fff-network/Makefile index 21af16af..4cbd3ec8 100644 --- a/src/packages/fff/fff-network/Makefile +++ b/src/packages/fff/fff-network/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=fff-network -PKG_RELEASE:=32 +PKG_RELEASE:=33 include $(INCLUDE_DIR)/package.mk diff --git a/src/packages/fff/fff-network/mips/network.ubnt,nanostation-m b/src/packages/fff/fff-network/mips/network.ubnt,nanostation-m index 372750c3..6c28394b 100644 --- a/src/packages/fff/fff-network/mips/network.ubnt,nanostation-m +++ b/src/packages/fff/fff-network/mips/network.ubnt,nanostation-m @@ -1,5 +1,5 @@ -WANDEV=eth0 -SWITCHDEV=eth0 +WANDEV=eth1 +SWITCHDEV=eth1 CLIENT_PORTS="" WAN_PORTS="" BATMAN_PORTS="" -- 2.39.2