configurenetwork: Tidy-up auto configuration functions

This fixes a typo in description and introduces a single variable
for the sysctlfile.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Reviewed-by: Christian Dresel <fff@chrisi01.de>
This commit is contained in:
Adrian Schmutzler 2019-02-04 14:05:47 +01:00
parent e34f5b0119
commit d0d8fc57af
1 changed files with 10 additions and 9 deletions

View File

@ -30,19 +30,20 @@ setupPorts() {
setAutoConf() { setAutoConf() {
# Sets ipv6 auto configuration on an interface to on/off # Sets ipv6 auto configuration on an interface to on/off
# Usage: enableAutoConf <interface> <[0|1]> # Usage: setAutoConf <interface> <[0|1]>
local iface=$1 local iface=$1
local on=$2 local on=$2
echo "# Generated from configurenetwork" > "/etc/sysctl.d/51-fff-network-$iface.conf" sysctlfile="/etc/sysctl.d/51-fff-network-$iface.conf"
echo "net.ipv6.conf.$iface.accept_ra = $on" >> "/etc/sysctl.d/51-fff-network-$iface.conf" echo "# Generated from configurenetwork" > "$sysctlfile"
echo "net.ipv6.conf.$iface.accept_ra_defrtr = $on" >> "/etc/sysctl.d/51-fff-network-$iface.conf" echo "net.ipv6.conf.$iface.accept_ra = $on" >> "$sysctlfile"
echo "net.ipv6.conf.$iface.accept_ra_pinfo = $on" >> "/etc/sysctl.d/51-fff-network-$iface.conf" echo "net.ipv6.conf.$iface.accept_ra_defrtr = $on" >> "$sysctlfile"
echo "net.ipv6.conf.$iface.autoconf = $on" >> "/etc/sysctl.d/51-fff-network-$iface.conf" echo "net.ipv6.conf.$iface.accept_ra_pinfo = $on" >> "$sysctlfile"
echo "net.ipv6.conf.$iface.accept_ra_rtr_pref = $on" >> "/etc/sysctl.d/51-fff-network-$iface.conf" echo "net.ipv6.conf.$iface.autoconf = $on" >> "$sysctlfile"
echo "net.ipv6.conf.$iface.forwarding = 0" >> "/etc/sysctl.d/51-fff-network-$iface.conf" echo "net.ipv6.conf.$iface.accept_ra_rtr_pref = $on" >> "$sysctlfile"
echo "net.ipv6.conf.$iface.forwarding = 0" >> "$sysctlfile"
/sbin/sysctl -p "/etc/sysctl.d/51-fff-network-$iface.conf" /sbin/sysctl -p "$sysctlfile"
} }
enableAutoConf() { enableAutoConf() {