summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2016-10-27 09:09:13 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2016-11-18 13:39:22 +0100
commit70fe7790852ca25a7ac65d76e1129d003c0fcba1 (patch)
treed1d1e465b3aaac583874b944e113add2e060d7b9
parent34416dd1a63c3f2836b49e0a3d822748570e9db6 (diff)
downloadNetworkManager-70fe7790852ca25a7ac65d76e1129d003c0fcba1.tar.gz
cli: add DNS information to overview output
Example: $ nmcli [...] DNS configuration: servers: 10.0.0.1 domains: foobar.com interface: tun0 type: vpn servers: 192.168.10.1 domains: home interface: ens3 servers: fd01:abcd::21 interface: ens3
-rw-r--r--clients/cli/general.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/clients/cli/general.c b/clients/cli/general.c
index 0f1d556986..90e934a490 100644
--- a/clients/cli/general.c
+++ b/clients/cli/general.c
@@ -1190,6 +1190,7 @@ do_overview (NmCli *nmc, int argc, char **argv)
const GPtrArray *p;
NMActiveConnection *ac;
NmcTermColor color;
+ NMDnsEntry *dns;
char *tmp;
int i;
@@ -1245,6 +1246,39 @@ do_overview (NmCli *nmc, int argc, char **argv)
}
g_free (devices);
+ p = nm_client_get_dns_configuration (nmc->client);
+ for (i = 0; i < p->len; i++) {
+ const char * const *strv;
+
+ dns = p->pdata[i];
+ strv = nm_dns_entry_get_nameservers (dns);
+ if (!strv || !strv[0]) {
+ /* Invalid entry */
+ continue;
+ }
+
+ if (i == 0)
+ g_print ("DNS configuration:\n");
+
+ tmp = g_strjoinv (" ", (char **) strv);
+ g_print ("\tservers: %s\n", tmp);
+ g_free (tmp);
+
+ strv = nm_dns_entry_get_domains (dns);
+ if (strv && strv[0]) {
+ tmp = g_strjoinv (" ", (char **) strv);
+ g_print ("\tdomains: %s\n", tmp);
+ g_free (tmp);
+ }
+
+ if (nm_dns_entry_get_interface (dns))
+ g_print ("\tinterface: %s\n", nm_dns_entry_get_interface (dns));
+
+ if (nm_dns_entry_get_vpn (dns))
+ g_print ("\ttype: vpn\n");
+ g_print ("\n");
+ }
+
g_print (_("Use \"nmcli device show\" to get complete information about known devices and\n"
"\"nmcli connection show\" to get an overview on active connection profiles.\n"
"\n"