[PATCH] configurenetwork: Fix sysctl configuration for special scenario

Adrian Schmutzler freifunk at adrianschmutzler.de
Fr Jul 27 17:46:24 CEST 2018


This fixes the device for sysctl WAN configuration
"enableAutoConf" in case of a WAN port in the switch but
connected to a separate eth device.

Previously, the commands were executed for e.g. eth0.2,
although eth0 (WAN) was attached untagged and thus eth0 would
have been correct.

While at it, also added comments and quotes.

Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
---
 src/packages/fff/fff-network/Makefile                  |  2 +-
 .../fff/fff-network/files/usr/sbin/configurenetwork    | 18 +++++++++++-------
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/src/packages/fff/fff-network/Makefile b/src/packages/fff/fff-network/Makefile
index 980800a..beb425e 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_VERSION:=10
+PKG_VERSION:=11
 PKG_RELEASE:=1
 
 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
diff --git a/src/packages/fff/fff-network/files/usr/sbin/configurenetwork b/src/packages/fff/fff-network/files/usr/sbin/configurenetwork
index 0e038a4..d4eedc6 100755
--- a/src/packages/fff/fff-network/files/usr/sbin/configurenetwork
+++ b/src/packages/fff/fff-network/files/usr/sbin/configurenetwork
@@ -119,17 +119,15 @@ if ! uci -q get network.$SWITCHDEV > /dev/null || [ "$FORCEPARSE" = '1' ] ; then
     uci set network.${SWITCHDEV}_1.vlan=1
     uci set network.${SWITCHDEV}_1.ports="$CLIENT_PORTS"
 
+    # This defines the VLAN for WAN ports inside the switch.
+    # This is required even if the WAN eth is separate, but the WAN port is in the switch!
     if [ "$WANDEV" = "$SWITCHDEV" ] || ! [ -z "$WAN_PORTS" ]; then
         uci set network.${SWITCHDEV}_2=switch_vlan
         uci set network.${SWITCHDEV}_2.device=$SWITCHHW
         uci set network.${SWITCHDEV}_2.vlan=2
         uci set network.${SWITCHDEV}_2.ports="$WAN_PORTS"
-
-        enableAutoConf "$WANDEV.2"
-    else
-        enableAutoConf "$WANDEV"
     fi
-    
+
     uci set network.${SWITCHDEV}_3=switch_vlan
     uci set network.${SWITCHDEV}_3.device=$SWITCHHW
     uci set network.${SWITCHDEV}_3.vlan=3
@@ -139,10 +137,16 @@ if ! uci -q get network.$SWITCHDEV > /dev/null || [ "$FORCEPARSE" = '1' ] ; then
 
     uci set network.ethmesh.ifname="$SWITCHDEV.3"
 
+    # This defines the WAN interface. We use the VLAN ID only if we do NOT have a separate eth.
+    # This is different from the criterion for the WAN port dealt with above!
+    # If the WANDEV is different from the SWITCHDEV, but the WAN port is in the switch,
+    # the WAN eth has to be connected to the switch untagged!
     if [ "$WANDEV" = "$SWITCHDEV" ]; then
-        uci set network.wan.ifname=$WANDEV.2
+        enableAutoConf "$WANDEV.2"
+        uci set network.wan.ifname="$WANDEV.2"
     else
-        uci set network.wan.ifname=$WANDEV
+        enableAutoConf "$WANDEV"
+        uci set network.wan.ifname="$WANDEV"
     fi
 
     uci commit network
-- 
2.11.0



Mehr Informationen über die Mailingliste franken-dev