diff --git a/components/net/lwip-1.4.1/src/core/dns.c b/components/net/lwip-1.4.1/src/core/dns.c index 20398ae609..18c73d0a8c 100644 --- a/components/net/lwip-1.4.1/src/core/dns.c +++ b/components/net/lwip-1.4.1/src/core/dns.c @@ -279,11 +279,14 @@ dns_setserver(u8_t numdns, ip_addr_t *dnsserver) dns_servers[numdns] = (*dnsserver); #ifdef RT_USING_NETDEV - extern struct netdev *netdev_default; + extern struct netif *netif_default; + extern struct netdev *netdev_get_by_name(const char *name); extern void netdev_low_level_set_dns_server(struct netdev *netdev, uint8_t dns_num, const ip_addr_t *dns_server); /* set network interface device DNS server address */ - netdev_low_level_set_dns_server(netdev_default, numdns, dnsserver); + if (netif_default) { + netdev_low_level_set_dns_server(netdev_get_by_name(netif_default->name), numdns, dnsserver); + } #endif /* RT_USING_NETDEV */ } } diff --git a/components/net/lwip-1.4.1/src/netif/ethernetif.c b/components/net/lwip-1.4.1/src/netif/ethernetif.c index dfe304f91d..7508ea0b87 100644 --- a/components/net/lwip-1.4.1/src/netif/ethernetif.c +++ b/components/net/lwip-1.4.1/src/netif/ethernetif.c @@ -99,6 +99,7 @@ static char eth_rx_thread_stack[RT_LWIP_ETHTHREAD_STACKSIZE]; #ifdef RT_USING_NETDEV +#include "lwip/ip.h" #include "lwip/init.h" #include "lwip/netdb.h" #include diff --git a/components/net/lwip-2.0.2/src/core/dns.c b/components/net/lwip-2.0.2/src/core/dns.c index 5f8c3e52e3..c793b320a4 100644 --- a/components/net/lwip-2.0.2/src/core/dns.c +++ b/components/net/lwip-2.0.2/src/core/dns.c @@ -370,11 +370,14 @@ dns_setserver(u8_t numdns, const ip_addr_t *dnsserver) dns_servers[numdns] = (*dnsserver); #ifdef RT_USING_NETDEV - extern struct netdev *netdev_default; + extern struct netif *netif_default; + extern struct netdev *netdev_get_by_name(const char *name); extern void netdev_low_level_set_dns_server(struct netdev *netdev, uint8_t dns_num, const ip_addr_t *dns_server); /* set network interface device DNS server address */ - netdev_low_level_set_dns_server(netdev_default, numdns, dnsserver); + if (netif_default) { + netdev_low_level_set_dns_server(netdev_get_by_name(netif_default->name), numdns, dnsserver); + } #endif /* RT_USING_NETDEV */ } else { dns_servers[numdns] = *IP_ADDR_ANY; diff --git a/components/net/lwip-2.0.2/src/netif/ethernetif.c b/components/net/lwip-2.0.2/src/netif/ethernetif.c index 6e0eb1eed7..38e46de046 100644 --- a/components/net/lwip-2.0.2/src/netif/ethernetif.c +++ b/components/net/lwip-2.0.2/src/netif/ethernetif.c @@ -107,6 +107,7 @@ static char eth_rx_thread_stack[RT_LWIP_ETHTHREAD_STACKSIZE]; #ifdef RT_USING_NETDEV +#include "lwip/ip.h" #include "lwip/init.h" #include "lwip/netdb.h" #include diff --git a/components/net/lwip-2.1.0/src/core/dns.c b/components/net/lwip-2.1.0/src/core/dns.c index 831956f711..5129b7f3bc 100644 --- a/components/net/lwip-2.1.0/src/core/dns.c +++ b/components/net/lwip-2.1.0/src/core/dns.c @@ -367,11 +367,14 @@ dns_setserver(u8_t numdns, const ip_addr_t *dnsserver) dns_servers[numdns] = (*dnsserver); #ifdef RT_USING_NETDEV - extern struct netdev *netdev_default; + extern struct netif *netif_default; + extern struct netdev *netdev_get_by_name(const char *name); extern void netdev_low_level_set_dns_server(struct netdev *netdev, uint8_t dns_num, const ip_addr_t *dns_server); /* set network interface device DNS server address */ - netdev_low_level_set_dns_server(netdev_default, numdns, dnsserver); + if (netif_default) { + netdev_low_level_set_dns_server(netdev_get_by_name(netif_default->name), numdns, dnsserver); + } #endif /* RT_USING_NETDEV */ } else { dns_servers[numdns] = *IP_ADDR_ANY; diff --git a/components/net/lwip-2.1.0/src/netif/ethernetif.c b/components/net/lwip-2.1.0/src/netif/ethernetif.c index 655f2864be..fd9db058e0 100755 --- a/components/net/lwip-2.1.0/src/netif/ethernetif.c +++ b/components/net/lwip-2.1.0/src/netif/ethernetif.c @@ -108,6 +108,7 @@ static char eth_rx_thread_stack[RT_LWIP_ETHTHREAD_STACKSIZE]; #ifdef RT_USING_NETDEV +#include "lwip/ip.h" #include "lwip/init.h" #include "lwip/netdb.h" #include