From 19d63e6aa07d17897a156dee1fc33a5b75f39234 Mon Sep 17 00:00:00 2001 From: goldsimon Date: Fri, 17 Feb 2017 09:25:31 +0100 Subject: [PATCH] Fix portable initialization of non-dynamic DNS_LOCAL_HOSTLIST --- src/include/lwip/dns.h | 1 + src/include/lwip/opt.h | 8 +++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/include/lwip/dns.h b/src/include/lwip/dns.h index 2d147afa..3c9a7a42 100644 --- a/src/include/lwip/dns.h +++ b/src/include/lwip/dns.h @@ -76,6 +76,7 @@ struct local_hostlist_entry { ip_addr_t addr; struct local_hostlist_entry *next; }; +#define DNS_LOCAL_HOSTLIST_ELEM(name, addr_init) {name, addr_init, NULL} #if DNS_LOCAL_HOSTLIST_IS_DYNAMIC #ifndef DNS_LOCAL_HOSTLIST_MAX_NAMELEN #define DNS_LOCAL_HOSTLIST_MAX_NAMELEN DNS_MAX_NAME_LENGTH diff --git a/src/include/lwip/opt.h b/src/include/lwip/opt.h index 17a995b2..78c36e48 100644 --- a/src/include/lwip/opt.h +++ b/src/include/lwip/opt.h @@ -1070,11 +1070,9 @@ #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}} - * (an array of structs name/address, where address is an u32_t in network - * byte order). +/** DNS_LOCAL_HOSTLIST: Implements a local host-to-address list. If enabled, you have to define an initializer: + * \#define DNS_LOCAL_HOSTLIST_INIT {DNS_LOCAL_HOSTLIST_ELEM("host_ip4", IPADDR4_INIT_BYTES(1,2,3,4)), \ + * DNS_LOCAL_HOSTLIST_ELEM("host_ip6", IPADDR6_INIT_HOST(123, 234, 345, 456)} * * 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)