From: Susant Sahani <145210+ssahani@users.noreply.github.com> Date: Tue, 9 Jan 2018 08:13:06 +0000 (+0530) Subject: networkd: call link_set_routing_policy_rule before setting routes (#7815) X-Git-Tag: v237~135 X-Git-Url: http://git.ipfire.org/?p=thirdparty%2Fsystemd.git;a=commitdiff_plain;h=27c34f732e7767b5cdc90fe7ad03ae0ea625671c networkd: call link_set_routing_policy_rule before setting routes (#7815) 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 --- diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index 60ac980ad93..8b7d122d2d4 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -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);