mirror of
https://github.com/systemd/systemd.git
synced 2025-09-01 13:59:26 +03:00
resolvectl: sort domain/nta output
dns list shall not be sorted.
This commit is contained in:
@ -1299,6 +1299,8 @@ static int map_link_domains(sd_bus *bus, const char *member, sd_bus_message *m,
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
strv_sort(*l);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1417,7 +1419,7 @@ static int status_ifindex(sd_bus *bus, int ifindex, const char *name, StatusMode
|
|||||||
{ "MulticastDNS", "s", NULL, offsetof(LinkInfo, mdns) },
|
{ "MulticastDNS", "s", NULL, offsetof(LinkInfo, mdns) },
|
||||||
{ "DNSOverTLS", "s", NULL, offsetof(LinkInfo, dns_over_tls) },
|
{ "DNSOverTLS", "s", NULL, offsetof(LinkInfo, dns_over_tls) },
|
||||||
{ "DNSSEC", "s", NULL, offsetof(LinkInfo, dnssec) },
|
{ "DNSSEC", "s", NULL, offsetof(LinkInfo, dnssec) },
|
||||||
{ "DNSSECNegativeTrustAnchors", "as", NULL, offsetof(LinkInfo, ntas) },
|
{ "DNSSECNegativeTrustAnchors", "as", bus_map_strv_sort, offsetof(LinkInfo, ntas) },
|
||||||
{ "DNSSECSupported", "b", NULL, offsetof(LinkInfo, dnssec_supported) },
|
{ "DNSSECSupported", "b", NULL, offsetof(LinkInfo, dnssec_supported) },
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
@ -1682,6 +1684,8 @@ static int map_global_domains(sd_bus *bus, const char *member, sd_bus_message *m
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
strv_sort(*l);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1694,7 +1698,7 @@ static int status_global(sd_bus *bus, StatusMode mode, bool *empty_line) {
|
|||||||
{ "CurrentDNSServer", "(iiay)", map_global_current_dns_server, offsetof(GlobalInfo, current_dns) },
|
{ "CurrentDNSServer", "(iiay)", map_global_current_dns_server, offsetof(GlobalInfo, current_dns) },
|
||||||
{ "CurrentDNSServerEx", "(iiayqs)", map_global_current_dns_server_ex, offsetof(GlobalInfo, current_dns_ex) },
|
{ "CurrentDNSServerEx", "(iiayqs)", map_global_current_dns_server_ex, offsetof(GlobalInfo, current_dns_ex) },
|
||||||
{ "Domains", "a(isb)", map_global_domains, offsetof(GlobalInfo, domains) },
|
{ "Domains", "a(isb)", map_global_domains, offsetof(GlobalInfo, domains) },
|
||||||
{ "DNSSECNegativeTrustAnchors", "as", NULL, offsetof(GlobalInfo, ntas) },
|
{ "DNSSECNegativeTrustAnchors", "as", bus_map_strv_sort, offsetof(GlobalInfo, ntas) },
|
||||||
{ "LLMNR", "s", NULL, offsetof(GlobalInfo, llmnr) },
|
{ "LLMNR", "s", NULL, offsetof(GlobalInfo, llmnr) },
|
||||||
{ "MulticastDNS", "s", NULL, offsetof(GlobalInfo, mdns) },
|
{ "MulticastDNS", "s", NULL, offsetof(GlobalInfo, mdns) },
|
||||||
{ "DNSOverTLS", "s", NULL, offsetof(GlobalInfo, dns_over_tls) },
|
{ "DNSOverTLS", "s", NULL, offsetof(GlobalInfo, dns_over_tls) },
|
||||||
|
@ -25,6 +25,23 @@ int bus_map_id128(sd_bus *bus, const char *member, sd_bus_message *m, sd_bus_err
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int bus_map_strv_sort(sd_bus *bus, const char *member, sd_bus_message *m, sd_bus_error *error, void *userdata) {
|
||||||
|
_cleanup_strv_free_ char **l = NULL;
|
||||||
|
char ***p = userdata;
|
||||||
|
int r;
|
||||||
|
|
||||||
|
r = bus_message_read_strv_extend(m, &l);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
|
r = strv_extend_strv(p, l, false);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
|
strv_sort(*p);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int map_basic(sd_bus *bus, const char *member, sd_bus_message *m, unsigned flags, sd_bus_error *error, void *userdata) {
|
static int map_basic(sd_bus *bus, const char *member, sd_bus_message *m, unsigned flags, sd_bus_error *error, void *userdata) {
|
||||||
char type;
|
char type;
|
||||||
int r;
|
int r;
|
||||||
|
@ -18,6 +18,7 @@ enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
int bus_map_id128(sd_bus *bus, const char *member, sd_bus_message *m, sd_bus_error *error, void *userdata);
|
int bus_map_id128(sd_bus *bus, const char *member, sd_bus_message *m, sd_bus_error *error, void *userdata);
|
||||||
|
int bus_map_strv_sort(sd_bus *bus, const char *member, sd_bus_message *m, sd_bus_error *error, void *userdata);
|
||||||
|
|
||||||
int bus_message_map_all_properties(sd_bus_message *m, const struct bus_properties_map *map, unsigned flags, sd_bus_error *error, void *userdata);
|
int bus_message_map_all_properties(sd_bus_message *m, const struct bus_properties_map *map, unsigned flags, sd_bus_error *error, void *userdata);
|
||||||
int bus_map_all_properties(sd_bus *bus, const char *destination, const char *path, const struct bus_properties_map *map,
|
int bus_map_all_properties(sd_bus *bus, const char *destination, const char *path, const struct bus_properties_map *map,
|
||||||
|
Reference in New Issue
Block a user