forked from freifunk-franken/firmware
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 Signed-off-by: Fabian Bläse <fabian@blaese.de>
This commit is contained in:
parent
e3954fddf5
commit
ba7073df5a
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fff-layer3-config
|
||||
PKG_RELEASE:=4
|
||||
PKG_RELEASE:=5
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
# 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
|
||||
}
|
Loading…
Reference in New Issue