summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/network/networkd-json.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/network/networkd-json.c b/src/network/networkd-json.c
index aa0c606543..f2bd4982fe 100644
--- a/src/network/networkd-json.c
+++ b/src/network/networkd-json.c
@@ -299,9 +299,9 @@ static int route_build_json(Route *route, JsonVariant **ret) {
JSON_BUILD_PAIR_IN_ADDR("Destination", &route->dst, route->family),
JSON_BUILD_PAIR_UNSIGNED("DestinationPrefixLength", route->dst_prefixlen),
JSON_BUILD_PAIR_IN_ADDR_NON_NULL("Gateway", &route->gw, route->gw_family),
- JSON_BUILD_PAIR_IN_ADDR_NON_NULL("Source", &route->src, route->family),
- JSON_BUILD_PAIR_CONDITION(in_addr_is_set(route->family, &route->src),
- "SourcePrefixLength", JSON_BUILD_UNSIGNED(route->src_prefixlen)),
+ JSON_BUILD_PAIR_CONDITION(route->src_prefixlen > 0,
+ "Source", JSON_BUILD_IN_ADDR(&route->src, route->family)),
+ JSON_BUILD_PAIR_UNSIGNED_NON_ZERO("SourcePrefixLength", route->src_prefixlen),
JSON_BUILD_PAIR_IN_ADDR_NON_NULL("PreferredSource", &route->prefsrc, route->family),
JSON_BUILD_PAIR_UNSIGNED("Scope", route->scope),
JSON_BUILD_PAIR_STRING("ScopeString", scope),