fff-network: convert GL-AR150 to TWOPORT

The GL-AR150 has two ethernet ports. One of them is connected directly
to the CPU (labeled "WAN"), while the other one (labeled "LAN") is
connected to the internal switch of the AR9330 platform.

Previously, this device had its own codepath in configurenetwork,
utilizing the ETHPORT variable, so the single physical port of the
switch could be connected to either the CLIENT or BATMAN vlan of the
SWITCHPORT.

When adding support for TWO_PORT devices, this codepath was accidentally
removed, so the LAN-Port was not configured anymore.

Configuring the internal switch is not necessary when only a single
physical port ist connected to it. Instead, leave the switch
unconfigured, so it behaves like an unmanaged vlan-transparent switch.

As we support TWO_PORT devices now, utilize the TWO_PORT codepath
(instead of the ONE_PORT codepath, which would be equivalent to the old
behaviour) to make both ports configureable. To retain the previously
configured mode of the LAN-Port, migrate ETHPORT to LAN1MODE before
executing configurenetwork.

Fixes: #222
Fixes: c22032e254 ("fff-network: support native two-port devices")

Signed-off-by: Fabian Bläse <fabian@blaese.de>
Tested-by: Sebastian Beck <freifunk@beibecks.de>
This commit is contained in:
Fabian Bläse 2022-03-22 22:25:51 +01:00
parent f89503660d
commit 240a506ee7
2 changed files with 13 additions and 5 deletions

View File

@ -0,0 +1,12 @@
# The GL-AR150 was converted from ONEPORT to TWOPORT.
# Copy ETHMODE to LAN1MODE ("LAN"-Port) and set LAN0MODE ("WAN"-Port) to WAN to retain the configured behaviour for upgraded devices.
if [ -s /etc/network.config ] ; then
. /etc/network.config
# Ensure ETHMODE contains a sensible value. Use default behaviour (CLIENT) otherwise.
[ "$ETHMODE" != "BATMAN" ] && [ "$ETHMODE" != "CLIENT" ] && [ "$ETHMODE" != "WAN" ] && ETHMODE="CLIENT"
echo "LAN0MODE='WAN' # use BATMAN, CLIENT or WAN" > /etc/network.config
echo "LAN1MODE='$ETHMODE' # use BATMAN, CLIENT or WAN" >> /etc/network.config
echo "FORCEPARSE='2' # Parse at: 0=first boot only, 1=every reboot, 2=next reboot (once)" >> /etc/network.config
fi

View File

@ -2,12 +2,8 @@
WANDEV=eth1
SWITCHDEV=eth0
WAN_PORTS=
BATMAN_PORTS="0t"
CLIENT_PORTS="0t"
TWO_PORT=YES
ETHMESHMAC="$(macFlipLocalBit $(cat /sys/class/net/eth0/address))"
. /etc/network.mode
ETHPORT=1