summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-08-12 15:05:21 +0200
committerLennart Poettering <lennart@poettering.net>2014-08-12 15:06:51 +0200
commit03cc0fd1431b82e59c11ae12a274c1f2df23169d (patch)
treeeae515ef2bcdb6cd8b1c19d1dee5668a43202c66 /src/network
parentf01e5736f1555eec9183e48448fa3454f265b73e (diff)
sd-network: add API to output all collected system-wide NTP and DNS servers
Also, output the collected information in "networkctl".
Diffstat (limited to 'src/network')
-rw-r--r--src/network/networkctl.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/network/networkctl.c b/src/network/networkctl.c
index 93b1293457..d5d3c80a3c 100644
--- a/src/network/networkctl.c
+++ b/src/network/networkctl.c
@@ -216,14 +216,20 @@ static int link_status(char **args, unsigned n) {
if (n <= 1) {
_cleanup_free_ char *operational_state = NULL;
+ _cleanup_strv_free_ char **dns = NULL, **ntp = NULL;
- r = sd_network_get_operational_state(&operational_state);
- if (r < 0) {
- log_error("Failed to get operational state: %s", strerror(-r));
- return r;
- }
+ sd_network_get_operational_state(&operational_state);
+ if (operational_state)
+ printf(" State: %s\n", operational_state);
+
+ sd_network_get_dns(&dns);
+ if (!strv_isempty(dns))
+ dump_list(" DNS: ", dns);
+
+ sd_network_get_dns(&ntp);
+ if (!strv_isempty(ntp))
+ dump_list(" NTP: ", ntp);
- printf("State: %s\n", operational_state);
return 0;
}
@@ -312,7 +318,7 @@ static int link_status(char **args, unsigned n) {
sd_network_get_link_operational_state(canonical_ifindex, &operational_state);
sd_network_get_link_dns(canonical_ifindex, &dns);
- sd_network_get_link_dns(canonical_ifindex, &ntp);
+ sd_network_get_link_ntp(canonical_ifindex, &ntp);
sprintf(devid, "n%i", canonical_ifindex);
d = udev_device_new_from_device_id(udev, devid);