mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-06-10 13:48:25 +02:00
l3-config-data: fix direct route selection preferring metric over prefix length
In nm_l3_config_data_get_direct_route_for_host(), after the first check filters
out routes with a shorter prefix than the current best, the remaining candidates
have plen >= best_route->plen. The metric comparison must only apply when the
prefix lengths are equal; otherwise a more specific route (longer prefix) is
incorrectly skipped if it has a higher metric than the current best.
Fixes: 695ce608ba ('l3cfg: add nm_l3_config_data_add_dependent_routes()')
This commit is contained in:
parent
63173a4e33
commit
bc67b0211a
1 changed files with 2 additions and 1 deletions
|
|
@ -2773,7 +2773,8 @@ nm_l3_config_data_get_direct_route_for_host(const NML3ConfigData *self,
|
|||
if (!nm_ip_addr_same_prefix(addr_family, host, item->rx.network_ptr, item->rx.plen))
|
||||
continue;
|
||||
|
||||
if (best_route && best_route->rx.metric <= item->rx.metric)
|
||||
if (best_route && best_route->rx.plen == item->rx.plen
|
||||
&& best_route->rx.metric <= item->rx.metric)
|
||||
continue;
|
||||
|
||||
best_route_obj = item_obj;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue