[PATCH] configurenetwork: Tidy-up auto configuration functions

Adrian Schmutzler freifunk at adrianschmutzler.de
Mo Feb 4 14:05:47 CET 2019


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

Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
---
 .../fff/fff-network/files/usr/sbin/configurenetwork   | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/src/packages/fff/fff-network/files/usr/sbin/configurenetwork b/src/packages/fff/fff-network/files/usr/sbin/configurenetwork
index 0e038a49..448bd04b 100755
--- a/src/packages/fff/fff-network/files/usr/sbin/configurenetwork
+++ b/src/packages/fff/fff-network/files/usr/sbin/configurenetwork
@@ -30,19 +30,20 @@ setupPorts() {
 
 setAutoConf() {
     # Sets ipv6 auto configuration on an interface to on/off
-    # Usage: enableAutoConf <interface> <[0|1]>
+    # Usage: setAutoConf <interface> <[0|1]>
     local iface=$1
     local on=$2
 
-    echo "# Generated from configurenetwork" > "/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 "net.ipv6.conf.$iface.accept_ra_defrtr = $on" >> "/etc/sysctl.d/51-fff-network-$iface.conf"
-    echo "net.ipv6.conf.$iface.accept_ra_pinfo = $on" >> "/etc/sysctl.d/51-fff-network-$iface.conf"
-    echo "net.ipv6.conf.$iface.autoconf = $on" >> "/etc/sysctl.d/51-fff-network-$iface.conf"
-    echo "net.ipv6.conf.$iface.accept_ra_rtr_pref = $on" >> "/etc/sysctl.d/51-fff-network-$iface.conf"
-    echo "net.ipv6.conf.$iface.forwarding = 0" >> "/etc/sysctl.d/51-fff-network-$iface.conf"
+    sysctlfile="/etc/sysctl.d/51-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 "/etc/sysctl.d/51-fff-network-$iface.conf"
+    /sbin/sysctl -p "$sysctlfile"
 }
 
 enableAutoConf() {
-- 
2.11.0



Mehr Informationen über die Mailingliste franken-dev