fff-layer3-config: Add script to set wan vlan/interface

Allow setting WAN vlan/interface from gateway config.
A configuration without explicit definition of a WAN interface is
valid at the moment and results in the default configuration from
fff-network being used.

Originally, it was intended to automatically set WAN to vlan 2, if nothing was
specified. As this would break devices, which don't use swconfig for
WAN, the already configured WAN interface is left untouched.

Fixes: #85 (gitea)
Signed-off-by: Fabian Bläse <fabian@blaese.de>
Reviewed-by: Christian Dresel <freifunk@dresel.systems>
Reviewed-by: Robert Langhammer <rlanghammer@web.de>
This commit is contained in:
Fabian Bläse 2020-08-02 18:43:33 +02:00 committed by Adrian Schmutzler
parent 6ff350fcf9
commit 31866435a1
2 changed files with 22 additions and 1 deletions

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=fff-layer3-config
PKG_RELEASE:=5
PKG_RELEASE:=6
include $(INCLUDE_DIR)/package.mk

View File

@ -0,0 +1,21 @@
# load board specific properties
BOARD="$(uci get board.model.name)"
. /etc/network.$BOARD
configure() {
if vlan=$(uci -q get gateway.@wan[0].vlan); then
uci set network.wan.ifname="${SWITCHDEV}.$vlan"
elif iface=$(uci -q get gateway.@wan[0].iface); then
uci set network.wan.ifname="$iface"
else
echo "WARNING: No vlan/interface for WAN specified. The default setting won't be overwritten."
fi
}
apply() {
uci commit network
}
revert() {
uci revert network
}