]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolvectl: add --json support for status commands (#38960)
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 6 Nov 2025 14:34:10 +0000 (15:34 +0100)
committerGitHub <noreply@github.com>
Thu, 6 Nov 2025 14:34:10 +0000 (15:34 +0100)
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.

Closes https://github.com/systemd/systemd/issues/33036.


Trivial merge