From 24be8ecdda18db8d001165f6f4c2b74e64b14342 Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Wed, 5 Aug 2020 22:39:58 +0200 Subject: [PATCH] fff-network: fix unintended wan=eth1 for two-port devices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For historic reasons, the wan interface is set to eth1 as default value. When updating the config for one-port devices in configurenetwork, the same value is put there again if the mode is switched to something != WAN, instead of just removing the value. While ifname actually is a mandatory value, this has been handled inconsistently in the past, where ethmesh ifname was deleted, and wan ifname was just changed back to eth1, when assigning the actually relevant eth0 to a different task. This concept was set up with a one-port device in mind, i.e. a device where there is no eth1. However, this very setup routine got applied to the Nanostation M as well (which is treated as as one-port), where we suddenly have two interfaces and the eth1 exists. So, while the user assumes it's unconfigured, the second port actually becomes set up as WAN if the first one is != WAN. If connected to a second device with CLIENT (=default) to provide PoE there, this will create a loop. So, finally, in order to somehow fix this mess, this patch just changes the hardcoded "eth1" to "eth2". While this is no proper fix, it perpetuates the original idea of keeping wan set to something, but nothing which actually exists. However, there are no sideeffects and we keep this minimal-invasive. Signed-off-by: Adrian Schmutzler Reviewed-by: Fabian Bläse --- src/packages/fff/fff-network/Makefile | 2 +- src/packages/fff/fff-network/files/etc/config/network | 2 +- src/packages/fff/fff-network/files/usr/sbin/configurenetwork | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/packages/fff/fff-network/Makefile b/src/packages/fff/fff-network/Makefile index c888205..e1b603b 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:=23 +PKG_RELEASE:=24 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) diff --git a/src/packages/fff/fff-network/files/etc/config/network b/src/packages/fff/fff-network/files/etc/config/network index 48491d1..1b9d29b 100644 --- a/src/packages/fff/fff-network/files/etc/config/network +++ b/src/packages/fff/fff-network/files/etc/config/network @@ -10,7 +10,7 @@ config interface 'mesh' config interface 'wan' option proto 'dhcp' - option ifname 'eth1' + option ifname 'eth2' config interface 'wan6' option proto 'dhcpv6' diff --git a/src/packages/fff/fff-network/files/usr/sbin/configurenetwork b/src/packages/fff/fff-network/files/usr/sbin/configurenetwork index 4448714..e477bfa 100755 --- a/src/packages/fff/fff-network/files/usr/sbin/configurenetwork +++ b/src/packages/fff/fff-network/files/usr/sbin/configurenetwork @@ -121,12 +121,12 @@ if [ "$ONE_PORT" = "YES" ] && ( ! uci -q get network.$SWITCHDEV.ifname || [ "$FO uci del network.eth0.macaddr elif [ "$ETHMODE" = "CLIENT" ] ; then uci set network.mesh.ifname="bat0 $SWITCHDEV" - uci set network.wan.ifname="eth1" #eth1 because it is default in config file + uci set network.wan.ifname="eth2" #eth2 because it is default in config file uci del network.ethmesh.ifname uci del network.eth0.macaddr elif [ "$ETHMODE" = "BATMAN" ] ; then uci set network.mesh.ifname="bat0" - uci set network.wan.ifname="eth1" #eth1 because it is default in config file + uci set network.wan.ifname="eth2" #eth2 because it is default in config file uci set network.ethmesh.ifname="$SWITCHDEV" ETH0MAC="w2ap" fi