mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-03-08 20:58:20 +03:00
network: nexthop: first create nexthops with ID
Otherwise, an ID-less nexthop may conflict with a later nexthop with ID.
This commit is contained in:
parent
0761da386a
commit
055e4909de
@ -300,6 +300,11 @@ static int nexthop_configure(NextHop *nexthop, Link *link) {
|
||||
}
|
||||
|
||||
int link_set_nexthop(Link *link) {
|
||||
enum {
|
||||
PHASE_ID, /* First phase: Nexthops with ID */
|
||||
PHASE_WITHOUT_ID, /* Second phase: Nexthops without ID */
|
||||
_PHASE_MAX,
|
||||
} phase;
|
||||
NextHop *nh;
|
||||
int r;
|
||||
|
||||
@ -313,13 +318,17 @@ int link_set_nexthop(Link *link) {
|
||||
|
||||
link->static_nexthops_configured = false;
|
||||
|
||||
HASHMAP_FOREACH(nh, link->network->nexthops_by_section) {
|
||||
r = nexthop_configure(nh, link);
|
||||
if (r < 0)
|
||||
return log_link_warning_errno(link, r, "Could not set nexthop: %m");
|
||||
for (phase = PHASE_ID; phase < _PHASE_MAX; phase++)
|
||||
HASHMAP_FOREACH(nh, link->network->nexthops_by_section) {
|
||||
if ((nh->id > 0) != (phase == PHASE_ID))
|
||||
continue;
|
||||
|
||||
link->nexthop_messages++;
|
||||
}
|
||||
r = nexthop_configure(nh, link);
|
||||
if (r < 0)
|
||||
return log_link_warning_errno(link, r, "Could not set nexthop: %m");
|
||||
|
||||
link->nexthop_messages++;
|
||||
}
|
||||
|
||||
if (link->nexthop_messages == 0) {
|
||||
link->static_nexthops_configured = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user