fff-network: fix code flow for one-port devices in configurenetwork

So far, all one-port devices also triggered the switch-based setup
in configurenetwork, as the one-port condition was not checked
there. While the relevant parts are overwritten by the one-port
config which comes later in the script, it still creates a lot
of useless/broken switch/vlan setup entries in /etc/config/network.

Properly check for one-port vs. non-one-port in the file, without
touching anything else.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Acked-by: Fabian Bläse <fabian@blaese.de>
Reviewed-by: Fabian Bläse <fabian@blaese.de>
This commit is contained in:
Adrian Schmutzler 2020-08-05 22:31:19 +02:00 committed by Fabian Bläse
parent 8702fdd823
commit 47db8d31be
1 changed files with 56 additions and 54 deletions

View File

@ -65,6 +65,7 @@ if [ -n "$LAN1PORT" ] ; then
setupPorts "$LAN1PORT" "${LAN1MODE}"
fi
if [ "$ONE_PORT" != "YES" ]; then
if ! uci -q get network.$SWITCHDEV > /dev/null || [ "$FORCEPARSE" = '1' ] ; then
SWITCHHW=$(swconfig list | awk '{ print $4 }')
@ -104,8 +105,8 @@ if ! uci -q get network.$SWITCHDEV > /dev/null || [ "$FORCEPARSE" = '1' ] ; then
uci commit network
fi
if [ "$ONE_PORT" = "YES" ] && ( ! uci -q get network.$SWITCHDEV.ifname || [ "$FORCEPARSE" = '1' ] ) ; then
else
if ! uci -q get network.$SWITCHDEV.ifname || [ "$FORCEPARSE" = '1' ] ; then
uci set network.$SWITCHDEV=interface
uci set network.$SWITCHDEV.ifname=$SWITCHDEV
if [ "$ETHMODE" = "WAN" ]; then
@ -126,6 +127,7 @@ if [ "$ONE_PORT" = "YES" ] && ( ! uci -q get network.$SWITCHDEV.ifname || [ "$FO
fi
uci commit network
fi
fi
/etc/init.d/network restart