[finsh] Add lwip 2.0.0 support.

This commit is contained in:
bernard 2017-01-31 13:17:34 +08:00
parent b4757b950f
commit c53389e46f
1 changed files with 15 additions and 2 deletions

View File

@ -314,6 +314,9 @@ FINSH_FUNCTION_EXPORT_ALIAS(cmd_ifconfig, __cmd_ifconfig, list the information o
#ifdef RT_LWIP_DNS #ifdef RT_LWIP_DNS
#include <lwip/api.h> #include <lwip/api.h>
#include <lwip/dns.h> #include <lwip/dns.h>
#include <lwip/ip_addr.h>
#include <lwip/init.h>
int cmd_dns(int argc, char **argv) int cmd_dns(int argc, char **argv)
{ {
extern void set_dns(char* dns_server); extern void set_dns(char* dns_server);
@ -321,12 +324,22 @@ int cmd_dns(int argc, char **argv)
if (argc == 1) if (argc == 1)
{ {
int index; int index;
struct ip_addr ip_addr;
#if (LWIP_VERSION) < 0x02000000U
ip_addr_t ip_addr;
for(index=0; index<DNS_MAX_SERVERS; index++) for(index=0; index<DNS_MAX_SERVERS; index++)
{ {
ip_addr = dns_getserver(index); ip_addr = dns_getserver(index);
rt_kprintf("dns server #%d: %s\n", index, ipaddr_ntoa(&(ip_addr))); rt_kprintf("dns server #%d: %s\n", index, ipaddr_ntoa(&ip_addr));
} }
#else
const ip_addr_t *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));
}
#endif
} }
else if (argc == 2) else if (argc == 2)
{ {