1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-22 13:33:56 +03:00

network: fix overflow issue in address lifetime calculation

Fixes another issue reported in #20050. See
https://github.com/systemd/systemd/issues/20050#issuecomment-872967337.
This commit is contained in:
Yu Watanabe 2021-07-02 22:26:04 +09:00
parent e95ec7cd1e
commit 899034ba81

View File

@ -819,8 +819,10 @@ static int ndisc_router_process_autonomous_prefix(Link *link, sd_ndisc_router *r
r = address_get(link, address, &e);
if (r > 0) {
/* If the address is already assigned, but not valid anymore, then refuse to
* update the address. */
if (e->cinfo.tstamp / 100 + e->cinfo.ifa_valid < time_now / USEC_PER_SEC)
* update the address, and it will be removed. */
if (e->cinfo.ifa_valid != CACHE_INFO_INFINITY_LIFE_TIME &&
usec_add(e->cinfo.tstamp / 100 * USEC_PER_SEC,
e->cinfo.ifa_valid * USEC_PER_SEC) < time_now)
continue;
}