diff options
| author | Bernard Xiong <[email protected]> | 2015-11-09 15:25:57 +0800 |
|---|---|---|
| committer | Bernard Xiong <[email protected]> | 2015-11-09 15:25:57 +0800 |
| commit | dedc22379aebf4230e8d1183decb18f8257f9355 (patch) | |
| tree | cc3e2709d2de432226fff240129755524d6668ca /components | |
| parent | c7bd0aca21d28fdf8992cf6917676fa9ff054bff (diff) | |
| parent | 2d9540b7957583fc16b11314811559445aad6e2f (diff) | |
Merge branch 'master' of https://github.com/RT-Thread/rt-thread
Diffstat (limited to 'components')
| -rw-r--r-- | components/finsh/msh_cmd.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/components/finsh/msh_cmd.c b/components/finsh/msh_cmd.c index a4b865b028..99ca82f55d 100644 --- a/components/finsh/msh_cmd.c +++ b/components/finsh/msh_cmd.c @@ -282,6 +282,37 @@ int cmd_ifconfig(int argc, char **argv) } FINSH_FUNCTION_EXPORT_ALIAS(cmd_ifconfig, __cmd_ifconfig, list the information of network interfaces); +#ifdef RT_LWIP_DNS +#include <lwip/api.h> +#include <lwip/dns.h> +int cmd_dns(int argc, char **argv) +{ + extern void set_dns(char* dns_server); + + if (argc == 1) + { + int index; + struct ip_addr ip_addr; + for(index=0; index<DNS_MAX_SERVERS; index++) + { + ip_addr = dns_getserver(index); + rt_kprintf("dns server #%d: %s\n", index, ipaddr_ntoa(&(ip_addr))); + } + } + else if (argc == 2) + { + rt_kprintf("dns : %s\n", argv[1]); + set_dns(argv[1]); + } + else + { + rt_kprintf("bad parameter! e.g: dns 114.114.114.114\n"); + } + return 0; +} +FINSH_FUNCTION_EXPORT_ALIAS(cmd_dns, __cmd_dns, list the information of dns); +#endif + #ifdef RT_LWIP_TCP int cmd_netstat(int argc, char **argv) { |
