network: adjust nexthops of dynamic routes before requesting

No effective functionality is changed. Preparation for later commits.
This commit is contained in:
Yu Watanabe
2024-01-19 10:23:14 +09:00
parent acc3fc9e5f
commit 2f542fc3d4
3 changed files with 20 additions and 0 deletions
@@ -300,6 +300,10 @@ static int dhcp_pd_request_route(Link *link, const struct in6_addr *prefix, usec
route->priority = link->network->dhcp_pd_route_metric;
route->lifetime_usec = lifetime_usec;
r = route_adjust_nexthops(route, link);
if (r < 0)
return r;
if (route_get(NULL, link, route, &existing) < 0)
link->dhcp_pd_configured = false;
else
@@ -695,6 +699,10 @@ static int dhcp_request_unreachable_route(
route->priority = IP6_RT_PRIO_USER;
route->lifetime_usec = lifetime_usec;
r = route_adjust_nexthops(route, link);
if (r < 0)
return r;
if (route_get(link->manager, NULL, route, &existing) < 0)
*configured = false;
else
@@ -789,6 +797,10 @@ static int dhcp4_pd_request_default_gateway_on_6rd_tunnel(Link *link, const stru
route->priority = IP6_RT_PRIO_USER;
route->lifetime_usec = lifetime_usec;
r = route_adjust_nexthops(route, link);
if (r < 0)
return r;
if (route_get(NULL, link, route, &existing) < 0) /* This is a new route. */
link->dhcp_pd_configured = false;
else
+4
View File
@@ -390,6 +390,10 @@ static int dhcp4_request_route(Route *in, Link *link) {
if (r < 0)
return r;
r = route_adjust_nexthops(route, link);
if (r < 0)
return r;
if (route_get(NULL, link, route, &existing) < 0) /* This is a new route. */
link->dhcp4_configured = false;
else
+4
View File
@@ -218,6 +218,10 @@ static int ndisc_request_route(Route *in, Link *link, sd_ndisc_router *rt) {
if (r < 0)
return r;
r = route_adjust_nexthops(route, link);
if (r < 0)
return r;
is_new = route_get(NULL, link, route, NULL) < 0;
r = link_request_route(link, TAKE_PTR(route), true, &link->ndisc_messages,