1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-05 09:17:44 +03:00

network: do not enter failed state when received an invalid RA

Fixes the issue reported at https://github.com/systemd/systemd/issues/25891#issuecomment-1368509262.

(cherry picked from commit 5908d86425)
This commit is contained in:
Yu Watanabe 2023-01-17 13:20:13 +09:00 committed by Zbigniew Jędrzejewski-Szmek
parent efc4cbaa7f
commit f2d84ca5f1

View File

@ -794,31 +794,24 @@ static int ndisc_router_process_options(Link *link, sd_ndisc_router *rt) {
return log_link_error_errno(link, r, "Failed to get RA option type: %m");
switch (type) {
case SD_NDISC_OPTION_PREFIX_INFORMATION:
r = ndisc_router_process_prefix(link, rt);
if (r < 0)
return r;
break;
case SD_NDISC_OPTION_ROUTE_INFORMATION:
r = ndisc_router_process_route(link, rt);
if (r < 0)
return r;
break;
case SD_NDISC_OPTION_RDNSS:
r = ndisc_router_process_rdnss(link, rt);
if (r < 0)
return r;
break;
case SD_NDISC_OPTION_DNSSL:
r = ndisc_router_process_dnssl(link, rt);
if (r < 0)
return r;
break;
}
if (r < 0 && r != -EBADMSG)
return r;
}
}
@ -1001,6 +994,10 @@ static int ndisc_router_handler(Link *link, sd_ndisc_router *rt) {
assert(rt);
r = sd_ndisc_router_get_address(rt, &router);
if (r == -ENODATA) {
log_link_debug(link, "Received RA without router address, ignoring.");
return 0;
}
if (r < 0)
return log_link_error_errno(link, r, "Failed to get router address from RA: %m");
@ -1015,6 +1012,10 @@ static int ndisc_router_handler(Link *link, sd_ndisc_router *rt) {
}
r = sd_ndisc_router_get_timestamp(rt, CLOCK_BOOTTIME, &timestamp_usec);
if (r == -ENODATA) {
log_link_debug(link, "Received RA without timestamp, ignoring.");
return 0;
}
if (r < 0)
return r;
@ -1061,7 +1062,7 @@ static void ndisc_handler(sd_ndisc *nd, sd_ndisc_event_t event, sd_ndisc_router
case SD_NDISC_EVENT_ROUTER:
r = ndisc_router_handler(link, rt);
if (r < 0) {
if (r < 0 && r != -EBADMSG) {
link_enter_failed(link);
return;
}