]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network/route: also show weight of gateway in debugging logs
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 1 Sep 2024 02:09:45 +0000 (11:09 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 1 Sep 2024 02:54:32 +0000 (11:54 +0900)
src/network/networkd-route-nexthop.c

index f2d976beb15b8130b21e6693e2670558c0af536b..ee837d73fa589f45ddd91cbc808029e5865863d0 100644 (file)
@@ -478,9 +478,10 @@ int route_nexthops_to_string(const Route *route, char **ret) {
         }
 
         if (ordered_set_isempty(route->nexthops)) {
-                if (in_addr_is_set(route->nexthop.family, &route->nexthop.gw))
-                        buf = strjoin("gw: ", IN_ADDR_TO_STRING(route->nexthop.family, &route->nexthop.gw));
-                else if (route->gateway_from_dhcp_or_ra) {
+                if (in_addr_is_set(route->nexthop.family, &route->nexthop.gw)) {
+                        if (asprintf(&buf, "gw: %s:%"PRIu32, IN_ADDR_TO_STRING(route->nexthop.family, &route->nexthop.gw), route->nexthop.weight + 1) < 0)
+                                return -ENOMEM;
+                } else if (route->gateway_from_dhcp_or_ra) {
                         if (route->nexthop.family == AF_INET)
                                 buf = strdup("gw: _dhcp4");
                         else if (route->nexthop.family == AF_INET6)