mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-01-02 14:58:22 +00:00
Make LWIP_DNS_SECURE and its possible values known in opt.h, remove default initialization of DNS server
This commit is contained in:
parent
fecd1bde83
commit
3312983b27
@ -85,17 +85,6 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/* A list of DNS security features follows */
|
||||
#define LWIP_DNS_SECURE_RAND_XID 1
|
||||
#define LWIP_DNS_SECURE_NO_MULTIPLE_OUTSTANDING 2
|
||||
#define LWIP_DNS_SECURE_RAND_SRC_PORT 4
|
||||
/** Use all DNS security features by default.
|
||||
* This is overridable but should only be needed by very small targets
|
||||
* or when using against non standard DNS servers. */
|
||||
#ifndef LWIP_DNS_SECURE
|
||||
#define LWIP_DNS_SECURE (LWIP_DNS_SECURE_RAND_XID | LWIP_DNS_SECURE_NO_MULTIPLE_OUTSTANDING | LWIP_DNS_SECURE_RAND_SRC_PORT)
|
||||
#endif
|
||||
|
||||
/** Random generator function to create random TXIDs and source ports for queries */
|
||||
#ifndef DNS_RAND_TXID
|
||||
#if ((LWIP_DNS_SECURE & LWIP_DNS_SECURE_RAND_XID) != 0)
|
||||
@ -111,15 +100,6 @@ static u16_t dns_txid;
|
||||
#define DNS_PORT_ALLOWED(port) ((port) >= 1024)
|
||||
#endif
|
||||
|
||||
/** DNS server IP address */
|
||||
#ifndef DNS_SERVER_ADDRESS
|
||||
#if LWIP_IPV4
|
||||
#define DNS_SERVER_ADDRESS(ipaddr) ip_addr_set_ip4_u32(ipaddr, ipaddr_addr("208.67.222.222")) /* resolver1.opendns.com */
|
||||
#else
|
||||
#define DNS_SERVER_ADDRESS(ipaddr) ipaddr_aton("2001:4860:4860::8888", ipaddr)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** DNS server port address */
|
||||
#ifndef DNS_SERVER_PORT
|
||||
#define DNS_SERVER_PORT 53
|
||||
@ -384,21 +364,23 @@ dns_stricmp(const char* str1, const char* str2)
|
||||
|
||||
/**
|
||||
* Initialize the resolver: set up the UDP pcb and configure the default server
|
||||
* (DNS_SERVER_ADDRESS).
|
||||
* (if DNS_SERVER_ADDRESS is set).
|
||||
*/
|
||||
void
|
||||
dns_init(void)
|
||||
{
|
||||
#ifdef DNS_SERVER_ADDRESS
|
||||
/* initialize default DNS server address */
|
||||
ip_addr_t dnsserver;
|
||||
DNS_SERVER_ADDRESS(&dnsserver);
|
||||
dns_setserver(0, &dnsserver);
|
||||
#endif /* DNS_SERVER_ADDRESS */
|
||||
|
||||
LWIP_ASSERT("sanity check SIZEOF_DNS_QUERY",
|
||||
sizeof(struct dns_query) == SIZEOF_DNS_QUERY);
|
||||
LWIP_ASSERT("sanity check SIZEOF_DNS_ANSWER",
|
||||
sizeof(struct dns_answer) <= SIZEOF_DNS_ANSWER_ASSERT);
|
||||
|
||||
/* initialize default DNS server address */
|
||||
DNS_SERVER_ADDRESS(&dnsserver);
|
||||
|
||||
LWIP_DEBUGF(DNS_DEBUG, ("dns_init: initializing\n"));
|
||||
|
||||
/* if dns client not yet initialized... */
|
||||
@ -417,8 +399,7 @@ dns_init(void)
|
||||
udp_recv(dns_pcbs[0], dns_recv, NULL);
|
||||
}
|
||||
#endif
|
||||
/* initialize default DNS primary server */
|
||||
dns_setserver(0, &dnsserver);
|
||||
|
||||
#if DNS_LOCAL_HOSTLIST
|
||||
dns_init_local();
|
||||
#endif
|
||||
|
@ -1023,7 +1023,10 @@
|
||||
#define DNS_MAX_NAME_LENGTH 256
|
||||
#endif
|
||||
|
||||
/** The maximum of DNS servers */
|
||||
/** The maximum of DNS servers
|
||||
* The first server can be initialized automatically by defining
|
||||
* DNS_SERVER_ADDRESS(ipaddr), where 'ipaddr' is an 'ip_addr_t*'
|
||||
*/
|
||||
#ifndef DNS_MAX_SERVERS
|
||||
#define DNS_MAX_SERVERS 2
|
||||
#endif
|
||||
@ -1033,6 +1036,18 @@
|
||||
#define DNS_DOES_NAME_CHECK 1
|
||||
#endif
|
||||
|
||||
/** LWIP_DNS_SECURE: controls the security level of the DNS implementation
|
||||
* Use all DNS security features by default.
|
||||
* This is overridable but should only be needed by very small targets
|
||||
* or when using against non standard DNS servers. */
|
||||
#ifndef LWIP_DNS_SECURE
|
||||
#define LWIP_DNS_SECURE (LWIP_DNS_SECURE_RAND_XID | LWIP_DNS_SECURE_NO_MULTIPLE_OUTSTANDING | LWIP_DNS_SECURE_RAND_SRC_PORT)
|
||||
#endif
|
||||
/* A list of DNS security features follows */
|
||||
#define LWIP_DNS_SECURE_RAND_XID 1
|
||||
#define LWIP_DNS_SECURE_NO_MULTIPLE_OUTSTANDING 2
|
||||
#define LWIP_DNS_SECURE_RAND_SRC_PORT 4
|
||||
|
||||
/** DNS_LOCAL_HOSTLIST: Implements a local host-to-address list. If enabled,
|
||||
* you have to define
|
||||
* #define DNS_LOCAL_HOSTLIST_INIT {{"host1", 0x123}, {"host2", 0x234}}
|
||||
|
Loading…
Reference in New Issue
Block a user