]> git.ipfire.org Git - people/stevee/network.git/commitdiff
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 1e84b35f5d7f8facc0b56c0b22d1efbf1b27efba..2079554ae62b5837d0fd97f436c29b33f22907a0 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 707e0268dea4a56f2483bef49e8ce75de051e317..b7b0cc97973335a8a0005756faef231f849841fa 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
 }