From: Yu Watanabe Date: Sun, 1 Sep 2024 02:09:45 +0000 (+0900) Subject: network/route: also show weight of gateway in debugging logs X-Git-Tag: v257-rc1~578^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0074a7d8c0a7e71d8194035ccc8eeaeed8838cee;p=thirdparty%2Fsystemd.git network/route: also show weight of gateway in debugging logs --- diff --git a/src/network/networkd-route-nexthop.c b/src/network/networkd-route-nexthop.c index f2d976beb15..ee837d73fa5 100644 --- a/src/network/networkd-route-nexthop.c +++ b/src/network/networkd-route-nexthop.c @@ -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)