1 From cc921df9ceac79acf9f1c477d015a3d88275422d Mon Sep 17 00:00:00 2001
2 From: Simon Kelley <simon@thekelleys.org.uk>
3 Date: Wed, 2 Jan 2019 22:48:59 +0000
4 Subject: [PATCH 21/30] Remove nested struct/union in cache records and
7 Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
9 src/arp.c | 18 ++++-----
10 src/auth.c | 36 ++++++++---------
12 src/cache.c | 98 +++++++++++++++++++++++-----------------------
13 src/conntrack.c | 6 +--
14 src/dbus.c | 24 ++++++------
15 src/dhcp-common.c | 14 +++----
16 src/dhcp.c | 20 +++++-----
19 src/dnsmasq.h | 99 ++++++++++++++++++++++++-----------------------
20 src/dnssec.c | 56 +++++++++++++--------------
21 src/domain.c | 32 +++++++--------
22 src/forward.c | 88 ++++++++++++++++++++---------------------
24 src/ipset.c | 10 ++---
25 src/lease.c | 22 +++++------
26 src/network.c | 36 ++++++++---------
27 src/option.c | 16 ++++----
28 src/rfc1035.c | 46 +++++++++++-----------
29 src/rfc3315.c | 12 +++---
32 23 files changed, 336 insertions(+), 335 deletions(-)
36 @@ -28,7 +28,7 @@ struct arp_record {
37 unsigned short hwlen, status;
39 unsigned char hwaddr[DHCP_CHADDR_MAX];
40 - struct all_addr addr;
41 + union all_addr addr;
42 struct arp_record *next;
45 @@ -52,12 +52,12 @@ static int filter_mac(int family, char *
47 if (family == AF_INET)
49 - if (arp->addr.addr.addr4.s_addr != ((struct in_addr *)addrp)->s_addr)
50 + if (arp->addr.addr4.s_addr != ((struct in_addr *)addrp)->s_addr)
55 - if (!IN6_ARE_ADDR_EQUAL(&arp->addr.addr.addr6, (struct in6_addr *)addrp))
56 + if (!IN6_ARE_ADDR_EQUAL(&arp->addr.addr6, (struct in6_addr *)addrp))
60 @@ -95,9 +95,9 @@ static int filter_mac(int family, char *
62 memcpy(arp->hwaddr, mac, maclen);
63 if (family == AF_INET)
64 - arp->addr.addr.addr4.s_addr = ((struct in_addr *)addrp)->s_addr;
65 + arp->addr.addr4.s_addr = ((struct in_addr *)addrp)->s_addr;
67 - memcpy(&arp->addr.addr.addr6, addrp, IN6ADDRSZ);
68 + memcpy(&arp->addr.addr6, addrp, IN6ADDRSZ);
72 @@ -124,11 +124,11 @@ int find_mac(union mysockaddr *addr, uns
75 if (arp->family == AF_INET &&
76 - arp->addr.addr.addr4.s_addr != addr->in.sin_addr.s_addr)
77 + arp->addr.addr4.s_addr != addr->in.sin_addr.s_addr)
80 if (arp->family == AF_INET6 &&
81 - !IN6_ARE_ADDR_EQUAL(&arp->addr.addr.addr6, &addr->in6.sin6_addr))
82 + !IN6_ARE_ADDR_EQUAL(&arp->addr.addr6, &addr->in6.sin6_addr))
85 /* Only accept positive entries unless in lazy mode. */
86 @@ -191,9 +191,9 @@ int find_mac(union mysockaddr *addr, uns
89 if (addr->sa.sa_family == AF_INET)
90 - arp->addr.addr.addr4.s_addr = addr->in.sin_addr.s_addr;
91 + arp->addr.addr4.s_addr = addr->in.sin_addr.s_addr;
93 - memcpy(&arp->addr.addr.addr6, &addr->in6.sin6_addr, IN6ADDRSZ);
94 + memcpy(&arp->addr.addr6, &addr->in6.sin6_addr, IN6ADDRSZ);
104 -static struct addrlist *find_addrlist(struct addrlist *list, int flag, struct all_addr *addr_u)
105 +static struct addrlist *find_addrlist(struct addrlist *list, int flag, union all_addr *addr_u)
108 if (!(list->flags & ADDRLIST_IPV6))
110 - struct in_addr netmask, addr = addr_u->addr.addr4;
111 + struct in_addr netmask, addr = addr_u->addr4;
113 if (!(flag & F_IPV4))
116 netmask.s_addr = htonl(~(in_addr_t)0 << (32 - list->prefixlen));
118 - if (is_same_net(addr, list->addr.addr.addr4, netmask))
119 + if (is_same_net(addr, list->addr.addr4, netmask))
122 - else if (is_same_net6(&(addr_u->addr.addr6), &list->addr.addr.addr6, list->prefixlen))
123 + else if (is_same_net6(&(addr_u->addr6), &list->addr.addr6, list->prefixlen))
126 } while ((list = list->next));
127 @@ -41,7 +41,7 @@ static struct addrlist *find_addrlist(st
131 -static struct addrlist *find_subnet(struct auth_zone *zone, int flag, struct all_addr *addr_u)
132 +static struct addrlist *find_subnet(struct auth_zone *zone, int flag, union all_addr *addr_u)
136 @@ -49,7 +49,7 @@ static struct addrlist *find_subnet(stru
137 return find_addrlist(zone->subnet, flag, addr_u);
140 -static struct addrlist *find_exclude(struct auth_zone *zone, int flag, struct all_addr *addr_u)
141 +static struct addrlist *find_exclude(struct auth_zone *zone, int flag, union all_addr *addr_u)
145 @@ -57,7 +57,7 @@ static struct addrlist *find_exclude(str
146 return find_addrlist(zone->exclude, flag, addr_u);
149 -static int filter_zone(struct auth_zone *zone, int flag, struct all_addr *addr_u)
150 +static int filter_zone(struct auth_zone *zone, int flag, union all_addr *addr_u)
152 if (find_exclude(zone, flag, addr_u))
154 @@ -113,7 +113,7 @@ size_t answer_auth(struct dns_header *he
155 struct txt_record *txt;
156 struct interface_name *intr;
158 - struct all_addr addr;
159 + union all_addr addr;
160 struct cname *a, *candidate;
163 @@ -178,7 +178,7 @@ size_t answer_auth(struct dns_header *he
164 struct addrlist *addrlist;
166 for (addrlist = intr->addr; addrlist; addrlist = addrlist->next)
167 - if (!(addrlist->flags & ADDRLIST_IPV6) && addr.addr.addr4.s_addr == addrlist->addr.addr.addr4.s_addr)
168 + if (!(addrlist->flags & ADDRLIST_IPV6) && addr.addr4.s_addr == addrlist->addr.addr4.s_addr)
172 @@ -193,7 +193,7 @@ size_t answer_auth(struct dns_header *he
173 struct addrlist *addrlist;
175 for (addrlist = intr->addr; addrlist; addrlist = addrlist->next)
176 - if ((addrlist->flags & ADDRLIST_IPV6) && IN6_ARE_ADDR_EQUAL(&addr.addr.addr6, &addrlist->addr.addr.addr6))
177 + if ((addrlist->flags & ADDRLIST_IPV6) && IN6_ARE_ADDR_EQUAL(&addr.addr6, &addrlist->addr.addr6))
181 @@ -468,10 +468,10 @@ size_t answer_auth(struct dns_header *he
184 if ((crecp->flags & flag) &&
185 - (local_query || filter_zone(zone, flag, &(crecp->addr.addr))))
186 + (local_query || filter_zone(zone, flag, &(crecp->addr))))
188 *cut = '.'; /* restore domain part */
189 - log_query(crecp->flags, name, &crecp->addr.addr, record_source(crecp->uid));
190 + log_query(crecp->flags, name, &crecp->addr, record_source(crecp->uid));
191 *cut = 0; /* remove domain part */
193 if (add_resource_record(header, limit, &trunc, nameoffset, &ansp,
194 @@ -491,9 +491,9 @@ size_t answer_auth(struct dns_header *he
198 - if ((crecp->flags & flag) && (local_query || filter_zone(zone, flag, &(crecp->addr.addr))))
199 + if ((crecp->flags & flag) && (local_query || filter_zone(zone, flag, &(crecp->addr))))
201 - log_query(crecp->flags, name, &crecp->addr.addr, record_source(crecp->uid));
202 + log_query(crecp->flags, name, &crecp->addr, record_source(crecp->uid));
204 if (add_resource_record(header, limit, &trunc, nameoffset, &ansp,
205 daemon->auth_ttl, NULL, qtype, C_IN,
206 @@ -580,7 +580,7 @@ size_t answer_auth(struct dns_header *he
208 if (!(subnet->flags & ADDRLIST_IPV6))
210 - in_addr_t a = ntohl(subnet->addr.addr.addr4.s_addr) >> 8;
211 + in_addr_t a = ntohl(subnet->addr.addr4.s_addr) >> 8;
214 if (subnet->prefixlen >= 24)
215 @@ -599,7 +599,7 @@ size_t answer_auth(struct dns_header *he
217 for (i = subnet->prefixlen-1; i >= 0; i -= 4)
219 - int dig = ((unsigned char *)&subnet->addr.addr.addr6)[i>>3];
220 + int dig = ((unsigned char *)&subnet->addr.addr6)[i>>3];
221 p += sprintf(p, "%.1x.", (i>>2) & 1 ? dig & 15 : dig >> 4);
223 p += sprintf(p, "ip6.arpa");
224 @@ -783,7 +783,7 @@ size_t answer_auth(struct dns_header *he
226 char *cache_name = cache_get_name(crecp);
227 if (!strchr(cache_name, '.') &&
228 - (local_query || filter_zone(zone, (crecp->flags & (F_IPV6 | F_IPV4)), &(crecp->addr.addr))) &&
229 + (local_query || filter_zone(zone, (crecp->flags & (F_IPV6 | F_IPV4)), &(crecp->addr))) &&
230 add_resource_record(header, limit, &trunc, -axfroffset, &ansp,
231 daemon->auth_ttl, NULL, (crecp->flags & F_IPV6) ? T_AAAA : T_A, C_IN,
232 (crecp->flags & F_IPV4) ? "4" : "6", cache_name, &crecp->addr))
233 @@ -794,7 +794,7 @@ size_t answer_auth(struct dns_header *he
235 strcpy(name, cache_get_name(crecp));
236 if (in_zone(zone, name, &cut) &&
237 - (local_query || filter_zone(zone, (crecp->flags & (F_IPV6 | F_IPV4)), &(crecp->addr.addr))))
238 + (local_query || filter_zone(zone, (crecp->flags & (F_IPV6 | F_IPV4)), &(crecp->addr))))
246 #ifdef HAVE_BSD_NETWORK
247 static int del_family = 0;
248 -static struct all_addr del_addr;
249 +static union all_addr del_addr;
252 #if defined(HAVE_BSD_NETWORK) && !defined(__APPLE__)
253 @@ -139,7 +139,7 @@ int iface_enumerate(int family, void *pa
254 struct in_addr addr, netmask, broadcast;
255 addr = ((struct sockaddr_in *) addrs->ifa_addr)->sin_addr;
256 #ifdef HAVE_BSD_NETWORK
257 - if (del_family == AF_INET && del_addr.addr.addr4.s_addr == addr.s_addr)
258 + if (del_family == AF_INET && del_addr.addr4.s_addr == addr.s_addr)
261 netmask = ((struct sockaddr_in *) addrs->ifa_netmask)->sin_addr;
262 @@ -159,7 +159,7 @@ int iface_enumerate(int family, void *pa
263 u32 valid = 0xffffffff, preferred = 0xffffffff;
265 #ifdef HAVE_BSD_NETWORK
266 - if (del_family == AF_INET6 && IN6_ARE_ADDR_EQUAL(&del_addr.addr.addr6, addr))
267 + if (del_family == AF_INET6 && IN6_ARE_ADDR_EQUAL(&del_addr.addr6, addr))
270 #if defined(HAVE_BSD_NETWORK) && !defined(__APPLE__)
271 @@ -422,9 +422,9 @@ void route_sock(void)
273 del_family = sa->sa_family;
274 if (del_family == AF_INET)
275 - del_addr.addr.addr4 = ((struct sockaddr_in *)sa)->sin_addr;
276 + del_addr.addr4 = ((struct sockaddr_in *)sa)->sin_addr;
277 else if (del_family == AF_INET6)
278 - del_addr.addr.addr6 = ((struct sockaddr_in6 *)sa)->sin6_addr;
279 + del_addr.addr6 = ((struct sockaddr_in6 *)sa)->sin6_addr;
285 @@ -26,7 +26,7 @@ static union bigname *big_free = NULL;
286 static int bignames_left, hash_size;
288 static void make_non_terminals(struct crec *source);
289 -static struct crec *really_insert(char *name, struct all_addr *addr, unsigned short class,
290 +static struct crec *really_insert(char *name, union all_addr *addr, unsigned short class,
291 time_t now, unsigned long ttl, unsigned short flags);
293 /* type->string mapping: this is also used by the name-hash function as a mixing table. */
294 @@ -202,9 +202,9 @@ static void cache_hash(struct crec *crec
295 static void cache_blockdata_free(struct crec *crecp)
297 if (crecp->flags & F_DNSKEY)
298 - blockdata_free(crecp->addr.addr.addr.key.keydata);
299 + blockdata_free(crecp->addr.key.keydata);
300 else if ((crecp->flags & F_DS) && !(crecp->flags & F_NEG))
301 - blockdata_free(crecp->addr.addr.addr.ds.keydata);
302 + blockdata_free(crecp->addr.ds.keydata);
306 @@ -330,7 +330,7 @@ static int is_expired(time_t now, struct
310 -static struct crec *cache_scan_free(char *name, struct all_addr *addr, unsigned short class, time_t now,
311 +static struct crec *cache_scan_free(char *name, union all_addr *addr, unsigned short class, time_t now,
312 unsigned short flags, struct crec **target_crec, unsigned int *target_uid)
314 /* Scan and remove old entries.
315 @@ -430,7 +430,7 @@ static struct crec *cache_scan_free(char
316 else if (!(crecp->flags & (F_HOSTS | F_DHCP | F_CONFIG)) &&
317 (flags & crecp->flags & F_REVERSE) &&
318 (flags & crecp->flags & (F_IPV4 | F_IPV6)) &&
319 - memcmp(&crecp->addr.addr, addr, addrlen) == 0)
320 + memcmp(&crecp->addr, addr, addrlen) == 0)
322 *up = crecp->hash_next;
324 @@ -466,7 +466,7 @@ void cache_start_insert(void)
328 -struct crec *cache_insert(char *name, struct all_addr *addr, unsigned short class,
329 +struct crec *cache_insert(char *name, union all_addr *addr, unsigned short class,
330 time_t now, unsigned long ttl, unsigned short flags)
332 /* Don't log DNSSEC records here, done elsewhere */
333 @@ -484,7 +484,7 @@ struct crec *cache_insert(char *name, st
337 -static struct crec *really_insert(char *name, struct all_addr *addr, unsigned short class,
338 +static struct crec *really_insert(char *name, union all_addr *addr, unsigned short class,
339 time_t now, unsigned long ttl, unsigned short flags)
341 struct crec *new, *target_crec = NULL;
342 @@ -509,10 +509,10 @@ static struct crec *really_insert(char *
343 if ((flags & (F_IPV4 | F_IPV6)) && (flags & F_FORWARD) && addr)
345 if ((flags & F_IPV4) && (new->flags & F_IPV4) &&
346 - new->addr.addr.addr.addr4.s_addr == addr->addr.addr4.s_addr)
347 + new->addr.addr4.s_addr == addr->addr4.s_addr)
349 else if ((flags & F_IPV6) && (new->flags & F_IPV6) &&
350 - IN6_ARE_ADDR_EQUAL(&new->addr.addr.addr.addr6, &addr->addr.addr6))
351 + IN6_ARE_ADDR_EQUAL(&new->addr.addr6, &addr->addr6))
355 @@ -557,7 +557,7 @@ static struct crec *really_insert(char *
357 /* For DNSSEC records, uid holds class. */
358 free_avail = 1; /* Must be free space now. */
359 - cache_scan_free(cache_get_name(new), &new->addr.addr, new->uid, now, new->flags, NULL, NULL);
360 + cache_scan_free(cache_get_name(new), &new->addr, new->uid, now, new->flags, NULL, NULL);
361 daemon->metrics[METRIC_DNS_CACHE_LIVE_FREED]++;
364 @@ -616,7 +616,7 @@ static struct crec *really_insert(char *
368 - new->addr.addr = *addr;
371 new->ttd = now + (time_t)ttl;
372 new->next = new_chain;
373 @@ -665,14 +665,14 @@ void cache_end_insert(void)
374 if (flags & F_DNSKEY)
376 read_write(daemon->pipe_to_parent, (unsigned char *)&class, sizeof(class), 0);
377 - blockdata_write(new_chain->addr.addr.addr.key.keydata, new_chain->addr.addr.addr.key.keylen, daemon->pipe_to_parent);
378 + blockdata_write(new_chain->addr.key.keydata, new_chain->addr.key.keylen, daemon->pipe_to_parent);
380 else if (flags & F_DS)
382 read_write(daemon->pipe_to_parent, (unsigned char *)&class, sizeof(class), 0);
383 /* A negative DS entry is possible and has no data, obviously. */
384 if (!(flags & F_NEG))
385 - blockdata_write(new_chain->addr.addr.addr.ds.keydata, new_chain->addr.addr.addr.ds.keylen, daemon->pipe_to_parent);
386 + blockdata_write(new_chain->addr.ds.keydata, new_chain->addr.ds.keylen, daemon->pipe_to_parent);
390 @@ -696,7 +696,7 @@ void cache_end_insert(void)
391 int cache_recv_insert(time_t now, int fd)
394 - struct all_addr addr;
395 + union all_addr addr;
398 unsigned short flags;
399 @@ -736,14 +736,14 @@ int cache_recv_insert(time_t now, int fd
400 if (flags & F_DNSKEY)
402 if (!read_write(fd, (unsigned char *)&class, sizeof(class), 1) ||
403 - !(addr.addr.key.keydata = blockdata_read(fd, addr.addr.key.keylen)))
404 + !(addr.key.keydata = blockdata_read(fd, addr.key.keylen)))
407 else if (flags & F_DS)
409 if (!read_write(fd, (unsigned char *)&class, sizeof(class), 1) ||
411 - !(addr.addr.key.keydata = blockdata_read(fd, addr.addr.key.keylen)))
412 + !(addr.key.keydata = blockdata_read(fd, addr.key.keylen)))
416 @@ -876,7 +876,7 @@ struct crec *cache_find_by_name(struct c
420 -struct crec *cache_find_by_addr(struct crec *crecp, struct all_addr *addr,
421 +struct crec *cache_find_by_addr(struct crec *crecp, union all_addr *addr,
422 time_t now, unsigned int prot)
425 @@ -900,7 +900,7 @@ struct crec *cache_find_by_addr(struct c
426 if (!is_expired(now, crecp))
428 if ((crecp->flags & prot) &&
429 - memcmp(&crecp->addr.addr, addr, addrlen) == 0)
430 + memcmp(&crecp->addr, addr, addrlen) == 0)
432 if (crecp->flags & (F_HOSTS | F_DHCP | F_CONFIG))
434 @@ -931,7 +931,7 @@ struct crec *cache_find_by_addr(struct c
436 (ans->flags & F_REVERSE) &&
437 (ans->flags & prot) &&
438 - memcmp(&ans->addr.addr, addr, addrlen) == 0)
439 + memcmp(&ans->addr, addr, addrlen) == 0)
443 @@ -961,7 +961,7 @@ static void add_hosts_cname(struct crec
447 -static void add_hosts_entry(struct crec *cache, struct all_addr *addr, int addrlen,
448 +static void add_hosts_entry(struct crec *cache, union all_addr *addr, int addrlen,
449 unsigned int index, struct crec **rhash, int hashsz)
451 struct crec *lookup = cache_find_by_name(NULL, cache_get_name(cache), 0, cache->flags & (F_IPV4 | F_IPV6));
452 @@ -972,7 +972,7 @@ static void add_hosts_entry(struct crec
453 if (lookup && (lookup->flags & F_HOSTS))
456 - if (memcmp(&lookup->addr.addr, addr, addrlen) == 0)
457 + if (memcmp(&lookup->addr, addr, addrlen) == 0)
461 @@ -1004,7 +1004,7 @@ static void add_hosts_entry(struct crec
463 for (lookup = rhash[j]; lookup; lookup = lookup->next)
464 if ((lookup->flags & cache->flags & (F_IPV4 | F_IPV6)) &&
465 - memcmp(&lookup->addr.addr, addr, addrlen) == 0)
466 + memcmp(&lookup->addr, addr, addrlen) == 0)
468 cache->flags &= ~F_REVERSE;
470 @@ -1026,7 +1026,7 @@ static void add_hosts_entry(struct crec
474 - memcpy(&cache->addr.addr, addr, addrlen);
475 + memcpy(&cache->addr, addr, addrlen);
477 make_non_terminals(cache);
479 @@ -1088,7 +1088,7 @@ int read_hostsfile(char *filename, unsig
480 char *token = daemon->namebuff, *domain_suffix = NULL;
481 int addr_count = 0, name_count = cache_size, lineno = 0;
482 unsigned short flags = 0;
483 - struct all_addr addr;
484 + union all_addr addr;
485 int atnl, addrlen = 0;
488 @@ -1107,13 +1107,13 @@ int read_hostsfile(char *filename, unsig
490 flags = F_HOSTS | F_IMMORTAL | F_FORWARD | F_REVERSE | F_IPV4;
492 - domain_suffix = get_domain(addr.addr.addr4);
493 + domain_suffix = get_domain(addr.addr4);
495 else if (inet_pton(AF_INET6, token, &addr) > 0)
497 flags = F_HOSTS | F_IMMORTAL | F_FORWARD | F_REVERSE | F_IPV6;
499 - domain_suffix = get_domain6(&addr.addr.addr6);
500 + domain_suffix = get_domain6(&addr.addr6);
504 @@ -1246,15 +1246,15 @@ void cache_reload(void)
506 for (ds = daemon->ds; ds; ds = ds->next)
507 if ((cache = whine_malloc(SIZEOF_POINTER_CREC)) &&
508 - (cache->addr.addr.addr.ds.keydata = blockdata_alloc(ds->digest, ds->digestlen)))
509 + (cache->addr.ds.keydata = blockdata_alloc(ds->digest, ds->digestlen)))
511 cache->flags = F_FORWARD | F_IMMORTAL | F_DS | F_CONFIG | F_NAMEP;
512 cache->ttd = daemon->local_ttl;
513 cache->name.namep = ds->name;
514 - cache->addr.addr.addr.ds.keylen = ds->digestlen;
515 - cache->addr.addr.addr.ds.algo = ds->algo;
516 - cache->addr.addr.addr.ds.keytag = ds->keytag;
517 - cache->addr.addr.addr.ds.digest = ds->digest_type;
518 + cache->addr.ds.keylen = ds->digestlen;
519 + cache->addr.ds.algo = ds->algo;
520 + cache->addr.ds.keytag = ds->keytag;
521 + cache->addr.ds.digest = ds->digest_type;
522 cache->uid = ds->class;
524 make_non_terminals(cache);
525 @@ -1277,7 +1277,7 @@ void cache_reload(void)
526 cache->name.namep = nl->name;
527 cache->ttd = hr->ttl;
528 cache->flags = F_HOSTS | F_IMMORTAL | F_FORWARD | F_REVERSE | F_IPV4 | F_NAMEP | F_CONFIG;
529 - add_hosts_entry(cache, (struct all_addr *)&hr->addr, INADDRSZ, SRC_CONFIG, (struct crec **)daemon->packet, revhashsz);
530 + add_hosts_entry(cache, (union all_addr *)&hr->addr, INADDRSZ, SRC_CONFIG, (struct crec **)daemon->packet, revhashsz);
533 if (!IN6_IS_ADDR_UNSPECIFIED(&hr->addr6) &&
534 @@ -1286,7 +1286,7 @@ void cache_reload(void)
535 cache->name.namep = nl->name;
536 cache->ttd = hr->ttl;
537 cache->flags = F_HOSTS | F_IMMORTAL | F_FORWARD | F_REVERSE | F_IPV6 | F_NAMEP | F_CONFIG;
538 - add_hosts_entry(cache, (struct all_addr *)&hr->addr6, IN6ADDRSZ, SRC_CONFIG, (struct crec **)daemon->packet, revhashsz);
539 + add_hosts_entry(cache, (union all_addr *)&hr->addr6, IN6ADDRSZ, SRC_CONFIG, (struct crec **)daemon->packet, revhashsz);
543 @@ -1320,7 +1320,7 @@ struct in_addr a_record_from_hosts(char
545 while ((crecp = cache_find_by_name(crecp, name, now, F_IPV4)))
546 if (crecp->flags & F_HOSTS)
547 - return *(struct in_addr *)&crecp->addr;
548 + return crecp->addr.addr4;
550 my_syslog(MS_DHCP | LOG_WARNING, _("No IPv4 address found for %s"), name);
552 @@ -1379,7 +1379,7 @@ static void add_dhcp_cname(struct crec *
555 void cache_add_dhcp_entry(char *host_name, int prot,
556 - struct all_addr *host_address, time_t ttd)
557 + union all_addr *host_address, time_t ttd)
559 struct crec *crec = NULL, *fail_crec = NULL;
560 unsigned short flags = F_IPV4;
561 @@ -1403,7 +1403,7 @@ void cache_add_dhcp_entry(char *host_nam
562 my_syslog(MS_DHCP | LOG_WARNING,
563 _("%s is a CNAME, not giving it to the DHCP lease of %s"),
564 host_name, daemon->addrbuff);
565 - else if (memcmp(&crec->addr.addr, host_address, addrlen) == 0)
566 + else if (memcmp(&crec->addr, host_address, addrlen) == 0)
570 @@ -1423,7 +1423,7 @@ void cache_add_dhcp_entry(char *host_nam
571 /* Name in hosts, address doesn't match */
574 - inet_ntop(prot, &fail_crec->addr.addr, daemon->namebuff, MAXDNAME);
575 + inet_ntop(prot, &fail_crec->addr, daemon->namebuff, MAXDNAME);
576 my_syslog(MS_DHCP | LOG_WARNING,
577 _("not giving name %s to the DHCP lease of %s because "
578 "the name exists in %s with address %s"),
579 @@ -1432,12 +1432,12 @@ void cache_add_dhcp_entry(char *host_nam
583 - if ((crec = cache_find_by_addr(NULL, (struct all_addr *)host_address, 0, flags)))
584 + if ((crec = cache_find_by_addr(NULL, (union all_addr *)host_address, 0, flags)))
586 if (crec->flags & F_NEG)
589 - cache_scan_free(NULL, (struct all_addr *)host_address, C_IN, 0, flags, NULL, NULL);
590 + cache_scan_free(NULL, (union all_addr *)host_address, C_IN, 0, flags, NULL, NULL);
594 @@ -1455,7 +1455,7 @@ void cache_add_dhcp_entry(char *host_nam
595 crec->flags |= F_IMMORTAL;
598 - crec->addr.addr = *host_address;
599 + crec->addr = *host_address;
600 crec->name.namep = host_name;
601 crec->uid = UID_NONE;
603 @@ -1731,20 +1731,20 @@ void dump_cache(time_t now)
604 else if (cache->flags & F_DS)
606 if (!(cache->flags & F_NEG))
607 - sprintf(a, "%5u %3u %3u", cache->addr.addr.addr.ds.keytag,
608 - cache->addr.addr.addr.ds.algo, cache->addr.addr.addr.ds.digest);
609 + sprintf(a, "%5u %3u %3u", cache->addr.ds.keytag,
610 + cache->addr.ds.algo, cache->addr.ds.digest);
612 else if (cache->flags & F_DNSKEY)
613 - sprintf(a, "%5u %3u %3u", cache->addr.addr.addr.key.keytag,
614 - cache->addr.addr.addr.key.algo, cache->addr.addr.addr.key.flags);
615 + sprintf(a, "%5u %3u %3u", cache->addr.key.keytag,
616 + cache->addr.key.algo, cache->addr.key.flags);
618 else if (!(cache->flags & F_NEG) || !(cache->flags & F_FORWARD))
620 a = daemon->addrbuff;
621 if (cache->flags & F_IPV4)
622 - inet_ntop(AF_INET, &cache->addr.addr, a, ADDRSTRLEN);
623 + inet_ntop(AF_INET, &cache->addr, a, ADDRSTRLEN);
624 else if (cache->flags & F_IPV6)
625 - inet_ntop(AF_INET6, &cache->addr.addr, a, ADDRSTRLEN);
626 + inet_ntop(AF_INET6, &cache->addr, a, ADDRSTRLEN);
629 if (cache->flags & F_IPV4)
630 @@ -1857,7 +1857,7 @@ char *querystr(char *desc, unsigned shor
631 return buff ? buff : "";
634 -void log_query(unsigned int flags, char *name, struct all_addr *addr, char *arg)
635 +void log_query(unsigned int flags, char *name, union all_addr *addr, char *arg)
637 char *source, *dest = daemon->addrbuff;
639 @@ -1870,10 +1870,10 @@ void log_query(unsigned int flags, char
642 if (flags & F_KEYTAG)
643 - sprintf(daemon->addrbuff, arg, addr->addr.log.keytag, addr->addr.log.algo, addr->addr.log.digest);
644 + sprintf(daemon->addrbuff, arg, addr->log.keytag, addr->log.algo, addr->log.digest);
645 else if (flags & F_RCODE)
647 - unsigned int rcode = addr->addr.log.rcode;
648 + unsigned int rcode = addr->log.rcode;
650 if (rcode == SERVFAIL)
652 --- a/src/conntrack.c
653 +++ b/src/conntrack.c
654 @@ -24,7 +24,7 @@ static int gotit = 0; /* yuck */
656 static int callback(enum nf_conntrack_msg_type type, struct nf_conntrack *ct, void *data);
658 -int get_incoming_mark(union mysockaddr *peer_addr, struct all_addr *local_addr, int istcp, unsigned int *markp)
659 +int get_incoming_mark(union mysockaddr *peer_addr, union all_addr *local_addr, int istcp, unsigned int *markp)
661 struct nf_conntrack *ct;
662 struct nfct_handle *h;
663 @@ -41,14 +41,14 @@ int get_incoming_mark(union mysockaddr *
664 nfct_set_attr_u8(ct, ATTR_L3PROTO, AF_INET6);
665 nfct_set_attr(ct, ATTR_IPV6_SRC, peer_addr->in6.sin6_addr.s6_addr);
666 nfct_set_attr_u16(ct, ATTR_PORT_SRC, peer_addr->in6.sin6_port);
667 - nfct_set_attr(ct, ATTR_IPV6_DST, local_addr->addr.addr6.s6_addr);
668 + nfct_set_attr(ct, ATTR_IPV6_DST, local_addr->addr6.s6_addr);
672 nfct_set_attr_u8(ct, ATTR_L3PROTO, AF_INET);
673 nfct_set_attr_u32(ct, ATTR_IPV4_SRC, peer_addr->in.sin_addr.s_addr);
674 nfct_set_attr_u16(ct, ATTR_PORT_SRC, peer_addr->in.sin_port);
675 - nfct_set_attr_u32(ct, ATTR_IPV4_DST, local_addr->addr.addr4.s_addr);
676 + nfct_set_attr_u32(ct, ATTR_IPV4_DST, local_addr->addr4.s_addr);
682 @@ -456,7 +456,7 @@ static DBusMessage *dbus_add_lease(DBusM
683 int clid_len, hostname_len, hw_len, hw_type;
684 dbus_uint32_t expires, ia_id;
685 dbus_bool_t is_temporary;
686 - struct all_addr addr;
687 + union all_addr addr;
688 time_t now = dnsmasq_time();
689 unsigned char dhcp_chaddr[DHCP_CHADDR_MAX];
691 @@ -526,20 +526,20 @@ static DBusMessage *dbus_add_lease(DBusM
693 dbus_message_iter_get_basic(&iter, &is_temporary);
695 - if (inet_pton(AF_INET, ipaddr, &addr.addr.addr4))
696 + if (inet_pton(AF_INET, ipaddr, &addr.addr4))
698 if (ia_id != 0 || is_temporary)
699 return dbus_message_new_error(message, DBUS_ERROR_INVALID_ARGS,
700 "ia_id and is_temporary must be zero for IPv4 lease");
702 - if (!(lease = lease_find_by_addr(addr.addr.addr4)))
703 - lease = lease4_allocate(addr.addr.addr4);
704 + if (!(lease = lease_find_by_addr(addr.addr4)))
705 + lease = lease4_allocate(addr.addr4);
708 - else if (inet_pton(AF_INET6, ipaddr, &addr.addr.addr6))
709 + else if (inet_pton(AF_INET6, ipaddr, &addr.addr6))
711 - if (!(lease = lease6_find_by_addr(&addr.addr.addr6, 128, 0)))
712 - lease = lease6_allocate(&addr.addr.addr6,
713 + if (!(lease = lease6_find_by_addr(&addr.addr6, 128, 0)))
714 + lease = lease6_allocate(&addr.addr6,
715 is_temporary ? LEASE_TA : LEASE_NA);
716 lease_set_iaid(lease, ia_id);
718 @@ -570,7 +570,7 @@ static DBusMessage *dbus_del_lease(DBusM
719 DBusMessageIter iter;
722 - struct all_addr addr;
723 + union all_addr addr;
725 time_t now = dnsmasq_time();
727 @@ -584,11 +584,11 @@ static DBusMessage *dbus_del_lease(DBusM
729 dbus_message_iter_get_basic(&iter, &ipaddr);
731 - if (inet_pton(AF_INET, ipaddr, &addr.addr.addr4))
732 - lease = lease_find_by_addr(addr.addr.addr4);
733 + if (inet_pton(AF_INET, ipaddr, &addr.addr4))
734 + lease = lease_find_by_addr(addr.addr4);
736 - else if (inet_pton(AF_INET6, ipaddr, &addr.addr.addr6))
737 - lease = lease6_find_by_addr(&addr.addr.addr6, 128, 0);
738 + else if (inet_pton(AF_INET6, ipaddr, &addr.addr6))
739 + lease = lease6_find_by_addr(&addr.addr6, 128, 0);
742 return dbus_message_new_error_printf(message, DBUS_ERROR_INVALID_ARGS,
743 --- a/src/dhcp-common.c
744 +++ b/src/dhcp-common.c
745 @@ -403,30 +403,30 @@ void dhcp_update_configs(struct dhcp_con
746 crec = cache_find_by_name(crec, config->hostname, 0, cacheflags);
748 continue; /* should be never */
749 - inet_ntop(prot, &crec->addr.addr, daemon->addrbuff, ADDRSTRLEN);
750 + inet_ntop(prot, &crec->addr, daemon->addrbuff, ADDRSTRLEN);
751 my_syslog(MS_DHCP | LOG_WARNING, _("%s has more than one address in hostsfile, using %s for DHCP"),
752 config->hostname, daemon->addrbuff);
755 if (prot == AF_INET &&
756 - (!(conf_tmp = config_find_by_address(configs, crec->addr.addr.addr.addr4)) || conf_tmp == config))
757 + (!(conf_tmp = config_find_by_address(configs, crec->addr.addr4)) || conf_tmp == config))
759 - config->addr = crec->addr.addr.addr.addr4;
760 + config->addr = crec->addr.addr4;
761 config->flags |= CONFIG_ADDR | CONFIG_ADDR_HOSTS;
766 if (prot == AF_INET6 &&
767 - (!(conf_tmp = config_find_by_address6(configs, &crec->addr.addr.addr.addr6, 128, 0)) || conf_tmp == config))
768 + (!(conf_tmp = config_find_by_address6(configs, &crec->addr.addr6, 128, 0)) || conf_tmp == config))
770 - memcpy(&config->addr6, &crec->addr.addr.addr.addr6, IN6ADDRSZ);
771 + memcpy(&config->addr6, &crec->addr.addr6, IN6ADDRSZ);
772 config->flags |= CONFIG_ADDR6 | CONFIG_ADDR_HOSTS;
777 - inet_ntop(prot, &crec->addr.addr, daemon->addrbuff, ADDRSTRLEN);
778 + inet_ntop(prot, &crec->addr, daemon->addrbuff, ADDRSTRLEN);
779 my_syslog(MS_DHCP | LOG_WARNING, _("duplicate IP address %s (%s) in dhcp-config directive"),
780 daemon->addrbuff, config->hostname);
782 @@ -693,7 +693,7 @@ char *option_string(int prot, unsigned i
784 if (ot[o].size & OT_ADDR_LIST)
786 - struct all_addr addr;
787 + union all_addr addr;
788 int addr_len = INADDRSZ;
793 @@ -310,7 +310,7 @@ void dhcp_packet(time_t now, int pxe_fd)
794 parm.relay_local.s_addr = 0;
795 parm.ind = iface_index;
797 - if (!iface_check(AF_INET, (struct all_addr *)&iface_addr, ifr.ifr_name, NULL))
798 + if (!iface_check(AF_INET, (union all_addr *)&iface_addr, ifr.ifr_name, NULL))
800 /* If we failed to match the primary address of the interface, see if we've got a --listen-address
802 @@ -558,7 +558,7 @@ static int complete_context(struct in_ad
805 for (relay = daemon->relay4; relay; relay = relay->next)
806 - if (if_index == param->ind && relay->local.addr.addr4.s_addr == local.s_addr && relay->current == relay &&
807 + if (if_index == param->ind && relay->local.addr4.s_addr == local.s_addr && relay->current == relay &&
808 (param->relay_local.s_addr == 0 || param->relay_local.s_addr == local.s_addr))
810 relay->current = param->relay;
811 @@ -984,7 +984,7 @@ char *host_from_dns(struct in_addr addr)
812 if (daemon->port == 0)
813 return NULL; /* DNS disabled. */
815 - lookup = cache_find_by_addr(NULL, (struct all_addr *)&addr, 0, F_IPV4);
816 + lookup = cache_find_by_addr(NULL, (union all_addr *)&addr, 0, F_IPV4);
818 if (lookup && (lookup->flags & F_HOSTS))
820 @@ -1013,25 +1013,25 @@ char *host_from_dns(struct in_addr addr)
821 static int relay_upstream4(struct dhcp_relay *relay, struct dhcp_packet *mess, size_t sz, int iface_index)
823 /* ->local is same value for all relays on ->current chain */
824 - struct all_addr from;
825 + union all_addr from;
827 if (mess->op != BOOTREQUEST)
830 /* source address == relay address */
831 - from.addr.addr4 = relay->local.addr.addr4;
832 + from.addr4 = relay->local.addr4;
834 /* already gatewayed ? */
835 if (mess->giaddr.s_addr)
837 /* if so check if by us, to stomp on loops. */
838 - if (mess->giaddr.s_addr == relay->local.addr.addr4.s_addr)
839 + if (mess->giaddr.s_addr == relay->local.addr4.s_addr)
844 /* plug in our address */
845 - mess->giaddr.s_addr = relay->local.addr.addr4.s_addr;
846 + mess->giaddr.s_addr = relay->local.addr4.s_addr;
849 if ((mess->hops++) > 20)
850 @@ -1042,7 +1042,7 @@ static int relay_upstream4(struct dhcp_
853 to.sa.sa_family = AF_INET;
854 - to.in.sin_addr = relay->server.addr.addr4;
855 + to.in.sin_addr = relay->server.addr4;
856 to.in.sin_port = htons(daemon->dhcp_server_port);
858 send_from(daemon->dhcpfd, 0, (char *)mess, sz, &to, &from, 0);
859 @@ -1050,7 +1050,7 @@ static int relay_upstream4(struct dhcp_
860 if (option_bool(OPT_LOG_OPTS))
862 inet_ntop(AF_INET, &relay->local, daemon->addrbuff, ADDRSTRLEN);
863 - my_syslog(MS_DHCP | LOG_INFO, _("DHCP relay %s -> %s"), daemon->addrbuff, inet_ntoa(relay->server.addr.addr4));
864 + my_syslog(MS_DHCP | LOG_INFO, _("DHCP relay %s -> %s"), daemon->addrbuff, inet_ntoa(relay->server.addr4));
867 /* Save this for replies */
868 @@ -1070,7 +1070,7 @@ static struct dhcp_relay *relay_reply4(s
870 for (relay = daemon->relay4; relay; relay = relay->next)
872 - if (mess->giaddr.s_addr == relay->local.addr.addr4.s_addr)
873 + if (mess->giaddr.s_addr == relay->local.addr4.s_addr)
875 if (!relay->interface || wildcard_match(relay->interface, arrival_interface))
876 return relay->iface_index != 0 ? relay : NULL;
879 @@ -371,7 +371,7 @@ static int complete_context6(struct in6_
882 for (relay = daemon->relay6; relay; relay = relay->next)
883 - if (IN6_ARE_ADDR_EQUAL(local, &relay->local.addr.addr6) && relay->current == relay &&
884 + if (IN6_ARE_ADDR_EQUAL(local, &relay->local.addr6) && relay->current == relay &&
885 (IN6_IS_ADDR_UNSPECIFIED(¶m->relay_local) || IN6_ARE_ADDR_EQUAL(local, ¶m->relay_local)))
887 relay->current = param->relay;
890 @@ -1721,12 +1721,12 @@ static void check_dns_listeners(time_t n
891 if ((if_index = tcp_interface(confd, tcp_addr.sa.sa_family)) != 0 &&
892 indextoname(listener->tcpfd, if_index, intr_name))
894 - struct all_addr addr;
895 + union all_addr addr;
897 if (tcp_addr.sa.sa_family == AF_INET6)
898 - addr.addr.addr6 = tcp_addr.in6.sin6_addr;
899 + addr.addr6 = tcp_addr.in6.sin6_addr;
901 - addr.addr.addr4 = tcp_addr.in.sin_addr;
902 + addr.addr4 = tcp_addr.in.sin_addr;
904 for (iface = daemon->interfaces; iface; iface = iface->next)
905 if (iface->index == if_index)
908 @@ -273,28 +273,39 @@ struct event_desc {
909 #define MS_DHCP LOG_DAEMON
910 #define MS_SCRIPT LOG_MAIL
914 - struct in_addr addr4;
915 - struct in6_addr addr6;
917 - struct blockdata *keydata;
918 - unsigned short keylen, flags, keytag;
919 - unsigned char algo;
922 - struct blockdata *keydata;
923 - unsigned short keylen, keytag;
924 - unsigned char algo;
925 - unsigned char digest;
927 - /* for log_query */
929 - unsigned short keytag, algo, digest, rcode;
932 +/* Note that this is used widely as a container for IPv4/IPv6 addresses,
933 + so for that reason, was well as to avoid wasting memory in almost every
934 + cache entry, the other variants should not be larger than
935 + sizeof(struct in6_addr) - 16 bytes.
938 + struct in_addr addr4;
939 + struct in6_addr addr6;
942 + struct crec *cache;
943 + struct interface_name *int_name;
945 + unsigned int uid; /* 0 if union is interface-name */
948 + struct blockdata *keydata;
949 + unsigned short keylen, flags, keytag;
950 + unsigned char algo;
953 + struct blockdata *keydata;
954 + unsigned short keylen, keytag;
955 + unsigned char algo;
956 + unsigned char digest;
958 + /* for log_query */
960 + unsigned short keytag, algo, digest, rcode;
967 struct bogus_addr *next;
968 @@ -359,7 +370,7 @@ struct ds_config {
969 #define ADDRLIST_REVONLY 4
972 - struct all_addr addr;
973 + union all_addr addr;
974 int flags, prefixlen;
975 struct addrlist *next;
977 @@ -411,17 +422,7 @@ struct blockdata {
980 struct crec *next, *prev, *hash_next;
981 - /* union is 16 bytes when doing IPv6, 8 bytes on 32 bit machines without IPv6 */
983 - struct all_addr addr;
986 - struct crec *cache;
987 - struct interface_name *int_name;
989 - unsigned int uid; /* 0 if union is interface-name */
992 + union all_addr addr;
993 time_t ttd; /* time to die */
994 /* used as class if DNSKEY/DS, index to source for F_HOSTS */
996 @@ -646,7 +647,7 @@ struct hostsfile {
999 union mysockaddr source;
1000 - struct all_addr dest;
1001 + union all_addr dest;
1002 struct server *sentto; /* NULL means free */
1003 struct randfd *rfd4;
1004 struct randfd *rfd6;
1005 @@ -962,7 +963,7 @@ struct tftp_prefix {
1009 - struct all_addr local, server;
1010 + union all_addr local, server;
1011 char *interface; /* Allowable interface for replies from server, and dest for IPv6 multicast */
1012 int iface_index; /* working - interface in which requests arrived, for return */
1013 struct dhcp_relay *current, *next;
1014 @@ -1128,22 +1129,22 @@ extern struct daemon {
1016 void cache_init(void);
1017 void next_uid(struct crec *crecp);
1018 -void log_query(unsigned int flags, char *name, struct all_addr *addr, char *arg);
1019 +void log_query(unsigned int flags, char *name, union all_addr *addr, char *arg);
1020 char *record_source(unsigned int index);
1021 char *querystr(char *desc, unsigned short type);
1022 int cache_find_non_terminal(char *name, time_t now);
1023 struct crec *cache_find_by_addr(struct crec *crecp,
1024 - struct all_addr *addr, time_t now,
1025 + union all_addr *addr, time_t now,
1027 struct crec *cache_find_by_name(struct crec *crecp,
1028 char *name, time_t now, unsigned int prot);
1029 void cache_end_insert(void);
1030 void cache_start_insert(void);
1031 int cache_recv_insert(time_t now, int fd);
1032 -struct crec *cache_insert(char *name, struct all_addr *addr, unsigned short class,
1033 +struct crec *cache_insert(char *name, union all_addr *addr, unsigned short class,
1034 time_t now, unsigned long ttl, unsigned short flags);
1035 void cache_reload(void);
1036 -void cache_add_dhcp_entry(char *host_name, int prot, struct all_addr *host_address, time_t ttd);
1037 +void cache_add_dhcp_entry(char *host_name, int prot, union all_addr *host_address, time_t ttd);
1038 struct in_addr a_record_from_hosts(char *name, time_t now);
1039 void cache_unhash_dhcp(void);
1040 void dump_cache(time_t now);
1041 @@ -1170,8 +1171,8 @@ void blockdata_free(struct blockdata *bl
1043 char *get_domain(struct in_addr addr);
1044 char *get_domain6(struct in6_addr *addr);
1045 -int is_name_synthetic(int flags, char *name, struct all_addr *addr);
1046 -int is_rev_synth(int flag, struct all_addr *addr, char *name);
1047 +int is_name_synthetic(int flags, char *name, union all_addr *addr);
1048 +int is_rev_synth(int flag, union all_addr *addr, char *name);
1051 int extract_name(struct dns_header *header, size_t plen, unsigned char **pp,
1052 @@ -1182,7 +1183,7 @@ unsigned char *skip_section(unsigned cha
1053 unsigned int extract_request(struct dns_header *header, size_t qlen,
1054 char *name, unsigned short *typep);
1055 size_t setup_reply(struct dns_header *header, size_t qlen,
1056 - struct all_addr *addrp, unsigned int flags,
1057 + union all_addr *addrp, unsigned int flags,
1059 int extract_addresses(struct dns_header *header, size_t qlen, char *name,
1060 time_t now, char **ipsets, int is_sign, int check_rebind,
1061 @@ -1203,7 +1204,7 @@ int add_resource_record(struct dns_heade
1062 unsigned char *skip_questions(struct dns_header *header, size_t plen);
1063 int extract_name(struct dns_header *header, size_t plen, unsigned char **pp,
1064 char *name, int isExtract, int extrabytes);
1065 -int in_arpa_name_2_addr(char *namein, struct all_addr *addrp);
1066 +int in_arpa_name_2_addr(char *namein, union all_addr *addrp);
1067 int private_net(struct in_addr addr, int ban_localhost);
1070 @@ -1302,7 +1303,7 @@ unsigned char *tcp_request(int confd, ti
1071 void server_gone(struct server *server);
1072 struct frec *get_new_frec(time_t now, int *wait, int force);
1073 int send_from(int fd, int nowild, char *packet, size_t len,
1074 - union mysockaddr *to, struct all_addr *source,
1075 + union mysockaddr *to, union all_addr *source,
1076 unsigned int iface);
1077 void resend_query(void);
1078 struct randfd *allocate_rfd(int family);
1079 @@ -1329,9 +1330,9 @@ void warn_bound_listeners(void);
1080 void warn_wild_labels(void);
1081 void warn_int_names(void);
1082 int is_dad_listeners(void);
1083 -int iface_check(int family, struct all_addr *addr, char *name, int *auth);
1084 -int loopback_exception(int fd, int family, struct all_addr *addr, char *name);
1085 -int label_exception(int index, int family, struct all_addr *addr);
1086 +int iface_check(int family, union all_addr *addr, char *name, int *auth);
1087 +int loopback_exception(int fd, int family, union all_addr *addr, char *name);
1088 +int label_exception(int index, int family, union all_addr *addr);
1090 int tcp_interface(int fd, int af);
1091 int set_ipv6pktinfo(int fd);
1092 @@ -1461,7 +1462,7 @@ void ubus_event_bcast(const char *type,
1095 void ipset_init(void);
1096 -int add_to_ipset(const char *setname, const struct all_addr *ipaddr, int flags, int remove);
1097 +int add_to_ipset(const char *setname, const union all_addr *ipaddr, int flags, int remove);
1101 @@ -1474,7 +1475,7 @@ void queue_script(int action, struct dhc
1102 void queue_tftp(off_t file_len, char *filename, union mysockaddr *peer);
1104 void queue_arp(int action, unsigned char *mac, int maclen,
1105 - int family, struct all_addr *addr);
1106 + int family, union all_addr *addr);
1107 int helper_buf_empty(void);
1110 @@ -1487,7 +1488,7 @@ int do_tftp_script_run(void);
1113 #ifdef HAVE_CONNTRACK
1114 -int get_incoming_mark(union mysockaddr *peer_addr, struct all_addr *local_addr,
1115 +int get_incoming_mark(union mysockaddr *peer_addr, union all_addr *local_addr,
1116 int istcp, unsigned int *markp);
1121 @@ -628,10 +628,10 @@ static int validate_rrset(time_t now, st
1123 /* iterate through all possible keys 4035 5.3.1 */
1124 for (; crecp; crecp = cache_find_by_name(crecp, keyname, now, F_DNSKEY))
1125 - if (crecp->addr.addr.addr.key.algo == algo &&
1126 - crecp->addr.addr.addr.key.keytag == key_tag &&
1127 + if (crecp->addr.key.algo == algo &&
1128 + crecp->addr.key.keytag == key_tag &&
1129 crecp->uid == (unsigned int)class &&
1130 - verify(crecp->addr.addr.addr.key.keydata, crecp->addr.addr.addr.key.keylen, sig, sig_len, digest, hash->digest_size, algo))
1131 + verify(crecp->addr.key.keydata, crecp->addr.key.keylen, sig, sig_len, digest, hash->digest_size, algo))
1132 return (labels < name_labels) ? STAT_SECURE_WILDCARD : STAT_SECURE;
1135 @@ -655,7 +655,7 @@ int dnssec_validate_by_ds(time_t now, st
1136 struct crec *crecp, *recp1;
1137 int rc, j, qtype, qclass, ttl, rdlen, flags, algo, valid, keytag;
1138 struct blockdata *key;
1139 - struct all_addr a;
1142 if (ntohs(header->qdcount) != 1 ||
1143 !extract_name(header, plen, &p, name, 1, 4))
1144 @@ -728,10 +728,10 @@ int dnssec_validate_by_ds(time_t now, st
1145 const struct nettle_hash *hash;
1148 - if (recp1->addr.addr.addr.ds.algo == algo &&
1149 - recp1->addr.addr.addr.ds.keytag == keytag &&
1150 + if (recp1->addr.ds.algo == algo &&
1151 + recp1->addr.ds.keytag == keytag &&
1152 recp1->uid == (unsigned int)class &&
1153 - (hash = hash_find(ds_digest_name(recp1->addr.addr.addr.ds.digest))) &&
1154 + (hash = hash_find(ds_digest_name(recp1->addr.ds.digest))) &&
1155 hash_init(hash, &ctx, &digest))
1158 @@ -746,9 +746,9 @@ int dnssec_validate_by_ds(time_t now, st
1161 if (!(recp1->flags & F_NEG) &&
1162 - recp1->addr.addr.addr.ds.keylen == (int)hash->digest_size &&
1163 - (ds_digest = blockdata_retrieve(recp1->addr.addr.addr.ds.keydata, recp1->addr.addr.addr.ds.keylen, NULL)) &&
1164 - memcmp(ds_digest, digest, recp1->addr.addr.addr.ds.keylen) == 0 &&
1165 + recp1->addr.ds.keylen == (int)hash->digest_size &&
1166 + (ds_digest = blockdata_retrieve(recp1->addr.ds.keydata, recp1->addr.ds.keylen, NULL)) &&
1167 + memcmp(ds_digest, digest, recp1->addr.ds.keylen) == 0 &&
1168 explore_rrset(header, plen, class, T_DNSKEY, name, keyname, &sigcnt, &rrcnt) &&
1169 sigcnt != 0 && rrcnt != 0 &&
1170 validate_rrset(now, header, plen, class, T_DNSKEY, sigcnt, rrcnt, name, keyname,
1171 @@ -800,11 +800,11 @@ int dnssec_validate_by_ds(time_t now, st
1173 if ((key = blockdata_alloc((char*)p, rdlen - 4)))
1175 - a.addr.key.keylen = rdlen - 4;
1176 - a.addr.key.keydata = key;
1177 - a.addr.key.algo = algo;
1178 - a.addr.key.keytag = keytag;
1179 - a.addr.key.flags = flags;
1180 + a.key.keylen = rdlen - 4;
1181 + a.key.keydata = key;
1182 + a.key.algo = algo;
1183 + a.key.keytag = keytag;
1184 + a.key.flags = flags;
1186 if (!cache_insert(name, &a, class, now, ttl, F_FORWARD | F_DNSKEY | F_DNSSECOK))
1188 @@ -813,8 +813,8 @@ int dnssec_validate_by_ds(time_t now, st
1192 - a.addr.log.keytag = keytag;
1193 - a.addr.log.algo = algo;
1194 + a.log.keytag = keytag;
1195 + a.log.algo = algo;
1196 if (algo_digest_name(algo))
1197 log_query(F_NOEXTRA | F_KEYTAG | F_UPSTREAM, name, &a, "DNSKEY keytag %hu, algo %hu");
1199 @@ -857,7 +857,7 @@ int dnssec_validate_ds(time_t now, struc
1200 int qtype, qclass, rc, i, neganswer, nons;
1201 int aclass, atype, rdlen;
1203 - struct all_addr a;
1206 if (ntohs(header->qdcount) != 1 ||
1207 !(p = skip_name(p, header, plen, 4)))
1208 @@ -925,11 +925,11 @@ int dnssec_validate_ds(time_t now, struc
1210 if ((key = blockdata_alloc((char*)p, rdlen - 4)))
1212 - a.addr.ds.digest = digest;
1213 - a.addr.ds.keydata = key;
1214 - a.addr.ds.algo = algo;
1215 - a.addr.ds.keytag = keytag;
1216 - a.addr.ds.keylen = rdlen - 4;
1217 + a.ds.digest = digest;
1218 + a.ds.keydata = key;
1220 + a.ds.keytag = keytag;
1221 + a.ds.keylen = rdlen - 4;
1223 if (!cache_insert(name, &a, class, now, ttl, F_FORWARD | F_DS | F_DNSSECOK))
1225 @@ -938,9 +938,9 @@ int dnssec_validate_ds(time_t now, struc
1229 - a.addr.log.keytag = keytag;
1230 - a.addr.log.algo = algo;
1231 - a.addr.log.digest = digest;
1232 + a.log.keytag = keytag;
1233 + a.log.algo = algo;
1234 + a.log.digest = digest;
1235 if (ds_digest_name(digest) && algo_digest_name(algo))
1236 log_query(F_NOEXTRA | F_KEYTAG | F_UPSTREAM, name, &a, "DS keytag %hu, algo %hu, digest %hu");
1238 @@ -1710,8 +1710,8 @@ static int zone_status(char *name, int c
1241 if (crecp->uid == (unsigned int)class &&
1242 - ds_digest_name(crecp->addr.addr.addr.ds.digest) &&
1243 - algo_digest_name(crecp->addr.addr.addr.ds.algo))
1244 + ds_digest_name(crecp->addr.ds.digest) &&
1245 + algo_digest_name(crecp->addr.ds.algo))
1248 while ((crecp = cache_find_by_name(crecp, keyname, now, F_DS)));
1251 @@ -21,7 +21,7 @@ static struct cond_domain *search_domain
1252 static struct cond_domain *search_domain6(struct in6_addr *addr, struct cond_domain *c);
1255 -int is_name_synthetic(int flags, char *name, struct all_addr *addr)
1256 +int is_name_synthetic(int flags, char *name, union all_addr *addr)
1259 struct cond_domain *c = NULL;
1260 @@ -73,7 +73,7 @@ int is_name_synthetic(int flags, char *n
1262 index <= ntohl(c->end.s_addr) - ntohl(c->start.s_addr))
1264 - addr->addr.addr4.s_addr = htonl(ntohl(c->start.s_addr) + index);
1265 + addr->addr4.s_addr = htonl(ntohl(c->start.s_addr) + index);
1269 @@ -85,8 +85,8 @@ int is_name_synthetic(int flags, char *n
1270 index <= addr6part(&c->end6) - addr6part(&c->start6))
1272 u64 start = addr6part(&c->start6);
1273 - addr->addr.addr6 = c->start6;
1274 - setaddr6part(&addr->addr.addr6, start + index);
1275 + addr->addr6 = c->start6;
1276 + setaddr6part(&addr->addr6, start + index);
1280 @@ -139,16 +139,16 @@ int is_name_synthetic(int flags, char *n
1281 if (prot == AF_INET)
1284 - ntohl(addr->addr.addr4.s_addr) >= ntohl(c->start.s_addr) &&
1285 - ntohl(addr->addr.addr4.s_addr) <= ntohl(c->end.s_addr))
1286 + ntohl(addr->addr4.s_addr) >= ntohl(c->start.s_addr) &&
1287 + ntohl(addr->addr4.s_addr) <= ntohl(c->end.s_addr))
1292 - u64 addrpart = addr6part(&addr->addr.addr6);
1293 + u64 addrpart = addr6part(&addr->addr6);
1296 - is_same_net6(&addr->addr.addr6, &c->start6, 64) &&
1297 + is_same_net6(&addr->addr6, &c->start6, 64) &&
1298 addrpart >= addr6part(&c->start6) &&
1299 addrpart <= addr6part(&c->end6))
1301 @@ -173,18 +173,18 @@ int is_name_synthetic(int flags, char *n
1305 -int is_rev_synth(int flag, struct all_addr *addr, char *name)
1306 +int is_rev_synth(int flag, union all_addr *addr, char *name)
1308 struct cond_domain *c;
1310 - if (flag & F_IPV4 && (c = search_domain(addr->addr.addr4, daemon->synth_domains)))
1311 + if (flag & F_IPV4 && (c = search_domain(addr->addr4, daemon->synth_domains)))
1318 - unsigned int index = ntohl(addr->addr.addr4.s_addr) - ntohl(c->start.s_addr);
1319 + unsigned int index = ntohl(addr->addr4.s_addr) - ntohl(c->start.s_addr);
1320 snprintf(name, MAXDNAME, "%s%u", c->prefix ? c->prefix : "", index);
1323 @@ -192,7 +192,7 @@ int is_rev_synth(int flag, struct all_ad
1325 strncpy(name, c->prefix, MAXDNAME - ADDRSTRLEN);
1327 - inet_ntop(AF_INET, &addr->addr.addr4, name + strlen(name), ADDRSTRLEN);
1328 + inet_ntop(AF_INET, &addr->addr4, name + strlen(name), ADDRSTRLEN);
1329 for (p = name; *p; p++)
1332 @@ -204,14 +204,14 @@ int is_rev_synth(int flag, struct all_ad
1336 - if ((flag & F_IPV6) && (c = search_domain6(&addr->addr.addr6, daemon->synth_domains)))
1337 + if ((flag & F_IPV6) && (c = search_domain6(&addr->addr6, daemon->synth_domains)))
1344 - u64 index = addr6part(&addr->addr.addr6) - addr6part(&c->start6);
1345 + u64 index = addr6part(&addr->addr6) - addr6part(&c->start6);
1346 snprintf(name, MAXDNAME, "%s%llu", c->prefix ? c->prefix : "", index);
1349 @@ -219,14 +219,14 @@ int is_rev_synth(int flag, struct all_ad
1351 strncpy(name, c->prefix, MAXDNAME - ADDRSTRLEN);
1353 - inet_ntop(AF_INET6, &addr->addr.addr6, name + strlen(name), ADDRSTRLEN);
1354 + inet_ntop(AF_INET6, &addr->addr6, name + strlen(name), ADDRSTRLEN);
1356 /* IPv6 presentation address can start with ":", but valid domain names
1357 cannot start with "-" so prepend a zero in that case. */
1358 if (!c->prefix && *name == ':')
1361 - inet_ntop(AF_INET6, &addr->addr.addr6, name+1, ADDRSTRLEN);
1362 + inet_ntop(AF_INET6, &addr->addr6, name+1, ADDRSTRLEN);
1365 /* V4-mapped have periods.... */
1368 @@ -26,7 +26,7 @@ static void free_frec(struct frec *f);
1369 /* Send a UDP packet with its source address set as "source"
1370 unless nowild is true, when we just send it with the kernel default */
1371 int send_from(int fd, int nowild, char *packet, size_t len,
1372 - union mysockaddr *to, struct all_addr *source,
1373 + union mysockaddr *to, union all_addr *source,
1377 @@ -64,13 +64,13 @@ int send_from(int fd, int nowild, char *
1378 #if defined(HAVE_LINUX_NETWORK)
1379 struct in_pktinfo p;
1381 - p.ipi_spec_dst = source->addr.addr4;
1382 + p.ipi_spec_dst = source->addr4;
1383 memcpy(CMSG_DATA(cmptr), &p, sizeof(p));
1384 msg.msg_controllen = cmptr->cmsg_len = CMSG_LEN(sizeof(struct in_pktinfo));
1385 cmptr->cmsg_level = IPPROTO_IP;
1386 cmptr->cmsg_type = IP_PKTINFO;
1387 #elif defined(IP_SENDSRCADDR)
1388 - memcpy(CMSG_DATA(cmptr), &(source->addr.addr4), sizeof(source->addr.addr4));
1389 + memcpy(CMSG_DATA(cmptr), &(source->addr4), sizeof(source->addr4));
1390 msg.msg_controllen = cmptr->cmsg_len = CMSG_LEN(sizeof(struct in_addr));
1391 cmptr->cmsg_level = IPPROTO_IP;
1392 cmptr->cmsg_type = IP_SENDSRCADDR;
1393 @@ -80,7 +80,7 @@ int send_from(int fd, int nowild, char *
1395 struct in6_pktinfo p;
1396 p.ipi6_ifindex = iface; /* Need iface for IPv6 to handle link-local addrs */
1397 - p.ipi6_addr = source->addr.addr6;
1398 + p.ipi6_addr = source->addr6;
1399 memcpy(CMSG_DATA(cmptr), &p, sizeof(p));
1400 msg.msg_controllen = cmptr->cmsg_len = CMSG_LEN(sizeof(struct in6_pktinfo));
1401 cmptr->cmsg_type = daemon->v6pktinfo;
1402 @@ -100,7 +100,7 @@ int send_from(int fd, int nowild, char *
1406 -static unsigned int search_servers(time_t now, struct all_addr **addrpp, unsigned int qtype,
1407 +static unsigned int search_servers(time_t now, union all_addr **addrpp, unsigned int qtype,
1408 char *qdomain, int *type, char **domain, int *norebind)
1411 @@ -112,7 +112,7 @@ static unsigned int search_servers(time_
1412 unsigned int matchlen = 0;
1413 struct server *serv;
1414 unsigned int flags = 0;
1415 - static struct all_addr zero;
1416 + static union all_addr zero;
1418 for (serv = daemon->servers; serv; serv=serv->next)
1419 if (qtype == F_DNSSECOK && !(serv->flags & SERV_DO_DNSSEC))
1420 @@ -137,9 +137,9 @@ static unsigned int search_servers(time_
1423 if (serv->addr.sa.sa_family == AF_INET)
1424 - *addrpp = (struct all_addr *)&serv->addr.in.sin_addr;
1425 + *addrpp = (union all_addr *)&serv->addr.in.sin_addr;
1427 - *addrpp = (struct all_addr *)&serv->addr.in6.sin6_addr;
1428 + *addrpp = (union all_addr *)&serv->addr.in6.sin6_addr;
1430 else if (!flags || (flags & F_NXDOMAIN))
1432 @@ -195,9 +195,9 @@ static unsigned int search_servers(time_
1435 if (serv->addr.sa.sa_family == AF_INET)
1436 - *addrpp = (struct all_addr *)&serv->addr.in.sin_addr;
1437 + *addrpp = (union all_addr *)&serv->addr.in.sin_addr;
1439 - *addrpp = (struct all_addr *)&serv->addr.in6.sin6_addr;
1440 + *addrpp = (union all_addr *)&serv->addr.in6.sin6_addr;
1442 else if (!flags || (flags & F_NXDOMAIN))
1444 @@ -239,13 +239,13 @@ static unsigned int search_servers(time_
1447 static int forward_query(int udpfd, union mysockaddr *udpaddr,
1448 - struct all_addr *dst_addr, unsigned int dst_iface,
1449 + union all_addr *dst_addr, unsigned int dst_iface,
1450 struct dns_header *header, size_t plen, time_t now,
1451 struct frec *forward, int ad_reqd, int do_bit)
1453 char *domain = NULL;
1454 int type = SERV_DO_DNSSEC, norebind = 0;
1455 - struct all_addr *addrp = NULL;
1456 + union all_addr *addrp = NULL;
1457 unsigned int flags = 0;
1458 struct server *start = NULL;
1460 @@ -289,9 +289,9 @@ static int forward_query(int udpfd, unio
1461 PUTSHORT(SAFE_PKTSZ, pheader);
1463 if (forward->sentto->addr.sa.sa_family == AF_INET)
1464 - log_query(F_NOEXTRA | F_DNSSEC | F_IPV4, "retry", (struct all_addr *)&forward->sentto->addr.in.sin_addr, "dnssec");
1465 + log_query(F_NOEXTRA | F_DNSSEC | F_IPV4, "retry", (union all_addr *)&forward->sentto->addr.in.sin_addr, "dnssec");
1467 - log_query(F_NOEXTRA | F_DNSSEC | F_IPV6, "retry", (struct all_addr *)&forward->sentto->addr.in6.sin6_addr, "dnssec");
1468 + log_query(F_NOEXTRA | F_DNSSEC | F_IPV6, "retry", (union all_addr *)&forward->sentto->addr.in6.sin6_addr, "dnssec");
1471 if (forward->sentto->sfd)
1472 @@ -523,10 +523,10 @@ static int forward_query(int udpfd, unio
1473 strcpy(daemon->namebuff, "query");
1474 if (start->addr.sa.sa_family == AF_INET)
1475 log_query(F_SERVER | F_IPV4 | F_FORWARD, daemon->namebuff,
1476 - (struct all_addr *)&start->addr.in.sin_addr, NULL);
1477 + (union all_addr *)&start->addr.in.sin_addr, NULL);
1479 log_query(F_SERVER | F_IPV6 | F_FORWARD, daemon->namebuff,
1480 - (struct all_addr *)&start->addr.in6.sin6_addr, NULL);
1481 + (union all_addr *)&start->addr.in6.sin6_addr, NULL);
1484 forward->sentto = start;
1485 @@ -657,8 +657,8 @@ static size_t process_reply(struct dns_h
1487 if (rcode != NOERROR && rcode != NXDOMAIN)
1489 - struct all_addr a;
1490 - a.addr.log.rcode = rcode;
1492 + a.log.rcode = rcode;
1493 log_query(F_UPSTREAM | F_RCODE, "error", &a, NULL);
1495 return resize_packet(header, n, pheader, plen);
1496 @@ -877,9 +877,9 @@ void reply_query(int fd, int family, tim
1497 sa_len(&start->addr))));
1499 if (start->addr.sa.sa_family == AF_INET)
1500 - log_query(F_NOEXTRA | F_DNSSEC | F_IPV4, "retry", (struct all_addr *)&start->addr.in.sin_addr, "dnssec");
1501 + log_query(F_NOEXTRA | F_DNSSEC | F_IPV4, "retry", (union all_addr *)&start->addr.in.sin_addr, "dnssec");
1503 - log_query(F_NOEXTRA | F_DNSSEC | F_IPV6, "retry", (struct all_addr *)&start->addr.in6.sin6_addr, "dnssec");
1504 + log_query(F_NOEXTRA | F_DNSSEC | F_IPV6, "retry", (union all_addr *)&start->addr.in6.sin6_addr, "dnssec");
1508 @@ -1094,10 +1094,10 @@ void reply_query(int fd, int family, tim
1509 daemon->keyname, forward->class, querytype, server->edns_pktsz);
1511 if (server->addr.sa.sa_family == AF_INET)
1512 - log_query(F_NOEXTRA | F_DNSSEC | F_IPV4, daemon->keyname, (struct all_addr *)&(server->addr.in.sin_addr),
1513 + log_query(F_NOEXTRA | F_DNSSEC | F_IPV4, daemon->keyname, (union all_addr *)&(server->addr.in.sin_addr),
1514 querystr("dnssec-query", querytype));
1516 - log_query(F_NOEXTRA | F_DNSSEC | F_IPV6, daemon->keyname, (struct all_addr *)&(server->addr.in6.sin6_addr),
1517 + log_query(F_NOEXTRA | F_DNSSEC | F_IPV6, daemon->keyname, (union all_addr *)&(server->addr.in6.sin6_addr),
1518 querystr("dnssec-query", querytype));
1520 if ((hash = hash_questions(header, nn, daemon->namebuff)))
1521 @@ -1244,7 +1244,7 @@ void receive_query(struct listener *list
1522 union mysockaddr source_addr;
1523 unsigned char *pheader;
1524 unsigned short type, udp_size = PACKETSZ; /* default if no EDNS0 */
1525 - struct all_addr dst_addr;
1526 + union all_addr dst_addr;
1527 struct in_addr netmask, dst_addr_4;
1530 @@ -1274,7 +1274,7 @@ void receive_query(struct listener *list
1531 /* packet buffer overwritten */
1532 daemon->srv_save = NULL;
1534 - dst_addr_4.s_addr = dst_addr.addr.addr4.s_addr = 0;
1535 + dst_addr_4.s_addr = dst_addr.addr4.s_addr = 0;
1538 if (option_bool(OPT_NOWILD) && listen->iface)
1539 @@ -1283,7 +1283,7 @@ void receive_query(struct listener *list
1541 if (listen->family == AF_INET)
1543 - dst_addr_4 = dst_addr.addr.addr4 = listen->iface->addr.in.sin_addr;
1544 + dst_addr_4 = dst_addr.addr4 = listen->iface->addr.in.sin_addr;
1545 netmask = listen->iface->netmask;
1548 @@ -1337,7 +1337,7 @@ void receive_query(struct listener *list
1550 for (addr = daemon->interface_addrs; addr; addr = addr->next)
1551 if ((addr->flags & ADDRLIST_IPV6) &&
1552 - is_same_net6(&addr->addr.addr.addr6, &source_addr.in6.sin6_addr, addr->prefixlen))
1553 + is_same_net6(&addr->addr.addr6, &source_addr.in6.sin6_addr, addr->prefixlen))
1557 @@ -1347,7 +1347,7 @@ void receive_query(struct listener *list
1559 netmask.s_addr = htonl(~(in_addr_t)0 << (32 - addr->prefixlen));
1560 if (!(addr->flags & ADDRLIST_IPV6) &&
1561 - is_same_net(addr->addr.addr.addr4, source_addr.in.sin_addr, netmask))
1562 + is_same_net(addr->addr.addr4, source_addr.in.sin_addr, netmask))
1566 @@ -1380,7 +1380,7 @@ void receive_query(struct listener *list
1567 struct in_pktinfo *p;
1569 p.c = CMSG_DATA(cmptr);
1570 - dst_addr_4 = dst_addr.addr.addr4 = p.p->ipi_spec_dst;
1571 + dst_addr_4 = dst_addr.addr4 = p.p->ipi_spec_dst;
1572 if_index = p.p->ipi_ifindex;
1574 #elif defined(IP_RECVDSTADDR) && defined(IP_RECVIF)
1575 @@ -1398,7 +1398,7 @@ void receive_query(struct listener *list
1577 p.c = CMSG_DATA(cmptr);
1578 if (cmptr->cmsg_level == IPPROTO_IP && cmptr->cmsg_type == IP_RECVDSTADDR)
1579 - dst_addr_4 = dst_addr.addr.addr4 = *(p.a);
1580 + dst_addr_4 = dst_addr.addr4 = *(p.a);
1581 else if (cmptr->cmsg_level == IPPROTO_IP && cmptr->cmsg_type == IP_RECVIF)
1582 #ifdef HAVE_SOLARIS_NETWORK
1584 @@ -1420,7 +1420,7 @@ void receive_query(struct listener *list
1586 p.c = CMSG_DATA(cmptr);
1588 - dst_addr.addr.addr6 = p.p->ipi6_addr;
1589 + dst_addr.addr6 = p.p->ipi6_addr;
1590 if_index = p.p->ipi6_ifindex;
1593 @@ -1486,10 +1486,10 @@ void receive_query(struct listener *list
1595 if (listen->family == AF_INET)
1596 log_query(F_QUERY | F_IPV4 | F_FORWARD, daemon->namebuff,
1597 - (struct all_addr *)&source_addr.in.sin_addr, types);
1598 + (union all_addr *)&source_addr.in.sin_addr, types);
1600 log_query(F_QUERY | F_IPV6 | F_FORWARD, daemon->namebuff,
1601 - (struct all_addr *)&source_addr.in6.sin6_addr, types);
1602 + (union all_addr *)&source_addr.in6.sin6_addr, types);
1605 /* find queries for zones we're authoritative for, and answer them directly */
1606 @@ -1696,10 +1696,10 @@ static int tcp_key_recurse(time_t now, i
1609 if (server->addr.sa.sa_family == AF_INET)
1610 - log_query(F_NOEXTRA | F_DNSSEC | F_IPV4, keyname, (struct all_addr *)&(server->addr.in.sin_addr),
1611 + log_query(F_NOEXTRA | F_DNSSEC | F_IPV4, keyname, (union all_addr *)&(server->addr.in.sin_addr),
1612 querystr("dnssec-query", new_status == STAT_NEED_KEY ? T_DNSKEY : T_DS));
1614 - log_query(F_NOEXTRA | F_DNSSEC | F_IPV6, keyname, (struct all_addr *)&(server->addr.in6.sin6_addr),
1615 + log_query(F_NOEXTRA | F_DNSSEC | F_IPV6, keyname, (union all_addr *)&(server->addr.in6.sin6_addr),
1616 querystr("dnssec-query", new_status == STAT_NEED_KEY ? T_DNSKEY : T_DS));
1618 server->flags |= SERV_GOT_TCP;
1619 @@ -1764,12 +1764,12 @@ unsigned char *tcp_request(int confd, ti
1620 /* Get connection mark of incoming query to set on outgoing connections. */
1621 if (option_bool(OPT_CONNTRACK))
1623 - struct all_addr local;
1624 + union all_addr local;
1626 if (local_addr->sa.sa_family == AF_INET6)
1627 - local.addr.addr6 = local_addr->in6.sin6_addr;
1628 + local.addr6 = local_addr->in6.sin6_addr;
1630 - local.addr.addr4 = local_addr->in.sin_addr;
1631 + local.addr4 = local_addr->in.sin_addr;
1633 have_mark = get_incoming_mark(&peer_addr, &local, 1, &mark);
1635 @@ -1784,7 +1784,7 @@ unsigned char *tcp_request(int confd, ti
1637 for (addr = daemon->interface_addrs; addr; addr = addr->next)
1638 if ((addr->flags & ADDRLIST_IPV6) &&
1639 - is_same_net6(&addr->addr.addr.addr6, &peer_addr.in6.sin6_addr, addr->prefixlen))
1640 + is_same_net6(&addr->addr.addr6, &peer_addr.in6.sin6_addr, addr->prefixlen))
1644 @@ -1794,7 +1794,7 @@ unsigned char *tcp_request(int confd, ti
1646 netmask.s_addr = htonl(~(in_addr_t)0 << (32 - addr->prefixlen));
1647 if (!(addr->flags & ADDRLIST_IPV6) &&
1648 - is_same_net(addr->addr.addr.addr4, peer_addr.in.sin_addr, netmask))
1649 + is_same_net(addr->addr.addr4, peer_addr.in.sin_addr, netmask))
1653 @@ -1841,10 +1841,10 @@ unsigned char *tcp_request(int confd, ti
1655 if (peer_addr.sa.sa_family == AF_INET)
1656 log_query(F_QUERY | F_IPV4 | F_FORWARD, daemon->namebuff,
1657 - (struct all_addr *)&peer_addr.in.sin_addr, types);
1658 + (union all_addr *)&peer_addr.in.sin_addr, types);
1660 log_query(F_QUERY | F_IPV6 | F_FORWARD, daemon->namebuff,
1661 - (struct all_addr *)&peer_addr.in6.sin6_addr, types);
1662 + (union all_addr *)&peer_addr.in6.sin6_addr, types);
1665 /* find queries for zones we're authoritative for, and answer them directly */
1666 @@ -1900,7 +1900,7 @@ unsigned char *tcp_request(int confd, ti
1669 unsigned int flags = 0;
1670 - struct all_addr *addrp = NULL;
1671 + union all_addr *addrp = NULL;
1672 int type = SERV_DO_DNSSEC;
1673 char *domain = NULL;
1674 unsigned char *oph = find_pseudoheader(header, size, NULL, NULL, NULL, NULL);
1675 @@ -2019,10 +2019,10 @@ unsigned char *tcp_request(int confd, ti
1677 if (last_server->addr.sa.sa_family == AF_INET)
1678 log_query(F_SERVER | F_IPV4 | F_FORWARD, daemon->namebuff,
1679 - (struct all_addr *)&last_server->addr.in.sin_addr, NULL);
1680 + (union all_addr *)&last_server->addr.in.sin_addr, NULL);
1682 log_query(F_SERVER | F_IPV6 | F_FORWARD, daemon->namebuff,
1683 - (struct all_addr *)&last_server->addr.in6.sin6_addr, NULL);
1684 + (union all_addr *)&last_server->addr.in6.sin6_addr, NULL);
1687 if (option_bool(OPT_DNSSEC_VALID) && !checking_disabled && (last_server->flags & SERV_DO_DNSSEC))
1690 @@ -831,7 +831,7 @@ void queue_tftp(off_t file_len, char *fi
1694 -void queue_arp(int action, unsigned char *mac, int maclen, int family, struct all_addr *addr)
1695 +void queue_arp(int action, unsigned char *mac, int maclen, int family, union all_addr *addr)
1698 if (daemon->helperfd == -1)
1699 @@ -844,9 +844,9 @@ void queue_arp(int action, unsigned char
1700 buf->hwaddr_len = maclen;
1701 buf->hwaddr_type = ARPHRD_ETHER;
1702 if ((buf->flags = family) == AF_INET)
1703 - buf->addr = addr->addr.addr4;
1704 + buf->addr = addr->addr4;
1706 - buf->addr6 = addr->addr.addr6;
1707 + buf->addr6 = addr->addr6;
1709 memcpy(buf->hwaddr, mac, maclen);
1713 @@ -114,7 +114,7 @@ void ipset_init(void)
1714 die (_("failed to create IPset control socket: %s"), NULL, EC_MISC);
1717 -static int new_add_to_ipset(const char *setname, const struct all_addr *ipaddr, int af, int remove)
1718 +static int new_add_to_ipset(const char *setname, const union all_addr *ipaddr, int af, int remove)
1720 struct nlmsghdr *nlh;
1721 struct my_nfgenmsg *nfg;
1722 @@ -152,7 +152,7 @@ static int new_add_to_ipset(const char *
1723 nested[1]->nla_type = NLA_F_NESTED | IPSET_ATTR_IP;
1725 (af == AF_INET ? IPSET_ATTR_IPADDR_IPV4 : IPSET_ATTR_IPADDR_IPV6) | NLA_F_NET_BYTEORDER,
1726 - addrsz, &ipaddr->addr);
1728 nested[1]->nla_len = (void *)buffer + NL_ALIGN(nlh->nlmsg_len) - (void *)nested[1];
1729 nested[0]->nla_len = (void *)buffer + NL_ALIGN(nlh->nlmsg_len) - (void *)nested[0];
1731 @@ -163,7 +163,7 @@ static int new_add_to_ipset(const char *
1735 -static int old_add_to_ipset(const char *setname, const struct all_addr *ipaddr, int remove)
1736 +static int old_add_to_ipset(const char *setname, const union all_addr *ipaddr, int remove)
1739 struct ip_set_req_adt_get {
1740 @@ -195,7 +195,7 @@ static int old_add_to_ipset(const char *
1742 req_adt.op = remove ? 0x102 : 0x101;
1743 req_adt.index = req_adt_get.set.index;
1744 - req_adt.ip = ntohl(ipaddr->addr.addr4.s_addr);
1745 + req_adt.ip = ntohl(ipaddr->addr4.s_addr);
1746 if (setsockopt(ipset_sock, SOL_IP, 83, &req_adt, sizeof(req_adt)) < 0)
1749 @@ -204,7 +204,7 @@ static int old_add_to_ipset(const char *
1753 -int add_to_ipset(const char *setname, const struct all_addr *ipaddr, int flags, int remove)
1754 +int add_to_ipset(const char *setname, const union all_addr *ipaddr, int flags, int remove)
1756 int ret = 0, af = AF_INET;
1760 @@ -24,7 +24,7 @@ static int dns_dirty, file_dirty, leases
1761 static int read_leases(time_t now, FILE *leasestream)
1764 - struct all_addr addr;
1765 + union all_addr addr;
1766 struct dhcp_lease *lease;
1767 int clid_len, hw_len, hw_type;
1769 @@ -62,9 +62,9 @@ static int read_leases(time_t now, FILE
1770 daemon->namebuff, daemon->dhcp_buff, daemon->packet) != 3)
1773 - if (inet_pton(AF_INET, daemon->namebuff, &addr.addr.addr4))
1774 + if (inet_pton(AF_INET, daemon->namebuff, &addr.addr4))
1776 - if ((lease = lease4_allocate(addr.addr.addr4)))
1777 + if ((lease = lease4_allocate(addr.addr4)))
1778 domain = get_domain(lease->addr);
1780 hw_len = parse_hex(daemon->dhcp_buff2, (unsigned char *)daemon->dhcp_buff2, DHCP_CHADDR_MAX, NULL, &hw_type);
1781 @@ -73,7 +73,7 @@ static int read_leases(time_t now, FILE
1782 hw_type = ARPHRD_ETHER;
1785 - else if (inet_pton(AF_INET6, daemon->namebuff, &addr.addr.addr6))
1786 + else if (inet_pton(AF_INET6, daemon->namebuff, &addr.addr6))
1788 char *s = daemon->dhcp_buff2;
1789 int lease_type = LEASE_NA;
1790 @@ -84,7 +84,7 @@ static int read_leases(time_t now, FILE
1794 - if ((lease = lease6_allocate(&addr.addr.addr6, lease_type)))
1795 + if ((lease = lease6_allocate(&addr.addr6, lease_type)))
1797 lease_set_iaid(lease, strtoul(s, NULL, 10));
1798 domain = get_domain6(&lease->addr6);
1799 @@ -514,28 +514,28 @@ void lease_update_dns(int force)
1800 if (slaac->backoff == 0)
1803 - cache_add_dhcp_entry(lease->fqdn, AF_INET6, (struct all_addr *)&slaac->addr, lease->expires);
1804 + cache_add_dhcp_entry(lease->fqdn, AF_INET6, (union all_addr *)&slaac->addr, lease->expires);
1805 if (!option_bool(OPT_DHCP_FQDN) && lease->hostname)
1806 - cache_add_dhcp_entry(lease->hostname, AF_INET6, (struct all_addr *)&slaac->addr, lease->expires);
1807 + cache_add_dhcp_entry(lease->hostname, AF_INET6, (union all_addr *)&slaac->addr, lease->expires);
1812 cache_add_dhcp_entry(lease->fqdn, prot,
1813 - prot == AF_INET ? (struct all_addr *)&lease->addr : (struct all_addr *)&lease->addr6,
1814 + prot == AF_INET ? (union all_addr *)&lease->addr : (union all_addr *)&lease->addr6,
1817 if (!option_bool(OPT_DHCP_FQDN) && lease->hostname)
1818 cache_add_dhcp_entry(lease->hostname, prot,
1819 - prot == AF_INET ? (struct all_addr *)&lease->addr : (struct all_addr *)&lease->addr6,
1820 + prot == AF_INET ? (union all_addr *)&lease->addr : (union all_addr *)&lease->addr6,
1825 - cache_add_dhcp_entry(lease->fqdn, prot, (struct all_addr *)&lease->addr, lease->expires);
1826 + cache_add_dhcp_entry(lease->fqdn, prot, (union all_addr *)&lease->addr, lease->expires);
1828 if (!option_bool(OPT_DHCP_FQDN) && lease->hostname)
1829 - cache_add_dhcp_entry(lease->hostname, prot, (struct all_addr *)&lease->addr, lease->expires);
1830 + cache_add_dhcp_entry(lease->hostname, prot, (union all_addr *)&lease->addr, lease->expires);
1836 @@ -109,7 +109,7 @@ int indextoname(int fd, int index, char
1840 -int iface_check(int family, struct all_addr *addr, char *name, int *auth)
1841 +int iface_check(int family, union all_addr *addr, char *name, int *auth)
1844 int ret = 1, match_addr = 0;
1845 @@ -135,11 +135,11 @@ int iface_check(int family, struct all_a
1846 if (tmp->addr.sa.sa_family == family)
1848 if (family == AF_INET &&
1849 - tmp->addr.in.sin_addr.s_addr == addr->addr.addr4.s_addr)
1850 + tmp->addr.in.sin_addr.s_addr == addr->addr4.s_addr)
1851 ret = match_addr = tmp->used = 1;
1852 else if (family == AF_INET6 &&
1853 IN6_ARE_ADDR_EQUAL(&tmp->addr.in6.sin6_addr,
1854 - &addr->addr.addr6))
1856 ret = match_addr = tmp->used = 1;
1859 @@ -158,10 +158,10 @@ int iface_check(int family, struct all_a
1862 else if (addr && tmp->addr.sa.sa_family == AF_INET && family == AF_INET &&
1863 - tmp->addr.in.sin_addr.s_addr == addr->addr.addr4.s_addr)
1864 + tmp->addr.in.sin_addr.s_addr == addr->addr4.s_addr)
1866 else if (addr && tmp->addr.sa.sa_family == AF_INET6 && family == AF_INET6 &&
1867 - IN6_ARE_ADDR_EQUAL(&tmp->addr.in6.sin6_addr, &addr->addr.addr6))
1868 + IN6_ARE_ADDR_EQUAL(&tmp->addr.in6.sin6_addr, &addr->addr6))
1872 @@ -179,7 +179,7 @@ int iface_check(int family, struct all_a
1873 an interface other than the loopback. Accept packet if it arrived via a loopback
1874 interface, even when we're not accepting packets that way, as long as the destination
1875 address is one we're believing. Interface list must be up-to-date before calling. */
1876 -int loopback_exception(int fd, int family, struct all_addr *addr, char *name)
1877 +int loopback_exception(int fd, int family, union all_addr *addr, char *name)
1881 @@ -193,10 +193,10 @@ int loopback_exception(int fd, int famil
1883 if (family == AF_INET)
1885 - if (iface->addr.in.sin_addr.s_addr == addr->addr.addr4.s_addr)
1886 + if (iface->addr.in.sin_addr.s_addr == addr->addr4.s_addr)
1889 - else if (IN6_ARE_ADDR_EQUAL(&iface->addr.in6.sin6_addr, &addr->addr.addr6))
1890 + else if (IN6_ARE_ADDR_EQUAL(&iface->addr.in6.sin6_addr, &addr->addr6))
1894 @@ -207,7 +207,7 @@ int loopback_exception(int fd, int famil
1895 on the relevant address, but the name of the arrival interface, derived from the
1896 index won't match the config. Check that we found an interface address for the arrival
1897 interface: daemon->interfaces must be up-to-date. */
1898 -int label_exception(int index, int family, struct all_addr *addr)
1899 +int label_exception(int index, int family, union all_addr *addr)
1903 @@ -217,7 +217,7 @@ int label_exception(int index, int famil
1905 for (iface = daemon->interfaces; iface; iface = iface->next)
1906 if (iface->index == index && iface->addr.sa.sa_family == AF_INET &&
1907 - iface->addr.in.sin_addr.s_addr == addr->addr.addr4.s_addr)
1908 + iface->addr.in.sin_addr.s_addr == addr->addr4.s_addr)
1912 @@ -282,12 +282,12 @@ static int iface_allowed(struct iface_pa
1914 if (addr->sa.sa_family == AF_INET)
1916 - al->addr.addr.addr4 = addr->in.sin_addr;
1917 + al->addr.addr4 = addr->in.sin_addr;
1922 - al->addr.addr.addr6 = addr->in6.sin6_addr;
1923 + al->addr.addr6 = addr->in6.sin6_addr;
1924 al->flags = ADDRLIST_IPV6;
1927 @@ -321,7 +321,7 @@ static int iface_allowed(struct iface_pa
1928 al->next = zone->subnet;
1930 al->prefixlen = prefixlen;
1931 - al->addr.addr.addr4 = addr->in.sin_addr;
1932 + al->addr.addr4 = addr->in.sin_addr;
1936 @@ -341,7 +341,7 @@ static int iface_allowed(struct iface_pa
1937 al->next = zone->subnet;
1939 al->prefixlen = prefixlen;
1940 - al->addr.addr.addr6 = addr->in6.sin6_addr;
1941 + al->addr.addr6 = addr->in6.sin6_addr;
1942 al->flags = ADDRLIST_IPV6;
1945 @@ -369,12 +369,12 @@ static int iface_allowed(struct iface_pa
1947 if (addr->sa.sa_family == AF_INET)
1949 - al->addr.addr.addr4 = addr->in.sin_addr;
1950 + al->addr.addr4 = addr->in.sin_addr;
1955 - al->addr.addr.addr6 = addr->in6.sin6_addr;
1956 + al->addr.addr6 = addr->in6.sin6_addr;
1957 al->flags = ADDRLIST_IPV6;
1958 /* Privacy addresses and addresses still undergoing DAD and deprecated addresses
1959 don't appear in forward queries, but will in reverse ones. */
1960 @@ -419,11 +419,11 @@ static int iface_allowed(struct iface_pa
1963 if (addr->sa.sa_family == AF_INET &&
1964 - !iface_check(AF_INET, (struct all_addr *)&addr->in.sin_addr, label, &auth_dns))
1965 + !iface_check(AF_INET, (union all_addr *)&addr->in.sin_addr, label, &auth_dns))
1968 if (addr->sa.sa_family == AF_INET6 &&
1969 - !iface_check(AF_INET6, (struct all_addr *)&addr->in6.sin6_addr, label, &auth_dns))
1970 + !iface_check(AF_INET6, (union all_addr *)&addr->in6.sin6_addr, label, &auth_dns))
1976 @@ -2064,7 +2064,7 @@ static int one_opt(int option, char *arg
1979 struct addrlist *subnet = NULL;
1980 - struct all_addr addr;
1981 + union all_addr addr;
1984 prefix = split_chr(arg, '/');
1985 @@ -2078,13 +2078,13 @@ static int one_opt(int option, char *arg
1989 - if (inet_pton(AF_INET, arg, &addr.addr.addr4))
1990 + if (inet_pton(AF_INET, arg, &addr.addr4))
1992 subnet = opt_malloc(sizeof(struct addrlist));
1993 subnet->prefixlen = (prefixlen == 0) ? 24 : prefixlen;
1994 subnet->flags = ADDRLIST_LITERAL;
1996 - else if (inet_pton(AF_INET6, arg, &addr.addr.addr6))
1997 + else if (inet_pton(AF_INET6, arg, &addr.addr6))
1999 subnet = opt_malloc(sizeof(struct addrlist));
2000 subnet->prefixlen = (prefixlen == 0) ? 64 : prefixlen;
2001 @@ -4268,7 +4268,7 @@ err:
2005 - struct all_addr addr;
2006 + union all_addr addr;
2009 for (dig = arg; *dig != 0; dig++)
2010 @@ -4276,10 +4276,10 @@ err:
2013 new->ttl = atoi(arg);
2014 - else if (inet_pton(AF_INET, arg, &addr))
2015 - new->addr = addr.addr.addr4;
2016 - else if (inet_pton(AF_INET6, arg, &addr))
2017 - new->addr6 = addr.addr.addr6;
2018 + else if (inet_pton(AF_INET, arg, &addr.addr4))
2019 + new->addr = addr.addr4;
2020 + else if (inet_pton(AF_INET6, arg, &addr.addr6))
2021 + new->addr6 = addr.addr6;
2027 @@ -143,7 +143,7 @@ int extract_name(struct dns_header *head
2029 /* Max size of input string (for IPv6) is 75 chars.) */
2030 #define MAXARPANAME 75
2031 -int in_arpa_name_2_addr(char *namein, struct all_addr *addrp)
2032 +int in_arpa_name_2_addr(char *namein, union all_addr *addrp)
2035 char name[MAXARPANAME+1], *cp1;
2036 @@ -153,7 +153,7 @@ int in_arpa_name_2_addr(char *namein, st
2037 if (strlen(namein) > MAXARPANAME)
2040 - memset(addrp, 0, sizeof(struct all_addr));
2041 + memset(addrp, 0, sizeof(union all_addr));
2043 /* turn name into a series of asciiz strings */
2044 /* j counts no. of labels */
2045 @@ -234,7 +234,7 @@ int in_arpa_name_2_addr(char *namein, st
2046 if (*(cp1+1) || !isxdigit((unsigned char)*cp1))
2049 - for (j = sizeof(struct all_addr)-1; j>0; j--)
2050 + for (j = sizeof(struct in6_addr)-1; j>0; j--)
2051 addr[j] = (addr[j] >> 4) | (addr[j-1] << 4);
2052 addr[0] = (addr[0] >> 4) | (strtol(cp1, NULL, 16) << 4);
2054 @@ -585,7 +585,7 @@ int extract_addresses(struct dns_header
2055 unsigned char *p, *p1, *endrr, *namep;
2056 int i, j, qtype, qclass, aqtype, aqclass, ardlen, res, searched_soa = 0;
2057 unsigned long ttl = 0;
2058 - struct all_addr addr;
2059 + union all_addr addr;
2063 @@ -808,14 +808,14 @@ int extract_addresses(struct dns_header
2066 if ((flags & F_IPV4) &&
2067 - private_net(addr.addr.addr4, !option_bool(OPT_LOCAL_REBIND)))
2068 + private_net(addr.addr4, !option_bool(OPT_LOCAL_REBIND)))
2071 if ((flags & F_IPV6) &&
2072 - IN6_IS_ADDR_V4MAPPED(&addr.addr.addr6))
2073 + IN6_IS_ADDR_V4MAPPED(&addr.addr6))
2076 - v4.s_addr = ((const uint32_t *) (&addr.addr.addr6))[3];
2077 + v4.s_addr = ((const uint32_t *) (&addr.addr6))[3];
2078 if (private_net(v4, !option_bool(OPT_LOCAL_REBIND)))
2081 @@ -928,7 +928,7 @@ unsigned int extract_request(struct dns_
2084 size_t setup_reply(struct dns_header *header, size_t qlen,
2085 - struct all_addr *addrp, unsigned int flags, unsigned long ttl)
2086 + union all_addr *addrp, unsigned int flags, unsigned long ttl)
2090 @@ -949,8 +949,8 @@ size_t setup_reply(struct dns_header *he
2091 SET_RCODE(header, NXDOMAIN);
2092 else if (flags == F_SERVFAIL)
2094 - struct all_addr a;
2095 - a.addr.log.rcode = SERVFAIL;
2097 + a.log.rcode = SERVFAIL;
2098 log_query(F_CONFIG | F_RCODE, "error", &a, NULL);
2099 SET_RCODE(header, SERVFAIL);
2101 @@ -974,8 +974,8 @@ size_t setup_reply(struct dns_header *he
2103 else /* nowhere to forward to */
2105 - struct all_addr a;
2106 - a.addr.log.rcode = REFUSED;
2108 + a.log.rcode = REFUSED;
2109 log_query(F_CONFIG | F_RCODE, "error", &a, NULL);
2110 SET_RCODE(header, REFUSED);
2112 @@ -1277,7 +1277,7 @@ size_t answer_request(struct dns_header
2113 char *name = daemon->namebuff;
2114 unsigned char *p, *ansp;
2115 unsigned int qtype, qclass;
2116 - struct all_addr addr;
2117 + union all_addr addr;
2119 unsigned short flag;
2120 int q, ans, anscount = 0, addncount = 0;
2121 @@ -1374,7 +1374,7 @@ size_t answer_request(struct dns_header
2122 notimp = 1, auth = 0;
2125 - addr.addr.log.rcode = NOTIMP;
2126 + addr.log.rcode = NOTIMP;
2127 log_query(F_CONFIG | F_RCODE, name, &addr, NULL);
2129 ans = 1, sec_data = 0;
2130 @@ -1418,7 +1418,7 @@ size_t answer_request(struct dns_header
2131 struct addrlist *addrlist;
2133 for (addrlist = intr->addr; addrlist; addrlist = addrlist->next)
2134 - if (!(addrlist->flags & ADDRLIST_IPV6) && addr.addr.addr4.s_addr == addrlist->addr.addr.addr4.s_addr)
2135 + if (!(addrlist->flags & ADDRLIST_IPV6) && addr.addr4.s_addr == addrlist->addr.addr4.s_addr)
2139 @@ -1433,7 +1433,7 @@ size_t answer_request(struct dns_header
2140 struct addrlist *addrlist;
2142 for (addrlist = intr->addr; addrlist; addrlist = addrlist->next)
2143 - if ((addrlist->flags & ADDRLIST_IPV6) && IN6_ARE_ADDR_EQUAL(&addr.addr.addr6, &addrlist->addr.addr.addr6))
2144 + if ((addrlist->flags & ADDRLIST_IPV6) && IN6_ARE_ADDR_EQUAL(&addr.addr6, &addrlist->addr.addr6))
2148 @@ -1533,8 +1533,8 @@ size_t answer_request(struct dns_header
2151 else if (option_bool(OPT_BOGUSPRIV) && (
2152 - (is_arpa == F_IPV6 && private_net6(&addr.addr.addr6)) ||
2153 - (is_arpa == F_IPV4 && private_net(addr.addr.addr4, 1))))
2154 + (is_arpa == F_IPV6 && private_net6(&addr.addr6)) ||
2155 + (is_arpa == F_IPV4 && private_net(addr.addr4, 1))))
2157 struct server *serv;
2158 unsigned int namelen = strlen(name);
2159 @@ -1600,7 +1600,7 @@ size_t answer_request(struct dns_header
2160 if (hostname_isequal(name, intr->name))
2161 for (addrlist = intr->addr; addrlist; addrlist = addrlist->next)
2162 if (!(addrlist->flags & ADDRLIST_IPV6) &&
2163 - is_same_net(*((struct in_addr *)&addrlist->addr), local_addr, local_netmask))
2164 + is_same_net(addrlist->addr.addr4, local_addr, local_netmask))
2168 @@ -1613,7 +1613,7 @@ size_t answer_request(struct dns_header
2169 if (((addrlist->flags & ADDRLIST_IPV6) ? T_AAAA : T_A) == type)
2172 - !is_same_net(*((struct in_addr *)&addrlist->addr), local_addr, local_netmask))
2173 + !is_same_net(addrlist->addr.addr4, local_addr, local_netmask))
2176 if (addrlist->flags & ADDRLIST_REVONLY)
2177 @@ -1651,7 +1651,7 @@ size_t answer_request(struct dns_header
2178 struct crec *save = crecp;
2180 if ((crecp->flags & F_HOSTS) &&
2181 - is_same_net(*((struct in_addr *)&crecp->addr), local_addr, local_netmask))
2182 + is_same_net(crecp->addr.addr4, local_addr, local_netmask))
2186 @@ -1710,7 +1710,7 @@ size_t answer_request(struct dns_header
2189 (crecp->flags & F_HOSTS) &&
2190 - !is_same_net(*((struct in_addr *)&crecp->addr), local_addr, local_netmask))
2191 + !is_same_net(crecp->addr.addr4, local_addr, local_netmask))
2194 if (!(crecp->flags & (F_HOSTS | F_DHCP)))
2195 @@ -1719,7 +1719,7 @@ size_t answer_request(struct dns_header
2199 - log_query(crecp->flags & ~F_REVERSE, name, &crecp->addr.addr,
2200 + log_query(crecp->flags & ~F_REVERSE, name, &crecp->addr,
2201 record_source(crecp->uid));
2203 if (add_resource_record(header, limit, &trunc, nameoffset, &ansp,
2206 @@ -2120,7 +2120,7 @@ void relay_upstream6(struct dhcp_relay *
2208 /* ->local is same value for all relays on ->current chain */
2210 - struct all_addr from;
2211 + union all_addr from;
2212 unsigned char *header;
2213 unsigned char *inbuff = daemon->dhcp_packet.iov_base;
2214 int msg_type = *inbuff;
2215 @@ -2133,7 +2133,7 @@ void relay_upstream6(struct dhcp_relay *
2216 get_client_mac(peer_address, scope_id, mac, &maclen, &mactype, now);
2218 /* source address == relay address */
2219 - from.addr.addr6 = relay->local.addr.addr6;
2220 + from.addr6 = relay->local.addr6;
2222 /* Get hop count from nested relayed message */
2223 if (msg_type == DHCP6RELAYFORW)
2224 @@ -2153,7 +2153,7 @@ void relay_upstream6(struct dhcp_relay *
2226 header[0] = DHCP6RELAYFORW;
2227 header[1] = hopcount;
2228 - memcpy(&header[2], &relay->local.addr.addr6, IN6ADDRSZ);
2229 + memcpy(&header[2], &relay->local.addr6, IN6ADDRSZ);
2230 memcpy(&header[18], peer_address, IN6ADDRSZ);
2233 @@ -2174,12 +2174,12 @@ void relay_upstream6(struct dhcp_relay *
2234 union mysockaddr to;
2236 to.sa.sa_family = AF_INET6;
2237 - to.in6.sin6_addr = relay->server.addr.addr6;
2238 + to.in6.sin6_addr = relay->server.addr6;
2239 to.in6.sin6_port = htons(DHCPV6_SERVER_PORT);
2240 to.in6.sin6_flowinfo = 0;
2241 to.in6.sin6_scope_id = 0;
2243 - if (IN6_ARE_ADDR_EQUAL(&relay->server.addr.addr6, &multicast))
2244 + if (IN6_ARE_ADDR_EQUAL(&relay->server.addr6, &multicast))
2246 int multicast_iface;
2247 if (!relay->interface || strchr(relay->interface, '*') ||
2248 @@ -2218,7 +2218,7 @@ unsigned short relay_reply6(struct socka
2249 memcpy(&link, &inbuff[2], IN6ADDRSZ);
2251 for (relay = daemon->relay6; relay; relay = relay->next)
2252 - if (IN6_ARE_ADDR_EQUAL(&link, &relay->local.addr.addr6) &&
2253 + if (IN6_ARE_ADDR_EQUAL(&link, &relay->local.addr6) &&
2254 (!relay->interface || wildcard_match(relay->interface, arrival_interface)))
2259 @@ -62,7 +62,7 @@ void ipset_init(void)
2263 -int add_to_ipset(const char *setname, const struct all_addr *ipaddr,
2264 +int add_to_ipset(const char *setname, const union all_addr *ipaddr,
2265 int flags, int remove)
2267 struct pfr_addr addr;
2268 @@ -113,13 +113,13 @@ int add_to_ipset(const char *setname, co
2270 addr.pfra_af = AF_INET6;
2271 addr.pfra_net = 0x80;
2272 - memcpy(&(addr.pfra_ip6addr), &(ipaddr->addr), sizeof(struct in6_addr));
2273 + memcpy(&(addr.pfra_ip6addr), ipaddr, sizeof(struct in6_addr));
2277 addr.pfra_af = AF_INET;
2278 addr.pfra_net = 0x20;
2279 - addr.pfra_ip4addr.s_addr = ipaddr->addr.addr4.s_addr;
2280 + addr.pfra_ip4addr.s_addr = ipaddr->addr4.s_addr;
2283 bzero(&io, sizeof(io));
2286 @@ -59,7 +59,7 @@ void tftp_request(struct listener *liste
2288 char *prefix = daemon->tftp_prefix;
2289 struct tftp_prefix *pref;
2290 - struct all_addr addra;
2291 + union all_addr addra;
2292 /* Can always get recvd interface for IPv6 */
2293 int check_dest = !option_bool(OPT_NOWILD) || listen->family == AF_INET6;
2295 @@ -189,10 +189,10 @@ void tftp_request(struct listener *liste
2299 - addra.addr.addr4 = addr.in.sin_addr;
2300 + addra.addr4 = addr.in.sin_addr;
2302 if (listen->family == AF_INET6)
2303 - addra.addr.addr6 = addr.in6.sin6_addr;
2304 + addra.addr6 = addr.in6.sin6_addr;
2306 if (daemon->tftp_interfaces)
2308 @@ -212,7 +212,7 @@ void tftp_request(struct listener *liste
2309 if (!option_bool(OPT_CLEVERBIND))
2310 enumerate_interfaces(0);
2311 if (!loopback_exception(listen->tftpfd, listen->family, &addra, name) &&
2312 - !label_exception(if_index, listen->family, &addra) )
2313 + !label_exception(if_index, listen->family, &addra))