lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-devel] DNS_SERVER_ADDRESS() macro for core/dns.c


From: Gisle Vanem
Subject: [lwip-devel] DNS_SERVER_ADDRESS() macro for core/dns.c
Date: Fri, 8 Apr 2016 11:59:14 +0200
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0

The DNS_SERVER_ADDRESS() macro (as I've used for a long time, see below)
in in core/dns.c:

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 */

now causes this compile error here:
  ../../src/core/dns.c(377): error C2039: 'addr': is not a member of '_ip_addr'
  f:\MingW32\src\inet\lwip\src\include\lwip/ip_addr.h(54): note: see 
declaration of '_ip_addr'

The above error is with this:
  #define DNS_SERVER_ADDRESS(ipaddr)   \
          (ip4_addr_set_u32(ipaddr, ipaddr_addr("8.8.8.8"))) /* 
google-public-dns-a.google.com */

Since I'm not really interested in IPv6, I wrote it as:
  #define DNS_SERVER_ADDRESS(a) \
          do {                  \
            *(u32_t*) &(a)->u_addr.ip4 = ipaddr_addr("8.8.8.8"); /* 
google-public-dns-a.google.com */ \
            (a)->type = IPADDR_TYPE_V4; \
          } while (0)

There must be better way, no? I'm really confused about all those IP[4|6] 
macros.

PS. I'm on Win-10 trying to build lwIP (fresh from yesterdays Git)
  using MSVC-2015. And I do build with 'LWIP_IPV6 = 1'.


-- 
--gv



reply via email to

[Prev in Thread] Current Thread [Next in Thread]