[net][lwip] fix lwip netdev DNS address setup error
Signed-off-by: chenyong <1521761801@qq.com>
This commit is contained in:
parent
9df6313537
commit
f169ceb184
|
@ -279,11 +279,14 @@ dns_setserver(u8_t numdns, ip_addr_t *dnsserver)
|
||||||
dns_servers[numdns] = (*dnsserver);
|
dns_servers[numdns] = (*dnsserver);
|
||||||
|
|
||||||
#ifdef RT_USING_NETDEV
|
#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);
|
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 */
|
/* 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 */
|
#endif /* RT_USING_NETDEV */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,6 +99,7 @@ static char eth_rx_thread_stack[RT_LWIP_ETHTHREAD_STACKSIZE];
|
||||||
|
|
||||||
#ifdef RT_USING_NETDEV
|
#ifdef RT_USING_NETDEV
|
||||||
|
|
||||||
|
#include "lwip/ip.h"
|
||||||
#include "lwip/init.h"
|
#include "lwip/init.h"
|
||||||
#include "lwip/netdb.h"
|
#include "lwip/netdb.h"
|
||||||
#include <netdev.h>
|
#include <netdev.h>
|
||||||
|
|
|
@ -370,11 +370,14 @@ dns_setserver(u8_t numdns, const ip_addr_t *dnsserver)
|
||||||
dns_servers[numdns] = (*dnsserver);
|
dns_servers[numdns] = (*dnsserver);
|
||||||
|
|
||||||
#ifdef RT_USING_NETDEV
|
#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);
|
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 */
|
/* 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 */
|
#endif /* RT_USING_NETDEV */
|
||||||
} else {
|
} else {
|
||||||
dns_servers[numdns] = *IP_ADDR_ANY;
|
dns_servers[numdns] = *IP_ADDR_ANY;
|
||||||
|
|
|
@ -107,6 +107,7 @@ static char eth_rx_thread_stack[RT_LWIP_ETHTHREAD_STACKSIZE];
|
||||||
|
|
||||||
#ifdef RT_USING_NETDEV
|
#ifdef RT_USING_NETDEV
|
||||||
|
|
||||||
|
#include "lwip/ip.h"
|
||||||
#include "lwip/init.h"
|
#include "lwip/init.h"
|
||||||
#include "lwip/netdb.h"
|
#include "lwip/netdb.h"
|
||||||
#include <netdev.h>
|
#include <netdev.h>
|
||||||
|
|
|
@ -367,11 +367,14 @@ dns_setserver(u8_t numdns, const ip_addr_t *dnsserver)
|
||||||
dns_servers[numdns] = (*dnsserver);
|
dns_servers[numdns] = (*dnsserver);
|
||||||
|
|
||||||
#ifdef RT_USING_NETDEV
|
#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);
|
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 */
|
/* 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 */
|
#endif /* RT_USING_NETDEV */
|
||||||
} else {
|
} else {
|
||||||
dns_servers[numdns] = *IP_ADDR_ANY;
|
dns_servers[numdns] = *IP_ADDR_ANY;
|
||||||
|
|
|
@ -108,6 +108,7 @@ static char eth_rx_thread_stack[RT_LWIP_ETHTHREAD_STACKSIZE];
|
||||||
|
|
||||||
#ifdef RT_USING_NETDEV
|
#ifdef RT_USING_NETDEV
|
||||||
|
|
||||||
|
#include "lwip/ip.h"
|
||||||
#include "lwip/init.h"
|
#include "lwip/init.h"
|
||||||
#include "lwip/netdb.h"
|
#include "lwip/netdb.h"
|
||||||
#include <netdev.h>
|
#include <netdev.h>
|
||||||
|
|
Loading…
Reference in New Issue