Merge pull request #2596 from Lawlieta/develop

[net][lwip] fix lwip netdev DNS address setup error
This commit is contained in:
Bernard Xiong 2019-04-22 19:23:35 +08:00 committed by GitHub
commit a641540936
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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>