]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/network/networkd-dhcp-prefix-delegation.c
network/route: convert route before requesting
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 16 Jan 2024 13:36:29 +0000 (22:36 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 19 Jan 2024 10:20:29 +0000 (19:20 +0900)
commit5a18697d61047e8c189bd280b6748f1159dcc385
treef549016d01f0e2704c812682f1d47ea683100e20
parented6a7148f409bce0d24ba52a82a4da8b64ee7d08
network/route: convert route before requesting

Previously,
1. use the passed Route object as is when a route is requested,
2. when the route becomes ready to configure, convert the Route object
   if necessary, to resolve outgoing interface name, and split multipath
   routes, and save them to the associated interfaces,
3. configure the route with the passed Route object.

However, there are several inconsistencies with what kernel does:
- The kernel does not merge nor split IPv4 multipath routes. However, we
  unconditionally split multipath routes to manage.
- The kernel does not set gateway or so to a route if it has nexthop ID.

Fortunately, I do not find any issues caused by the inconsistencies. But
for safety, let's manage routes in a consistent way with the kernel.

This makes,
1. when a route is requested, split IPv6 multipath routes, but keep IPv4
   multipath routes as is, and queue (possibly multiple) requests for
   the route.
2. when the route becomes ready to configure, resolve nexthop and interface
   name, and requeue request if necessary.
3. configure the (possibly split) route.

By using the logic,
- Now we manage routes in a mostly consistent way with the kernel.
- We can drop ConvertedRoutes object.
- Hopefully the code becomes much simpler.
src/network/networkd-dhcp-prefix-delegation.c
src/network/networkd-dhcp4.c
src/network/networkd-ndisc.c
src/network/networkd-queue.c
src/network/networkd-route-nexthop.c
src/network/networkd-route.c
src/network/networkd-route.h