1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-08 21:17:47 +03:00

network: json: add src address when its prefix length is non-zero

This should not change anything. Just for consistency with
route_set_netlink_message(), which sets RTA_SRC attribute when prefix
length is non-zero.
This commit is contained in:
Yu Watanabe 2021-12-09 06:56:26 +09:00
parent 7cf0ed03f2
commit e944711fba

View File

@ -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),