network/ndisc: do not set per-route MTU and hop limit
Setting MTU announced in RA message to routes is problematic, as the value may be larger than the device MTU (IFLA_MTU), and in such case the route cannot be used. These two properties are now set per-interface, and gracefully handled such invalid cases. Hence not necessary to set them to each route. Follow-up for #32195.
This commit is contained in:
@@ -179,8 +179,6 @@ static void ndisc_set_route_priority(Link *link, Route *route) {
|
||||
|
||||
static int ndisc_request_route(Route *route, Link *link, sd_ndisc_router *rt) {
|
||||
struct in6_addr router;
|
||||
uint8_t hop_limit = 0;
|
||||
uint32_t mtu = 0;
|
||||
bool is_new;
|
||||
int r;
|
||||
|
||||
@@ -194,30 +192,13 @@ static int ndisc_request_route(Route *route, Link *link, sd_ndisc_router *rt) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
if (link->network->ndisc_use_mtu) {
|
||||
r = sd_ndisc_router_get_mtu(rt, &mtu);
|
||||
if (r < 0 && r != -ENODATA)
|
||||
return log_link_warning_errno(link, r, "Failed to get MTU from RA: %m");
|
||||
}
|
||||
|
||||
if (link->network->ndisc_use_hop_limit) {
|
||||
r = sd_ndisc_router_get_hop_limit(rt, &hop_limit);
|
||||
if (r < 0 && r != -ENODATA)
|
||||
return log_link_warning_errno(link, r, "Failed to get hop limit from RA: %m");
|
||||
}
|
||||
|
||||
route->source = NETWORK_CONFIG_SOURCE_NDISC;
|
||||
route->provider.in6 = router;
|
||||
if (!route->table_set)
|
||||
route->table = link_get_ndisc_route_table(link);
|
||||
if (!route->protocol_set)
|
||||
route->protocol = RTPROT_RA;
|
||||
r = route_metric_set(&route->metric, RTAX_MTU, mtu);
|
||||
if (r < 0)
|
||||
return r;
|
||||
r = route_metric_set(&route->metric, RTAX_HOPLIMIT, hop_limit);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
r = route_metric_set(&route->metric, RTAX_QUICKACK, link->network->ndisc_quickack);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
Reference in New Issue
Block a user