mirror of
https://github.com/systemd/systemd.git
synced 2026-07-22 23:41:12 +00:00
resolve: add formatted address string to DNSServer
Although the JSON output is mostly intended to be machine readable, humans also consume the output through logs and scripts. Add an addressString field to DNSServer to improve human-readability.
This commit is contained in:
@@ -1373,6 +1373,7 @@ int dns_server_dump_configuration_to_json(DnsServer *server, sd_json_variant **r
|
||||
|
||||
return sd_json_buildo(
|
||||
ret,
|
||||
JSON_BUILD_PAIR_STRING_NON_EMPTY("addressString", dns_server_string(server)),
|
||||
JSON_BUILD_PAIR_IN_ADDR("address", &server->address, server->family),
|
||||
SD_JSON_BUILD_PAIR_INTEGER("family", server->family),
|
||||
SD_JSON_BUILD_PAIR_UNSIGNED("port", dns_server_port(server)),
|
||||
|
||||
@@ -118,6 +118,8 @@ static SD_VARLINK_DEFINE_STRUCT_TYPE(
|
||||
DNSServer,
|
||||
SD_VARLINK_FIELD_COMMENT("IPv4 or IPv6 address of the server."),
|
||||
SD_VARLINK_DEFINE_FIELD(address, SD_VARLINK_INT, SD_VARLINK_ARRAY),
|
||||
SD_VARLINK_FIELD_COMMENT("IPv4 or IPv6 address of the server, formatted as a human-readable string."),
|
||||
SD_VARLINK_DEFINE_FIELD(addressString, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
|
||||
SD_VARLINK_FIELD_COMMENT("Address family of the server, one of AF_INET or AF_INET6."),
|
||||
SD_VARLINK_DEFINE_FIELD(family, SD_VARLINK_INT, 0),
|
||||
SD_VARLINK_FIELD_COMMENT("Port number of the server."),
|
||||
|
||||
Reference in New Issue
Block a user