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
This commit is contained in:
Susant Sahani 2018-01-09 13:43:06 +05:30 committed by Zbigniew Jędrzejewski-Szmek
parent 009e9fbcfd
commit 27c34f732e
1 changed files with 2 additions and 2 deletions

View 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);