From bd15c7e178bbc29eca2a02b5d311e01c4ab2a7e3 Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Mon, 15 Feb 2021 21:22:10 +0100 Subject: [PATCH] fff-network: don't hardcode eth0 for one-ports in configurenetwork MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Fabian Bläse Tested-by: Fabian Bläse --- 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 c97a816..21af16a 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 c8a8ecc..9821303 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