Merge pull request #31997 from yuwata/network-ndisc-zero-lifetime

network: fixlets for zero lifetime
This commit is contained in:
Yu Watanabe
2024-04-09 07:52:28 +09:00
committed by GitHub
2 changed files with 9 additions and 20 deletions
+9 -8
View File
@@ -1283,11 +1283,6 @@ static int ndisc_router_process_route(Link *link, sd_ndisc_router *rt) {
if (r < 0)
return log_link_warning_errno(link, r, "Failed to get route prefix length: %m");
if (in6_addr_is_null(&dst) && prefixlen == 0) {
log_link_debug(link, "Route prefix is ::/0, ignoring");
return 0;
}
if (in6_prefix_is_filtered(&dst, prefixlen,
link->network->ndisc_allow_listed_route_prefix,
link->network->ndisc_deny_listed_route_prefix)) {
@@ -1331,9 +1326,15 @@ static int ndisc_router_process_route(Link *link, sd_ndisc_router *rt) {
route->dst_prefixlen = prefixlen;
route->lifetime_usec = lifetime_usec;
r = ndisc_request_route(route, link, rt);
if (r < 0)
return log_link_warning_errno(link, r, "Could not request additional route: %m");
if (lifetime_usec != 0) {
r = ndisc_request_route(route, link, rt);
if (r < 0)
return log_link_warning_errno(link, r, "Could not request additional route: %m");
} else {
r = ndisc_remove_route(route, link);
if (r < 0)
return log_link_warning_errno(link, r, "Could not remove additional route with zero lifetime: %m");
}
return 0;
}
-12
View File
@@ -816,12 +816,6 @@ static int prefix_section_verify(Prefix *p) {
p->assign = false;
}
if (p->valid_lifetime == 0)
return log_warning_errno(SYNTHETIC_ERRNO(EINVAL),
"%s: The valid lifetime of prefix cannot be zero. "
"Ignoring [IPv6Prefix] section from line %u.",
p->section->filename, p->section->line);
if (p->preferred_lifetime > p->valid_lifetime)
return log_warning_errno(SYNTHETIC_ERRNO(EINVAL),
"%s: The preferred lifetime %s is longer than the valid lifetime %s. "
@@ -854,12 +848,6 @@ static int route_prefix_section_verify(RoutePrefix *p) {
"Valid range is 0…128. Ignoring [IPv6RoutePrefix] section from line %u.",
p->section->filename, p->prefixlen, p->section->line);
if (p->lifetime == 0)
return log_warning_errno(SYNTHETIC_ERRNO(EINVAL),
"%s: The lifetime of route cannot be zero. "
"Ignoring [IPv6RoutePrefix] section from line %u.",
p->section->filename, p->section->line);
return 0;
}