]> git.ipfire.org Git - people/ms/ipfire-2.x.git/commitdiff
freifunk: Allow adding physical interfaces and disable IPv6 autoconf
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 8 Mar 2015 21:09:51 +0000 (22:09 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 9 Mar 2015 15:39:08 +0000 (16:39 +0100)
src/initscripts/init.d/lib-freifunk

index 2365e3c47372b5d7e0e59edc40322f3b7dcfd0e6..426fba9990064a29665768b82e96902ce423dc14 100755 (executable)
@@ -22,6 +22,9 @@ function freifunk_start() {
        freifunk_bridge_create
        freifunk_bridge_attach "${BATMAN_INTERFACE}"
 
+       # Attach all other interfaces
+       freifunk_attach_all_interfaces
+
        # Make sure that alfred is started
        /etc/init.d/alfred start &>/dev/null
 }
@@ -99,10 +102,34 @@ function freifunk_ipv6_enable() {
        local device="${1}"
 
        sysctl -w "net.ipv6.conf.${device}.disable_ipv6=0" >/dev/null
+
+       # Disable autoconf because we do not need and want IPFire
+       # to get a globally routed prefix.
+       sysctl -w "net.ipv6.conf.${device}.autoconf=0" >/dev/null
 }
 
 function freifunk_ipv6_disable() {
        local device="${1}"
 
        sysctl -w "net.ipv6.conf.${device}.disable_ipv6=1" >/dev/null
+       sysctl -w "net.ipv6.conf.${device}.autoconf=1" >/dev/null
+}
+
+function freifunk_attach_all_interfaces() {
+       local address
+       local interface
+       local mesh
+
+       for mesh in FREIFUNK1 FREIFUNK2 FREIFUNK3 FREIFUNK4; do
+               local interface_var="${mesh}_DEV"
+               interface="${!interface_var}"
+
+               [ -n "${interface}" ] || continue
+
+               # Continue if $interface does not exist
+               [ -d "/sys/class/net/${interface}" ] || continue
+
+               # Attach the device to the bridge
+               freifunk_bridge_attach "${interface}"
+       done
 }