]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
networkd: call link_set_routing_policy_rule before setting routes (#7815)
authorSusant Sahani <145210+ssahani@users.noreply.github.com>
Tue, 9 Jan 2018 08:13:06 +0000 (13:43 +0530)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 9 Jan 2018 08:13:06 +0000 (09:13 +0100)
commit 7715629 (networkd: Fix race condition in [RoutingPolicyRule] handling (#7615)).
Does not fix race. Still there is a race in case of bride because the
bride goes down and up .

calling route_configure then link_set_routing_policy_rule and the
link_check_ready makes a race between routing_policy_rule_messages and route_messages.
While bride comes up and we call the call again route_configure if finds
it self in the callback function LINK_STATE_CONFIGURED networkd dies.
Let's handle first routing policy rules then route_configure. This fixes
the crash.
Closes #7797

src/network/networkd-link.c

index 60ac980ad93666617343d61b7160a64f1d94a001..8b7d122d2d42192acf656fccf47453e3abb88ce1 100644 (file)
@@ -849,6 +849,8 @@ static int link_enter_set_routes(Link *link) {
         assert(link->network);
         assert(link->state == LINK_STATE_SETTING_ADDRESSES);
 
+        (void) link_set_routing_policy_rule(link);
+
         link_set_state(link, LINK_STATE_SETTING_ROUTES);
 
         LIST_FOREACH(routes, rt, link->network->static_routes) {
@@ -862,8 +864,6 @@ static int link_enter_set_routes(Link *link) {
                 link->route_messages++;
         }
 
-        (void) link_set_routing_policy_rule(link);
-
         if (link->route_messages == 0) {
                 link->static_routes_configured = true;
                 link_check_ready(link);