From 27c34f732e7767b5cdc90fe7ad03ae0ea625671c Mon Sep 17 00:00:00 2001 From: Susant Sahani <145210+ssahani@users.noreply.github.com> Date: Tue, 9 Jan 2018 13:43:06 +0530 Subject: [PATCH] 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 --- src/network/networkd-link.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index 60ac980ad9..8b7d122d2d 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);