network/ndisc: use router lifetime as one for redirect route
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 3 Jun 2024 20:29:59 +0000 (05:29 +0900)
committerLuca Boccassi <luca.boccassi@gmail.com>
Thu, 6 Jun 2024 10:19:55 +0000 (11:19 +0100)
commit01420b2db512002cba0600e1d2b4d690efa66688
tree3d3e2105a799b297265e7122e022834b91730443
parent02f35b1c905ac63ba62f94efebf858412e961fc1
network/ndisc: use router lifetime as one for redirect route

Previously, we did not set lifetime for redirect route, and redirect
routes were removed only when received a RA from the target address.
Thus, routes that redirect on-link addresses were never removed.

RFCs mention nothing about the lifetime of redirection. But the previous
implementation does not pass the IPv6 Core Conformance Tests.

This makes
- remember all received RAs and manage them by the sender address
  (previously, remembered only one with the highest preference),
- then use the router lifetime as one for redirect route,
- remove redirect route also when the router corresponds to the sender
  address is dropped (previously, considered only target address).

Note, even if we recieve a new RA, we do not update existing redirect
routes. The lifetime of the redirect route is updated only when a new
Redirect message is received.

Closes #32527.
src/network/networkd-link.h
src/network/networkd-ndisc.c
test/test-network/systemd-networkd-tests.py