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 18c73d0a8c..2e1356ca97 100644 --- a/components/net/lwip-1.4.1/src/core/dns.c +++ b/components/net/lwip-1.4.1/src/core/dns.c @@ -279,13 +279,14 @@ dns_setserver(u8_t numdns, ip_addr_t *dnsserver) dns_servers[numdns] = (*dnsserver); #ifdef RT_USING_NETDEV - extern struct netif *netif_default; + extern struct netif *netif_list; 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); + struct netif *netif = NULL; /* set network interface device DNS server address */ - if (netif_default) { - netdev_low_level_set_dns_server(netdev_get_by_name(netif_default->name), numdns, dnsserver); + for (netif = netif_list; netif != NULL; netif = netif->next) { + netdev_low_level_set_dns_server(netdev_get_by_name(netif->name), numdns, dnsserver); } #endif /* RT_USING_NETDEV */ } 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 c793b320a4..cd4de06229 100644 --- a/components/net/lwip-2.0.2/src/core/dns.c +++ b/components/net/lwip-2.0.2/src/core/dns.c @@ -370,13 +370,14 @@ dns_setserver(u8_t numdns, const ip_addr_t *dnsserver) dns_servers[numdns] = (*dnsserver); #ifdef RT_USING_NETDEV - extern struct netif *netif_default; + extern struct netif *netif_list; 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); + struct netif *netif = NULL; /* set network interface device DNS server address */ - if (netif_default) { - netdev_low_level_set_dns_server(netdev_get_by_name(netif_default->name), numdns, dnsserver); + for (netif = netif_list; netif != NULL; netif = netif->next) { + netdev_low_level_set_dns_server(netdev_get_by_name(netif->name), numdns, dnsserver); } #endif /* RT_USING_NETDEV */ } else { 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 5129b7f3bc..c688cb2205 100644 --- a/components/net/lwip-2.1.0/src/core/dns.c +++ b/components/net/lwip-2.1.0/src/core/dns.c @@ -367,13 +367,14 @@ dns_setserver(u8_t numdns, const ip_addr_t *dnsserver) dns_servers[numdns] = (*dnsserver); #ifdef RT_USING_NETDEV - extern struct netif *netif_default; + extern struct netif *netif_list; 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); + struct netif *netif = NULL; /* set network interface device DNS server address */ - if (netif_default) { - netdev_low_level_set_dns_server(netdev_get_by_name(netif_default->name), numdns, dnsserver); + for (netif = netif_list; netif != NULL; netif = netif->next) { + netdev_low_level_set_dns_server(netdev_get_by_name(netif->name), numdns, dnsserver); } #endif /* RT_USING_NETDEV */ } else {