Ensure that radvd is started when needed
authorStefan Schantl <stefan.schantl@ipfire.org>
Sun, 6 Sep 2015 16:37:43 +0000 (18:37 +0200)
committerStefan Schantl <stefan.schantl@ipfire.org>
Sun, 6 Sep 2015 16:37:43 +0000 (18:37 +0200)
As this is a router we will need to make sure that the router
advertisement daemon is running at all times for local zones.

This patch will start radvd automatically when ever needed.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/functions/functions.radvd
src/functions/functions.routing

index 1e84b35..2079554 100644 (file)
@@ -25,8 +25,14 @@ radvd_update() {
        # (Re-)write the configuration file
        radvd_write_config
 
-       # Reload the radvd service.
-       service_reload radvd
+       # Reload the radvd service if it is already running
+       if service_is_active radvd; then
+               service_reload radvd
+               return ${EXIT_OK}
+       fi
+
+       # Start the radvd service
+       service_start radvd
 }
 
 radvd_write_config() {
index 707e026..b7b0cc9 100644 (file)
@@ -80,6 +80,9 @@ routing_default_update() {
                # Remove too much spaces.
                routes=$(echo ${routes})
 
+               # Reload radvd configuration
+               [[ "${proto}" = "ipv6" ]] && radvd_update
+
                # Remove all default routes.
                if [ -z "${routes}" ]; then
                        cmd ${cmd} del default
@@ -92,13 +95,6 @@ routing_default_update() {
                cmd ${cmd} replace default ${routes}
                assert [ $? -eq 0 ]
 
-               case "${proto}" in
-                       ipv6)
-                               # Apply radvd configuration.
-                               radvd_update
-                               ;;
-               esac
-
                triggers_execute_all "online"
        done
 }