fff-network: fix unintended wan=eth1 for two-port devices

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 <freifunk@adrianschmutzler.de>
Reviewed-by: Fabian Bläse <fabian@blaese.de>
This commit is contained in:
Adrian Schmutzler 2020-08-05 22:39:58 +02:00
parent 30c3b46127
commit 24be8ecdda
3 changed files with 4 additions and 4 deletions

View File

@ -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)

View File

@ -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'

View File

@ -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