configurenetwork: Fix sysctl configuration for special scenario

Submitted by Adrian Schmutzler on July 27, 2018, 3:46 p.m.

Details

Message ID 20180727154625.9344-1-freifunk@adrianschmutzler.de
State Superseded
Headers show

Patch hide | download patch | download mbox

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