]> git.ipfire.org Git - thirdparty/systemd.git/commit
resolvectl: implement --json flag for resolvectl status
authorNick Rosbrook <enr0n@ubuntu.com>
Fri, 10 Oct 2025 19:56:36 +0000 (15:56 -0400)
committerNick Rosbrook <enr0n@ubuntu.com>
Thu, 6 Nov 2025 10:17:59 +0000 (05:17 -0500)
commit0536b37629c163af268975fcc3017cad823b1e9b
tree0ae5b8d6ec3433615f1f79bbcd99f28a8cce5cf1
parent01278ceba0d16a5259b7d21433ce1c326bd671a5
resolvectl: implement --json flag for resolvectl status

Add --json support for all status commands in resolvectl by making use
of the new DumpDNSConfiguration varlink method. E.g,

$ resolvectl --json=pretty status eth0
[
{
"ifname" : "eth0",
"ifindex" : 9,
"defaultRoute" : true,
"currentServer" : {
                        "addressString" : "10.148.181.1",
"address" : [
10,
148,
181,
1
],
"family" : 2,
"port" : 53,
"ifindex" : 9,
"accessible" : true
},
"servers" : [
{
                                "addressString" : "10.148.181.1",
"address" : [
10,
148,
181,
1
],
"family" : 2,
"port" : 53,
"ifindex" : 9,
"accessible" : true
}
],
"searchDomains" : [
{
"name" : "local",
"routeOnly" : false,
"ifindex" : 9
}
],
"dnssec" : "allow-downgrade",
"dnsOverTLS" : "no",
"llmnr" : "no",
"mDNS" : "no",
"scopes" : [
{
"protocol" : "dns",
"ifindex" : 9,
"ifname" : "eth0",
"dnssec" : "allow-downgrade",
"dnsOverTLS" : "no"
}
]
}
]

Like the regular status output, fields are omitted all together when
empty, unless explicitly requested via one of the sub-commands dns,
domain, nta, etc.
src/resolve/resolvectl.c