mirror of
https://github.com/systemd/systemd.git
synced 2024-10-31 16:21:26 +03:00
networkd: Set RoutingPolicyRule in link_configure (#7235)
The RoutingPolicyRules are not added when we are calling from set_address the link->message++ and link->message-- never reaches to zero in the callback function resulting routes are never gets added. Closes #7200
This commit is contained in:
parent
9990ea0e59
commit
8a9b3a23fd
@ -772,6 +772,36 @@ void link_check_ready(Link *link) {
|
||||
return;
|
||||
}
|
||||
|
||||
static int link_set_routing_policy_rule(Link *link) {
|
||||
RoutingPolicyRule *rule, *rrule = NULL;
|
||||
int r;
|
||||
|
||||
assert(link);
|
||||
assert(link->network);
|
||||
|
||||
LIST_FOREACH(rules, rule, link->network->rules) {
|
||||
r = routing_policy_rule_get(link->manager, rule->family, &rule->from, rule->from_prefixlen, &rule->to,
|
||||
rule->to_prefixlen, rule->tos, rule->fwmark, rule->table, &rrule);
|
||||
if (r == 1) {
|
||||
(void) routing_policy_rule_make_local(link->manager, rrule);
|
||||
continue;
|
||||
}
|
||||
|
||||
r = routing_policy_rule_configure(rule, link, link_routing_policy_rule_handler, false);
|
||||
if (r < 0) {
|
||||
log_link_warning_errno(link, r, "Could not set routing policy rules: %m");
|
||||
link_enter_failed(link);
|
||||
return r;
|
||||
}
|
||||
|
||||
link->link_messages++;
|
||||
}
|
||||
|
||||
routing_policy_rule_purge(link->manager, link);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int route_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
|
||||
_cleanup_link_unref_ Link *link = userdata;
|
||||
int r;
|
||||
@ -1019,7 +1049,6 @@ static int link_set_bridge_fdb(Link *link) {
|
||||
}
|
||||
|
||||
static int link_enter_set_addresses(Link *link) {
|
||||
RoutingPolicyRule *rule, *rrule = NULL;
|
||||
AddressLabel *label;
|
||||
Address *ad;
|
||||
int r;
|
||||
@ -1056,26 +1085,6 @@ static int link_enter_set_addresses(Link *link) {
|
||||
link->link_messages++;
|
||||
}
|
||||
|
||||
LIST_FOREACH(rules, rule, link->network->rules) {
|
||||
r = routing_policy_rule_get(link->manager, rule->family, &rule->from, rule->from_prefixlen, &rule->to,
|
||||
rule->to_prefixlen, rule->tos, rule->fwmark, rule->table, &rrule);
|
||||
if (r == 1) {
|
||||
(void) routing_policy_rule_make_local(link->manager, rrule);
|
||||
continue;
|
||||
}
|
||||
|
||||
r = routing_policy_rule_configure(rule, link, link_routing_policy_rule_handler, false);
|
||||
if (r < 0) {
|
||||
log_link_warning_errno(link, r, "Could not set routing policy rules: %m");
|
||||
link_enter_failed(link);
|
||||
return r;
|
||||
}
|
||||
|
||||
link->link_messages++;
|
||||
}
|
||||
|
||||
routing_policy_rule_purge(link->manager, link);
|
||||
|
||||
/* now that we can figure out a default address for the dhcp server,
|
||||
start it */
|
||||
if (link_dhcp4_server_enabled(link)) {
|
||||
@ -2673,6 +2682,8 @@ static int link_configure(Link *link) {
|
||||
return r;
|
||||
}
|
||||
|
||||
(void) link_set_routing_policy_rule(link);
|
||||
|
||||
if (link_has_carrier(link) || link->network->configure_without_carrier) {
|
||||
r = link_acquire_conf(link);
|
||||
if (r < 0)
|
||||
|
Loading…
Reference in New Issue
Block a user