[net][lwip] fix lwip netdev DNS address setup error

Signed-off-by: chenyong <1521761801@qq.com>
This commit is contained in:
chenyong 2019-04-22 11:11:56 +08:00
parent 9df6313537
commit f169ceb184
6 changed files with 18 additions and 6 deletions

View File

@ -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 */
}
}

View File

@ -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 <netdev.h>

View File

@ -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;

View File

@ -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 <netdev.h>

View File

@ -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;

View File

@ -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 <netdev.h>