]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network/route-nexthop: configure as a simple gateway when MultipathRoute= is specifie... 31009/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 13 Jan 2024 04:32:27 +0000 (13:32 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 19 Jan 2024 10:20:29 +0000 (19:20 +0900)
The kernel handles such configuration completely equivalent to the case
that Gateway= is specified.

src/network/networkd-route-nexthop.c

index 1524b23188d007dedd6a4fcbbb45fcf47a6ffa35..2228c6280de32067f306f738b9758cb3f22b403f 100644 (file)
@@ -873,6 +873,16 @@ int route_section_verify_nexthops(Route *route) {
                                          "Ignoring [Route] section from line %u.",
                                          route->section->filename, route->section->line);
 
+        if (ordered_set_size(route->nexthops) == 1) {
+                _cleanup_(route_nexthop_freep) RouteNextHop *nh = ordered_set_steal_first(route->nexthops);
+
+                route_nexthop_done(&route->nexthop);
+                route->nexthop = TAKE_STRUCT(*nh);
+
+                assert(ordered_set_isempty(route->nexthops));
+                route->nexthops = ordered_set_free(route->nexthops);
+        }
+
         return 0;
 }