Skip to content

Commit

Permalink
networkd: call link_set_routing_policy_rule before setting routes (#7815
Browse files Browse the repository at this point in the history
)

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
  • Loading branch information
ssahani authored and keszybz committed Jan 9, 2018
1 parent 009e9fb commit 27c34f7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/network/networkd-link.c
Expand Up @@ -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) {
Expand All @@ -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);
Expand Down

0 comments on commit 27c34f7

Please sign in to comment.