[2/2] route: apply static routes on startup and restart

Submitted by Jonatan Schlag on June 2, 2017, 6:30 a.m.

Details

Message ID 1496385035-3913-2-git-send-email-jonatan.schlag@ipfire.org
State New
Headers show

Commit Message

Jonatan Schlag June 2, 2017, 6:30 a.m.
The static routes can only be applied when the network has a valid layer 3  connectivity.
So it is not useful to have a route_init which is called before we have any layer 3  connectivity.
We now call the route_apply every time we set new routes for a zone.
We do this every time we get a new layer 3  connectivity so all routes are applied correctly.

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
---
 src/functions/functions.route   | 7 -------
 src/functions/functions.routing | 3 +++
 2 files changed, 3 insertions(+), 7 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/functions/functions.route b/src/functions/functions.route
index 026656c..72f8c51 100644
--- a/src/functions/functions.route
+++ b/src/functions/functions.route
@@ -22,13 +22,6 @@ 
 # Functions for static routing.
 #
 
-route_init() {
-	# Apply configured static routes.
-	route_apply
-}
-
-init_register route_init
-
 route_add() {
 	local ${NETWORK_CONFIG_ROUTES_PARAMS}
 
diff --git a/src/functions/functions.routing b/src/functions/functions.routing
index c7aac09..2436585 100644
--- a/src/functions/functions.routing
+++ b/src/functions/functions.routing
@@ -181,4 +181,7 @@  routing_update() {
 	cmd ${routing_cmd}
 
 	cmd ${ip_cmd} rule add from ${local_ip_address} lookup ${table}
+
+	# Apply all static routes
+	route_apply
 }