summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author[email protected] <[email protected]>2015-11-04 09:37:38 +0800
committer[email protected] <[email protected]>2015-11-04 09:37:38 +0800
commit86f1d4f19b5bbf6cb4cbd31f5e28137bd11e23ab (patch)
treee00763428dbd5587fd99dd17a7c24a747c0d45cb
parent59653699b2ba092c932d0b183cac4a06ea5f7c07 (diff)
msh中增加了dns的配置函数
-rw-r--r--components/finsh/msh_cmd.c31
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)
{