fff-network: Improve IPv6 WAN connectivity

Until now, IPv6 connectivity was only ensured by some custom sysctls.
OpenWrt has a proper way of enabling IPv6 client (SLAAC, as well as DHCPv6)
for an interface. Switching to OpenWrt's way of configuring client addresses
for an interface might also make configuration more reliable, as the appropriate
sysctls are now set by netifd. Especially OnePort and TwoPort devices will
benefit from this change, as IPv6 auto configuration does not have to be manually
enabled and disabled for a physical interface, but rather is set as an option for
our logical wan interface.

At the same time this change enables DHCPv6 client support for WAN.

Signed-off-by: Fabian Bläse <fabian@blaese.de>
Reviewed-by: Robert Langhammer <rlanghammer@web.de>
Reviewed-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
[bump PKG_RELEASE]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
This commit is contained in:
Fabian Bläse 2020-07-31 22:59:15 +02:00 committed by Adrian Schmutzler
parent c23c98b2cb
commit b5563caa23
3 changed files with 8 additions and 43 deletions

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=fff-network
PKG_RELEASE:=22
PKG_RELEASE:=23
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)

View File

@ -12,6 +12,12 @@ config interface 'wan'
option proto 'dhcp'
option ifname 'eth1'
config interface 'wan6'
option proto 'dhcpv6'
option reqprefix 'no'
option sourcefilter '0'
option ifname '@wan'
config interface 'ethmesh'
option proto 'batadv_hardif'
option master 'bat0'

View File

@ -28,40 +28,6 @@ setupPorts() {
fi
}
setAutoConf() {
# Sets ipv6 auto configuration on an interface to on/off
# Usage: setAutoConf <interface> <[0|1]>
local iface=$1
local on=$2
sysctlfile="/etc/sysctl.d/65-fff-network-$iface.conf"
echo "# Generated from configurenetwork" > "$sysctlfile"
echo "net.ipv6.conf.$iface.accept_ra = $on" >> "$sysctlfile"
echo "net.ipv6.conf.$iface.accept_ra_defrtr = $on" >> "$sysctlfile"
echo "net.ipv6.conf.$iface.accept_ra_pinfo = $on" >> "$sysctlfile"
echo "net.ipv6.conf.$iface.autoconf = $on" >> "$sysctlfile"
echo "net.ipv6.conf.$iface.accept_ra_rtr_pref = $on" >> "$sysctlfile"
echo "net.ipv6.conf.$iface.forwarding = 0" >> "$sysctlfile"
/sbin/sysctl -p "$sysctlfile"
}
enableAutoConf() {
# Enables ipv6 auto configuration on an interface
# Usage: enableAutoConf <interface>
local iface=$1
setAutoConf "$iface" "1"
}
disableAutoConf() {
# Disables ipv6 auto configuration on an interface
# Usage: disableAutoConf <interface>
local iface=$1
setAutoConf "$iface" "0"
}
BOARD="$(uci get board.model.name)"
. /etc/network.$BOARD
@ -125,12 +91,8 @@ if ! uci -q get network.$SWITCHDEV > /dev/null || [ "$FORCEPARSE" = '1' ] ; then
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
@ -153,19 +115,16 @@ if [ "$ONE_PORT" = "YES" ] && ( ! uci -q get network.$SWITCHDEV.ifname || [ "$FO
uci set network.$SWITCHDEV=interface
uci set network.$SWITCHDEV.ifname=$SWITCHDEV
if [ "$ETHMODE" = "WAN" ]; then
enableAutoConf "$WANDEV"
uci set network.mesh.ifname="bat0"
uci set network.wan.ifname="$WANDEV"
uci del uci set network.ethmesh.ifname
uci del network.eth0.macaddr
elif [ "$ETHMODE" = "CLIENT" ] ; then
disableAutoConf "$WANDEV"
uci set network.mesh.ifname="bat0 $SWITCHDEV"
uci set network.wan.ifname="eth1" #eth1 because it is default in config file
uci del network.ethmesh.ifname
uci del network.eth0.macaddr
elif [ "$ETHMODE" = "BATMAN" ] ; then
disableAutoConf "$WANDEV"
uci set network.mesh.ifname="bat0"
uci set network.wan.ifname="eth1" #eth1 because it is default in config file
uci set network.ethmesh.ifname="$SWITCHDEV"