]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: route: show prefix length of the source in debugging logs
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 8 Dec 2021 21:51:29 +0000 (06:51 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 8 Dec 2021 21:52:01 +0000 (06:52 +0900)
Similar fix to b489d6a26e44d430a997e756ac81767f6e646976.

src/network/networkd-route.c

index 82873e9a91624fc823404e533bb01bea26595fa4..0693cbdee44b8909a3f76c7b62d0d710e4ea0f36 100644 (file)
@@ -560,8 +560,8 @@ static void log_route_debug(const Route *route, const char *str, const Link *lin
         (void) network_config_state_to_string_alloc(route->state, &state);
         if (in_addr_is_set(route->family, &route->dst) || route->dst_prefixlen > 0)
                 (void) in_addr_prefix_to_string(route->family, &route->dst, route->dst_prefixlen, &dst);
-        if (in_addr_is_set(route->family, &route->src))
-                (void) in_addr_to_string(route->family, &route->src, &src);
+        if (in_addr_is_set(route->family, &route->src) || route->src_prefixlen > 0)
+                (void) in_addr_prefix_to_string(route->family, &route->src, route->src_prefixlen, &src);
         if (in_addr_is_set(route->gw_family, &route->gw)) {
                 (void) in_addr_to_string(route->gw_family, &route->gw, &gw_alloc);
                 gw = gw_alloc;