From mboxrd@z Thu Jan  1 00:00:00 1970
From: Jonatan Schlag <jonatan.schlag@ipfire.org>
To: network@lists.ipfire.org
Subject:
 [network] [PATCH 2/2] route: apply static routes on startup and	restart
Date: Fri, 02 Jun 2017 08:30:35 +0200
Message-ID: <1496385035-3913-2-git-send-email-jonatan.schlag@ipfire.org>
In-Reply-To: <1496385035-3913-1-git-send-email-jonatan.schlag@ipfire.org>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="===============0766761605608210685=="
List-Id: <network.lists.ipfire.org>

--===============0766761605608210685==
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable

The static routes can only be applied when the network has a valid layer 3  c=
onnectivity.
So it is not useful to have a route_init which is called before we have any l=
ayer 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 ap=
plied correctly.

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

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.
 #
=20
-route_init() {
-	# Apply configured static routes.
-	route_apply
-}
-
-init_register route_init
-
 route_add() {
 	local ${NETWORK_CONFIG_ROUTES_PARAMS}
=20
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}
=20
 	cmd ${ip_cmd} rule add from ${local_ip_address} lookup ${table}
+
+	# Apply all static routes
+	route_apply
 }
--=20
2.6.3


--===============0766761605608210685==--