1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-09 01:18:19 +03:00

network: ndisc - Ignore route information if reserved (10) value is

received

RFC4191 – Section 2.3 Route Information Option's Prf field:
If the Reserved (10) value is received, the Route Information Option MUST be ignored.
This commit is contained in:
Susant Sahani 2023-07-24 15:04:59 +05:30 committed by Yu Watanabe
parent 031a399d87
commit 3912d49d0d
2 changed files with 7 additions and 3 deletions

View File

@ -530,10 +530,10 @@ int sd_ndisc_router_route_get_preference(sd_ndisc_router *rt, unsigned *ret) {
if (r < 0)
return r;
*ret = (ri[3] >> 3) & 3;
if (!IN_SET(*ret, SD_NDISC_PREFERENCE_LOW, SD_NDISC_PREFERENCE_HIGH))
*ret = SD_NDISC_PREFERENCE_MEDIUM;
if (!IN_SET((ri[3] >> 3) & 3, SD_NDISC_PREFERENCE_LOW, SD_NDISC_PREFERENCE_MEDIUM, SD_NDISC_PREFERENCE_HIGH))
return -ENOTSUP;
*ret = (ri[3] >> 3) & 3;
return 0;
}

View File

@ -585,6 +585,10 @@ static int ndisc_router_process_route(Link *link, sd_ndisc_router *rt) {
}
r = sd_ndisc_router_route_get_preference(rt, &preference);
if (r == -ENOTSUP) {
log_link_debug_errno(link, r, "Received route prefix with unsupported preference, ignoring: %m");
return 0;
}
if (r < 0)
return log_link_warning_errno(link, r, "Failed to get default router preference from RA: %m");