]> git.ipfire.org Git - thirdparty/systemd.git/commit
networkd-json: add human-readable address strings for IP addresses
authorgvenugo3 <gvenugo3@asu.edu>
Fri, 23 Jan 2026 02:38:30 +0000 (19:38 -0700)
committerLennart Poettering <lennart@poettering.net>
Wed, 4 Feb 2026 09:34:30 +0000 (10:34 +0100)
commitcf27c70d70f5912078f68b66869d16198aaa36a5
tree4898020b03daf0b709e52a55c09b7e34e81a5fa7
parent13d82876f5704deae72e0a341cfd39153a67bc64
networkd-json: add human-readable address strings for IP addresses

Add JSON_BUILD_PAIR_IN_ADDR_WITH_STRING, JSON_BUILD_PAIR_IN6_ADDR_WITH_STRING,
and JSON_BUILD_PAIR_IN4_ADDR_WITH_STRING macros (plus _NON_NULL variants) that
emit both the binary address array and a human-readable string representation.

For example, an address field now emits both:
  "Address": [192, 168, 1, 1]
  "AddressString": "192.168.1.1"

This improves usability of the JSON/Varlink output for debugging and tooling
that consumes networkd state.

Updated networkd-json.c to use these new macros for addresses, neighbors,
nexthops, routes, routing policy rules, DNS servers, NTP servers, SIP servers,
domains, DHCPv6 prefixes, and link-local addresses.

Also updated the Varlink interface definitions to include the new string fields.
src/libsystemd-network/sd-dhcp-server-lease.c
src/libsystemd/sd-json/json-util.h
src/libsystemd/sd-json/sd-json.c
src/network/networkd-json.c
src/shared/varlink-io.systemd.Network.c