From: Nick Rosbrook Date: Fri, 6 Feb 2026 16:38:47 +0000 (-0500) Subject: resolvectl: include ifindex when printing link-local DNS server X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e28958315f371d4db349fc99f04c5adfb7edaea6;p=thirdparty%2Fsystemd.git resolvectl: include ifindex when printing link-local DNS server Historically, resolvectl status has not included the interface specification for DNS servers with an IPv6 link-local address, since it is technically somewhat redundant. But, adding this extra bit of information makes it easier to copy-and-paste to use elsewhere, etc. For example, the previous output: Link 2 (enp34s0) Current Scopes: DNS LLMNR/IPv4 LLMNR/IPv6 Protocols: +DefaultRoute LLMNR=resolve -mDNS -DNSOverTLS DNSSEC=no/unsupported Current DNS Server: fe80::861e:a3ff:feb1:f8e7 DNS Servers: 192.168.1.12 192.168.1.13 fe80::861e:a3ff:feb1:f8e7 DNS Domain: lan now becomes: Link 2 (enp34s0) Current Scopes: DNS LLMNR/IPv4 LLMNR/IPv6 Protocols: +DefaultRoute LLMNR=resolve -mDNS -DNSOverTLS DNSSEC=no/unsupported Current DNS Server: fe80::861e:a3ff:feb1:f8e7%2 DNS Servers: 192.168.1.12 192.168.1.13 fe80::861e:a3ff:feb1:f8e7%2 DNS Domain: lan --- diff --git a/src/resolve/resolvectl.c b/src/resolve/resolvectl.c index 9f5616c2721..8d887b1fcef 100644 --- a/src/resolve/resolvectl.c +++ b/src/resolve/resolvectl.c @@ -1584,14 +1584,13 @@ static int varlink_dump_dns_configuration(sd_json_variant **ret) { } static int format_dns_server_one(DNSConfiguration *configuration, DNSServer *s, char **ret) { - bool global, with_ifindex; + bool global; int r; assert(s); assert(ret); global = !(configuration->ifindex > 0 || configuration->delegate); - with_ifindex = configuration->ifindex <= 0; if (global && s->ifindex > 0 && s->ifindex != LOOPBACK_IFINDEX) { /* This one has an (non-loopback) ifindex set, and we were told to suppress those. Hence do so. */ @@ -1603,7 +1602,7 @@ static int format_dns_server_one(DNSConfiguration *configuration, DNSServer *s, s->family, &s->in_addr, s->port != 53 ? s->port : 0, - with_ifindex ? s->ifindex : 0, + s->ifindex, s->server_name, ret); if (r < 0)