[PATCH 2/3] fff-network: fix unintended wan=eth1 for two-port devices

Adrian Schmutzler mail at adrianschmutzler.de
Di Sep 15 12:59:30 CEST 2020


Merged patches 1/3 and 2/3.

> -----Original Message-----
> From: franken-dev [mailto:franken-dev-bounces at freifunk.net] On Behalf
> Of Adrian Schmutzler
> Sent: Mittwoch, 5. August 2020 22:40
> To: franken-dev at freifunk.net
> Subject: [PATCH 2/3] 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 at adrianschmutzler.de>
> ---
>  src/packages/fff/fff-network/files/etc/config/network        | 2 +-
>  src/packages/fff/fff-network/files/usr/sbin/configurenetwork | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/src/packages/fff/fff-network/files/etc/config/network
> b/src/packages/fff/fff-network/files/etc/config/network
> index 48491d1a..1b9d29b0 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 44487147..e477bfa1 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
> --
> 2.20.1
-------------- nächster Teil --------------
Ein Dateianhang mit Binärdaten wurde abgetrennt...
Dateiname   : openpgp-digital-signature.asc
Dateityp    : application/pgp-signature
Dateigröße  : 834 bytes
Beschreibung: nicht verfügbar
URL         : <https://lists.freifunk.net/pipermail/franken-dev-freifunk.net/attachments/20200915/b23bfb7a/attachment.sig>


Mehr Informationen über die Mailingliste franken-dev