[components/net] add dns server ip address config, may custom in menuconfig
Signed-off-by: MurphyZhao <d2014zjt@163.com>
This commit is contained in:
parent
f29cc0dba4
commit
c0587d0407
|
@ -217,7 +217,17 @@ config LWIP_USING_DHCPD
|
||||||
config DHCPD_USING_ROUTER
|
config DHCPD_USING_ROUTER
|
||||||
bool "alloc gateway ip for router"
|
bool "alloc gateway ip for router"
|
||||||
default y
|
default y
|
||||||
|
|
||||||
|
config LWIP_USING_CUSTOMER_DNS_SERVER
|
||||||
|
bool "Enable customer DNS server config"
|
||||||
|
default n
|
||||||
|
if LWIP_USING_CUSTOMER_DNS_SERVER
|
||||||
|
config DHCP_DNS_SERVER_IP
|
||||||
|
string "Custom DNS server IP address"
|
||||||
|
default 1.1.1.1
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -434,10 +434,25 @@ static void dhcpd_thread_entry(void *parameter)
|
||||||
// DHCP_OPTION_DNS_SERVER, use the default DNS server address in lwIP
|
// DHCP_OPTION_DNS_SERVER, use the default DNS server address in lwIP
|
||||||
*dhcp_opt++ = DHCP_OPTION_DNS_SERVER;
|
*dhcp_opt++ = DHCP_OPTION_DNS_SERVER;
|
||||||
*dhcp_opt++ = 4;
|
*dhcp_opt++ = 4;
|
||||||
*dhcp_opt++ = 208;
|
|
||||||
*dhcp_opt++ = 67;
|
#ifndef DHCP_DNS_SERVER_IP
|
||||||
*dhcp_opt++ = 222;
|
*dhcp_opt++ = DHCPD_SERVER_IPADDR0;
|
||||||
*dhcp_opt++ = 222;
|
*dhcp_opt++ = DHCPD_SERVER_IPADDR1;
|
||||||
|
*dhcp_opt++ = DHCPD_SERVER_IPADDR2;
|
||||||
|
*dhcp_opt++ = 1;
|
||||||
|
#else
|
||||||
|
struct ip_addr dns_addr;
|
||||||
|
ip4addr_aton(DHCP_DNS_SERVER_IP, &dns_addr);
|
||||||
|
DNS_SERVER_IPADDR0 = (ntohl(dns_addr.addr) >> 24) & 0xFF;
|
||||||
|
DNS_SERVER_IPADDR1 = (ntohl(dns_addr.addr) >> 16) & 0xFF;
|
||||||
|
DNS_SERVER_IPADDR2 = (ntohl(dns_addr.addr) >> 8) & 0xFF;
|
||||||
|
DNS_SERVER_IPADDR3 = (ntohl(dns_addr.addr) >> 0) & 0xFF;
|
||||||
|
|
||||||
|
*dhcp_opt++ = DNS_SERVER_IPADDR0;
|
||||||
|
*dhcp_opt++ = DNS_SERVER_IPADDR1;
|
||||||
|
*dhcp_opt++ = DNS_SERVER_IPADDR2;
|
||||||
|
*dhcp_opt++ = DNS_SERVER_IPADDR3;
|
||||||
|
#endif
|
||||||
|
|
||||||
// DHCP_OPTION_LEASE_TIME
|
// DHCP_OPTION_LEASE_TIME
|
||||||
*dhcp_opt++ = DHCP_OPTION_LEASE_TIME;
|
*dhcp_opt++ = DHCP_OPTION_LEASE_TIME;
|
||||||
|
|
Loading…
Reference in New Issue