Fix portable initialization of non-dynamic DNS_LOCAL_HOSTLIST

(cherry picked from commit 19d63e6aa0)
This commit is contained in:
goldsimon 2017-02-17 09:25:31 +01:00
parent 2ca39c275a
commit fa8b6a92b4
2 changed files with 4 additions and 5 deletions

View File

@ -76,6 +76,7 @@ struct local_hostlist_entry {
ip_addr_t addr; ip_addr_t addr;
struct local_hostlist_entry *next; struct local_hostlist_entry *next;
}; };
#define DNS_LOCAL_HOSTLIST_ELEM(name, addr_init) {name, addr_init, NULL}
#if DNS_LOCAL_HOSTLIST_IS_DYNAMIC #if DNS_LOCAL_HOSTLIST_IS_DYNAMIC
#ifndef DNS_LOCAL_HOSTLIST_MAX_NAMELEN #ifndef DNS_LOCAL_HOSTLIST_MAX_NAMELEN
#define DNS_LOCAL_HOSTLIST_MAX_NAMELEN DNS_MAX_NAME_LENGTH #define DNS_LOCAL_HOSTLIST_MAX_NAMELEN DNS_MAX_NAME_LENGTH

View File

@ -1047,11 +1047,9 @@
#define LWIP_DNS_SECURE_NO_MULTIPLE_OUTSTANDING 2 #define LWIP_DNS_SECURE_NO_MULTIPLE_OUTSTANDING 2
#define LWIP_DNS_SECURE_RAND_SRC_PORT 4 #define LWIP_DNS_SECURE_RAND_SRC_PORT 4
/** DNS_LOCAL_HOSTLIST: Implements a local host-to-address list. If enabled, /** DNS_LOCAL_HOSTLIST: Implements a local host-to-address list. If enabled, you have to define an initializer:
* you have to define * \#define DNS_LOCAL_HOSTLIST_INIT {DNS_LOCAL_HOSTLIST_ELEM("host_ip4", IPADDR4_INIT_BYTES(1,2,3,4)), \
* \#define DNS_LOCAL_HOSTLIST_INIT {{"host1", 0x123}, {"host2", 0x234}} * DNS_LOCAL_HOSTLIST_ELEM("host_ip6", IPADDR6_INIT_HOST(123, 234, 345, 456)}
* (an array of structs name/address, where address is an u32_t in network
* byte order).
* *
* Instead, you can also use an external function: * Instead, you can also use an external function:
* \#define DNS_LOOKUP_LOCAL_EXTERN(x) extern err_t my_lookup_function(const char *name, ip_addr_t *addr, u8_t dns_addrtype) * \#define DNS_LOOKUP_LOCAL_EXTERN(x) extern err_t my_lookup_function(const char *name, ip_addr_t *addr, u8_t dns_addrtype)