1 /* $Cambridge: exim/src/src/dns.c,v 1.1 2004/10/07 10:39:01 ph10 Exp $ */
3 /*************************************************
4 * Exim - an Internet mail transport agent *
5 *************************************************/
7 /* Copyright (c) University of Cambridge 1995 - 2004 */
8 /* See the file NOTICE for conditions of use and distribution. */
10 /* Functions for interfacing with the DNS. */
15 /* Function declaration needed for mutual recursion when A6 records
20 static void dns_complete_a6(dns_address ***, dns_answer *, dns_record *,
27 /*************************************************
28 * Initialize and configure resolver *
29 *************************************************/
31 /* Initialize the resolver and the storage for holding DNS answers if this is
32 the first time we have been here, and set the resolver options.
35 qualify_single TRUE to set the RES_DEFNAMES option
36 search_parents TRUE to set the RES_DNSRCH option
42 dns_init(BOOL qualify_single, BOOL search_parents)
44 if ((_res.options & RES_INIT) == 0)
46 DEBUG(D_resolver) _res.options |= RES_DEBUG; /* For Cygwin */
48 DEBUG(D_resolver) _res.options |= RES_DEBUG;
51 _res.options &= ~(RES_DNSRCH | RES_DEFNAMES);
52 _res.options |= (qualify_single? RES_DEFNAMES : 0) |
53 (search_parents? RES_DNSRCH : 0);
54 if (dns_retrans > 0) _res.retrans = dns_retrans;
55 if (dns_retry > 0) _res.retry = dns_retry;
60 /*************************************************
61 * Build key name for PTR records *
62 *************************************************/
64 /* This function inverts an IP address and adds the relevant domain, to produce
65 a name that can be used to look up PTR records.
68 string the IP address as a string
69 buffer a suitable buffer, long enough to hold the result
75 dns_build_reverse(uschar *string, uschar *buffer)
77 uschar *p = string + Ustrlen(string);
80 /* Handle IPv4 address */
83 if (Ustrchr(string, ':') == NULL)
87 for (i = 0; i < 4; i++)
90 while (ppp > string && ppp[-1] != '.') ppp--;
91 Ustrncpy(pp, ppp, p - ppp);
96 Ustrcpy(pp, "in-addr.arpa");
99 /* Handle IPv6 address; convert to binary so as to fill out any
100 abbreviation in the textual form. */
107 (void)host_aton(string, v6);
109 /* The original specification for IPv6 reverse lookup was to invert each
110 nibble, and look in the ip6.int domain. The domain was subsequently
111 changed to ip6.arpa. */
113 for (i = 3; i >= 0; i--)
116 for (j = 0; j < 32; j += 4)
118 sprintf(CS pp, "%x.", (v6[i] >> j) & 15);
122 Ustrcpy(pp, "ip6.arpa.");
124 /* Another way of doing IPv6 reverse lookups was proposed in conjunction
125 with A6 records. However, it fell out of favour when they did. The
126 alternative was to construct a binary key, and look in ip6.arpa. I tried
127 to make this code do that, but I could not make it work on Solaris 8. The
128 resolver seems to lose the initial backslash somehow. However, now that
129 this style of reverse lookup has been dropped, it doesn't matter. These
130 lines are left here purely for historical interest. */
132 /**************************************************
136 for (i = 0; i < 4; i++)
138 sprintf(pp, "%08X", v6[i]);
141 Ustrcpy(pp, "].ip6.arpa.");
142 **************************************************/
151 /*************************************************
152 * Get next DNS record from answer block *
153 *************************************************/
155 /* Call this with reset == RESET_ANSWERS to scan the answer block, reset ==
156 RESET_ADDITIONAL to scan the additional records, and reset == RESET_NEXT to
157 get the next record. The result is in static storage which must be copied if
158 it is to be preserved.
161 dnsa pointer to dns answer block
162 dnss pointer to dns scan block
163 reset option specifing what portion to scan, as described above
165 Returns: next dns record, or NULL when no more
169 dns_next_rr(dns_answer *dnsa, dns_scan *dnss, int reset)
171 HEADER *h = (HEADER *)dnsa->answer;
174 /* Reset the saved data when requested to, and skip to the first required RR */
176 if (reset != RESET_NEXT)
178 dnss->rrcount = ntohs(h->qdcount);
179 dnss->aptr = dnsa->answer + sizeof(HEADER);
181 /* Skip over questions; failure to expand the name just gives up */
183 while (dnss->rrcount-- > 0)
185 namelen = dn_expand(dnsa->answer, dnsa->answer + dnsa->answerlen,
186 dnss->aptr, (DN_EXPAND_ARG4_TYPE) &(dnss->srr.name), DNS_MAXNAME);
187 if (namelen < 0) { dnss->rrcount = 0; return NULL; }
188 dnss->aptr += namelen + 4; /* skip name & type & class */
191 /* Get the number of answer records. */
193 dnss->rrcount = ntohs(h->ancount);
195 /* Skip over answers and NS records if wanting to look at the additional
198 if (reset == RESET_ADDITIONAL)
200 dnss->rrcount += ntohs(h->nscount);
201 while (dnss->rrcount-- > 0)
203 namelen = dn_expand(dnsa->answer, dnsa->answer + dnsa->answerlen,
204 dnss->aptr, (DN_EXPAND_ARG4_TYPE) &(dnss->srr.name), DNS_MAXNAME);
205 if (namelen < 0) { dnss->rrcount = 0; return NULL; }
206 dnss->aptr += namelen + 8; /* skip name, type, class & TTL */
207 GETSHORT(dnss->srr.size, dnss->aptr); /* size of data portion */
208 dnss->aptr += dnss->srr.size; /* skip over it */
210 dnss->rrcount = ntohs(h->arcount);
215 /* The variable dnss->aptr is now pointing at the next RR, and dnss->rrcount
216 contains the number of RR records left. */
218 if (dnss->rrcount-- <= 0) return NULL;
220 /* If expanding the RR domain name fails, behave as if no more records
223 namelen = dn_expand(dnsa->answer, dnsa->answer + dnsa->answerlen, dnss->aptr,
224 (DN_EXPAND_ARG4_TYPE) &(dnss->srr.name), DNS_MAXNAME);
225 if (namelen < 0) { dnss->rrcount = 0; return NULL; }
227 /* Move the pointer past the name and fill in the rest of the data structure
228 from the following bytes. */
230 dnss->aptr += namelen;
231 GETSHORT(dnss->srr.type, dnss->aptr); /* Record type */
232 dnss->aptr += 6; /* Don't want class or TTL */
233 GETSHORT(dnss->srr.size, dnss->aptr); /* Size of data portion */
234 dnss->srr.data = dnss->aptr; /* The record's data follows */
235 dnss->aptr += dnss->srr.size; /* Advance to next RR */
237 /* Return a pointer to the dns_record structure within the dns_answer. This is
238 for convenience so that the scans can use nice-looking for loops. */
246 /*************************************************
247 * Turn DNS type into text *
248 *************************************************/
250 /* Turn the coded record type into a string for printing.
252 Argument: record type
253 Returns: pointer to string
261 case T_A: return US"A";
262 case T_MX: return US"MX";
263 case T_AAAA: return US"AAAA";
264 case T_A6: return US"A6";
265 case T_TXT: return US"TXT";
266 case T_PTR: return US"PTR";
267 case T_SRV: return US"SRV";
268 default: return US"?";
274 /*************************************************
275 * Cache a failed DNS lookup result *
276 *************************************************/
278 /* We cache failed lookup results so as not to experience timeouts many
279 times for the same domain. We need to retain the resolver options because they
280 may change. For successful lookups, we rely on resolver and/or name server
288 Returns: the return code
292 dns_return(uschar *name, int type, int rc)
294 tree_node *node = store_get_perm(sizeof(tree_node) + 290);
295 sprintf(CS node->name, "%.255s-%s-%lx", name, dns_text_type(type),
298 (void)tree_insertnode(&tree_dns_fails, node);
304 /*************************************************
305 * Do basic DNS lookup *
306 *************************************************/
308 /* Call the resolver to look up the given domain name, using the given type,
309 and check the result. The error code TRY_AGAIN is documented as meaning "non-
310 Authoritive Host not found, or SERVERFAIL". Sometimes there are badly set
311 up nameservers that produce this error continually, so there is the option of
312 providing a list of domains for which this is treated as a non-existent
316 dnsa pointer to dns_answer structure
318 type type of DNS record required (T_A, T_MX, etc)
320 Returns: DNS_SUCCEED successful lookup
321 DNS_NOMATCH name not found (NXDOMAIN)
322 or name contains illegal characters (if checking)
323 DNS_NODATA domain exists, but no data for this type (NODATA)
324 DNS_AGAIN soft failure, try again later
329 dns_basic_lookup(dns_answer *dnsa, uschar *name, int type)
337 uschar node_name[290];
339 /* DNS lookup failures of any kind are cached in a tree. This is mainly so that
340 a timeout on one domain doesn't happen time and time again for messages that
341 have many addresses in the same domain. We rely on the resolver and name server
342 caching for successful lookups. */
344 sprintf(CS node_name, "%.255s-%s-%lx", name, dns_text_type(type),
346 previous = tree_search(tree_dns_fails, node_name);
347 if (previous != NULL)
349 DEBUG(D_dns) debug_printf("DNS lookup of %.255s-%s: using cached value %s\n",
350 name, dns_text_type(type),
351 (previous->data.val == DNS_NOMATCH)? "DNS_NOMATCH" :
352 (previous->data.val == DNS_NODATA)? "DNS_NODATA" :
353 (previous->data.val == DNS_AGAIN)? "DNS_AGAIN" :
354 (previous->data.val == DNS_FAIL)? "DNS_FAIL" : "??");
355 return previous->data.val;
358 /* If we are running in the test harness, recognize a couple of special
359 names that always give error returns. This makes it straightforward to
360 test the handling of DNS errors. */
362 if (running_in_test_harness)
364 uschar *endname = name + Ustrlen(name);
365 if (Ustrcmp(endname - 14, "test.again.dns") == 0)
367 int delay = Uatoi(name); /* digits at the start of the name */
368 DEBUG(D_dns) debug_printf("Real DNS lookup of %s (%s) bypassed for testing\n",
369 name, dns_text_type(type));
372 DEBUG(D_dns) debug_printf("delaying %d seconds\n", delay);
375 DEBUG(D_dns) debug_printf("returning DNS_AGAIN\n");
376 return dns_return(name, type, DNS_AGAIN);
378 if (Ustrcmp(endname - 13, "test.fail.dns") == 0)
380 DEBUG(D_dns) debug_printf("Real DNS lookup of %s (%s) bypassed for testing\n",
381 name, dns_text_type(type));
382 DEBUG(D_dns) debug_printf("returning DNS_FAIL\n");
383 return dns_return(name, type, DNS_FAIL);
387 /* If configured, check the hygene of the name passed to lookup. Otherwise,
388 although DNS lookups may give REFUSED at the lower level, some resolvers
389 turn this into TRY_AGAIN, which is silly. Give a NOMATCH return, since such
390 domains cannot be in the DNS. The check is now done by a regular expression;
391 give it space for substring storage to save it having to get its own if the
392 regex has substrings that are used - the default uses a conditional.
394 This test is omitted for PTR records. These occur only in calls from the dnsdb
395 lookup, which constructs the names itself, so they should be OK. Besides,
396 bitstring labels don't conform to normal name syntax. (But the aren't used any
399 For SRV records, we omit the initial _smtp._tcp. components at the start. */
401 #ifndef STAND_ALONE /* Omit this for stand-alone tests */
403 if (check_dns_names_pattern[0] != 0 && type != T_PTR)
405 uschar *checkname = name;
406 int ovector[3*(EXPAND_MAXN+1)];
408 if (regex_check_dns_names == NULL)
409 regex_check_dns_names =
410 regex_must_compile(check_dns_names_pattern, FALSE, TRUE);
412 /* For an SRV lookup, skip over the first two components (the service and
413 protocol names, which both start with an underscore). */
417 while (*checkname++ != '.');
418 while (*checkname++ != '.');
421 if (pcre_exec(regex_check_dns_names, NULL, CS checkname, Ustrlen(checkname),
422 0, PCRE_EOPT, ovector, sizeof(ovector)/sizeof(int)) < 0)
425 debug_printf("DNS name syntax check failed: %s (%s)\n", name,
426 dns_text_type(type));
427 host_find_failed_syntax = TRUE;
432 #endif /* STAND_ALONE */
434 /* Call the resolver; for an overlong response, res_search() will return the
435 number of bytes the message would need, so we need to check for this case.
436 The effect is to truncate overlong data. */
438 dnsa->answerlen = res_search(CS name, C_IN, type, dnsa->answer, MAXPACKET);
439 if (dnsa->answerlen > MAXPACKET) dnsa->answerlen = MAXPACKET;
441 if (dnsa->answerlen < 0) switch (h_errno)
444 DEBUG(D_dns) debug_printf("DNS lookup of %s (%s) gave HOST_NOT_FOUND\n"
445 "returning DNS_NOMATCH\n", name, dns_text_type(type));
446 return dns_return(name, type, DNS_NOMATCH);
449 DEBUG(D_dns) debug_printf("DNS lookup of %s (%s) gave TRY_AGAIN\n",
450 name, dns_text_type(type));
452 /* Cut this out for various test programs */
454 save = deliver_domain;
455 deliver_domain = name; /* set $domain */
456 rc = match_isinlist(name, &dns_again_means_nonexist, 0, NULL, NULL,
457 MCL_DOMAIN, TRUE, NULL);
458 deliver_domain = save;
461 DEBUG(D_dns) debug_printf("returning DNS_AGAIN\n");
462 return dns_return(name, type, DNS_AGAIN);
464 DEBUG(D_dns) debug_printf("%s is in dns_again_means_nonexist: returning "
465 "DNS_NOMATCH\n", name);
466 return dns_return(name, type, DNS_NOMATCH);
468 #else /* For stand-alone tests */
469 return dns_return(name, type, DNS_AGAIN);
473 DEBUG(D_dns) debug_printf("DNS lookup of %s (%s) gave NO_RECOVERY\n"
474 "returning DNS_FAIL\n", name, dns_text_type(type));
475 return dns_return(name, type, DNS_FAIL);
478 DEBUG(D_dns) debug_printf("DNS lookup of %s (%s) gave NO_DATA\n"
479 "returning DNS_NODATA\n", name, dns_text_type(type));
480 return dns_return(name, type, DNS_NODATA);
483 DEBUG(D_dns) debug_printf("DNS lookup of %s (%s) gave unknown DNS error %d\n"
484 "returning DNS_FAIL\n", name, dns_text_type(type), h_errno);
485 return dns_return(name, type, DNS_FAIL);
488 DEBUG(D_dns) debug_printf("DNS lookup of %s (%s) succeeded\n",
489 name, dns_text_type(type));
497 /************************************************
498 * Do a DNS lookup and handle CNAMES *
499 ************************************************/
501 /* Look up the given domain name, using the given type. Follow CNAMEs if
502 necessary, but only so many times. There aren't supposed to be CNAME chains in
503 the DNS, but you are supposed to cope with them if you find them.
505 The assumption is made that if the resolver gives back records of the
506 requested type *and* a CNAME, we don't need to make another call to look up
507 the CNAME. I can't see how it could return only some of the right records. If
508 it's done a CNAME lookup in the past, it will have all of them; if not, it
511 If fully_qualified_name is not NULL, set it to point to the full name
512 returned by the resolver, if this is different to what it is given, unless
513 the returned name starts with "*" as some nameservers seem to be returning
514 wildcards in this form.
517 dnsa pointer to dns_answer structure
518 name domain name to look up
519 type DNS record type (T_A, T_MX, etc)
520 fully_qualified_name if not NULL, return the returned name here if its
521 contents are different (i.e. it must be preset)
523 Returns: DNS_SUCCEED successful lookup
524 DNS_NOMATCH name not found
525 DNS_NODATA no data found
526 DNS_AGAIN soft failure, try again later
531 dns_lookup(dns_answer *dnsa, uschar *name, int type, uschar **fully_qualified_name)
534 uschar *orig_name = name;
536 /* Loop to follow CNAME chains so far, but no further... */
538 for (i = 0; i < 10; i++)
541 dns_record *rr, cname_rr, type_rr;
545 /* DNS lookup failures get passed straight back. */
547 if ((rc = dns_basic_lookup(dnsa, name, type)) != DNS_SUCCEED) return rc;
549 /* We should have either records of the required type, or a CNAME record,
550 or both. We need to know whether both exist for getting the fully qualified
551 name, but avoid scanning more than necessary. Note that we must copy the
552 contents of any rr blocks returned by dns_next_rr() as they use the same
553 area in the dnsa block. */
555 cname_rr.data = type_rr.data = NULL;
556 for (rr = dns_next_rr(dnsa, &dnss, RESET_ANSWERS);
558 rr = dns_next_rr(dnsa, &dnss, RESET_NEXT))
560 if (rr->type == type)
562 if (type_rr.data == NULL) type_rr = *rr;
563 if (cname_rr.data != NULL) break;
565 else if (rr->type == T_CNAME) cname_rr = *rr;
568 /* If a CNAME was found, take the fully qualified name from it; otherwise
569 from the first data record, if present. For testing, there is a magic name
570 that gets its casing adjusted, because my resolver doesn't seem to pass back
571 upper case letters in domain names. */
573 if (fully_qualified_name != NULL)
575 if (cname_rr.data != NULL)
577 if (Ustrcmp(cname_rr.name, *fully_qualified_name) != 0 &&
578 cname_rr.name[0] != '*')
579 *fully_qualified_name = string_copy_dnsdomain(cname_rr.name);
581 else if (type_rr.data != NULL)
583 if (running_in_test_harness &&
584 Ustrcmp(type_rr.name, "uppercase.test.ex") == 0)
585 *fully_qualified_name = US"UpperCase.test.ex";
588 if (Ustrcmp(type_rr.name, *fully_qualified_name) != 0 &&
589 type_rr.name[0] != '*')
590 *fully_qualified_name = string_copy_dnsdomain(type_rr.name);
595 /* If any data records of the correct type were found, we are done. */
597 if (type_rr.data != NULL) return DNS_SUCCEED;
599 /* If there are no data records, we need to re-scan the DNS using the
600 domain given in the CNAME record, which should exist (otherwise we should
601 have had a failure from dns_lookup). However code against the possibility of
604 if (cname_rr.data == NULL) return DNS_FAIL;
605 datalen = dn_expand(dnsa->answer, dnsa->answer + dnsa->answerlen,
606 cname_rr.data, (DN_EXPAND_ARG4_TYPE)data, 256);
607 if (datalen < 0) return DNS_FAIL;
609 } /* Loop back to do another lookup */
611 /*Control reaches here after 10 times round the CNAME loop. Something isn't
614 log_write(0, LOG_MAIN, "CNAME loop for %s encountered", orig_name);
620 /* Support for A6 records has been commented out since they were demoted to
621 experimental status at IETF 51. */
623 #if HAVE_IPV6 && defined(SUPPORT_A6)
625 /*************************************************
626 * Search DNS block for prefix RRs *
627 *************************************************/
629 /* Called from dns_complete_a6() to search an additional section or a main
630 answer section for required prefix records to complete an IPv6 address obtained
631 from an A6 record. For each prefix record, a recursive call to dns_complete_a6
632 is made, with a new copy of the address so far.
635 dnsa the DNS answer block
636 which RESET_ADDITIONAL or RESET_ANSWERS
637 name name of prefix record
638 yptrptr pointer to the pointer that points to where to hang the next
639 dns_address structure
640 bits number of bits we have already got
641 bitvec the bits we have already got
643 Returns: TRUE if any records were found
647 dns_find_prefix(dns_answer *dnsa, int which, uschar *name, dns_address
648 ***yptrptr, int bits, uschar *bitvec)
654 for (rr = dns_next_rr(dnsa, &dnss, which);
656 rr = dns_next_rr(dnsa, &dnss, RESET_NEXT))
659 if (rr->type != T_A6 || strcmpic(rr->name, name) != 0) continue;
661 memcpy(cbitvec, bitvec, sizeof(cbitvec));
662 dns_complete_a6(yptrptr, dnsa, rr, bits, cbitvec);
670 /*************************************************
671 * Follow chains of A6 records *
672 *************************************************/
674 /* A6 records may be incomplete, with pointers to other records containing more
675 bits of the address. There can be a tree structure, leading to a number of
676 addresses originating from a single initial A6 record.
679 yptrptr pointer to the pointer that points to where to hang the next
680 dns_address structure
681 dnsa the current DNS answer block
682 rr the RR we have at present
683 bits number of bits we have already got
684 bitvec the bits we have already got
690 dns_complete_a6(dns_address ***yptrptr, dns_answer *dnsa, dns_record *rr,
691 int bits, uschar *bitvec)
693 static uschar bitmask[] = { 0xff, 0xfe, 0xfc, 0xf8, 0xf0, 0xe0, 0xc0, 0x80 };
694 uschar *p = (uschar *)(rr->data);
695 int prefix_len, suffix_len;
701 /* The prefix length is the first byte. It defines the prefix which is missing
702 from the data in this record as a number of bits. Zero means this is the end of
703 a chain. The suffix is the data in this record; only sufficient bytes to hold
704 it are supplied. There may be zero bytes. We have to ignore trailing bits that
705 we have already obtained from earlier RRs in the chain. */
707 prefix_len = *p++; /* bits */
708 suffix_len = (128 - prefix_len + 7)/8; /* bytes */
710 /* If the prefix in this record is greater than the prefix in the previous
711 record in the chain, we have to ignore the record (RFC 2874). */
713 if (prefix_len > 128 - bits) return;
715 /* In this little loop, the number of bits up to and including the current byte
716 is held in k. If we have none of the bits in this byte, we can just or it into
717 the current data. If we have all of the bits in this byte, we skip it.
718 Otherwise, some masking has to be done. */
720 for (i = suffix_len - 1, j = 15, k = 8; i >= 0; i--)
722 int required = k - bits;
723 if (required >= 8) bitvec[j] |= p[i];
724 else if (required > 0) bitvec[j] |= p[i] & bitmask[required];
725 j--; /* I tried putting these in the "for" statement, but gcc muttered */
726 k += 8; /* about computed values not being used. */
729 /* If the prefix_length is zero, we are at the end of a chain. Build a
730 dns_address item with the current data, hang it onto the end of the chain,
731 adjust the hanging pointer, and we are done. */
735 dns_address *new = store_get(sizeof(dns_address) + 50);
736 inet_ntop(AF_INET6, bitvec, CS new->address, 50);
739 *yptrptr = &(new->next);
743 /* Prefix length is not zero. Reset the number of bits that we have collected
744 so far, and extract the chain name. */
746 bits = 128 - prefix_len;
750 while ((i = *p++) != 0)
752 if (chainptr != chain) *chainptr++ = '.';
753 memcpy(chainptr, p, i);
760 /* Now scan the current DNS response record to see if the additional section
761 contains the records we want. This processing can be cut out for testing
764 if (dns_find_prefix(dnsa, RESET_ADDITIONAL, chainptr, yptrptr, bits, bitvec))
767 /* No chain records were found in the current DNS response block. Do a new DNS
768 lookup to try to find these records. This opens up the possibility of DNS
769 failures. We ignore them at this point; if all branches of the tree fail, there
770 will be no addresses at the end. */
772 if (dns_lookup(&cdnsa, chainptr, T_A6, NULL) == DNS_SUCCEED)
773 (void)dns_find_prefix(&cdnsa, RESET_ANSWERS, chainptr, yptrptr, bits, bitvec);
775 #endif /* HAVE_IPV6 && defined(SUPPORT_A6) */
780 /*************************************************
781 * Get address(es) from DNS record *
782 *************************************************/
784 /* The record type is either T_A for an IPv4 address or T_AAAA (or T_A6 when
785 supported) for an IPv6 address. In the A6 case, there may be several addresses,
786 generated by following chains. A recursive function does all the hard work. A6
787 records now look like passing into history, so the code is only included when
788 explicitly asked for.
791 dnsa the DNS answer block
794 Returns: pointer a chain of dns_address items
798 dns_address_from_rr(dns_answer *dnsa, dns_record *rr)
800 dns_address *yield = NULL;
802 #if HAVE_IPV6 && defined(SUPPORT_A6)
803 dns_address **yieldptr = &yield;
806 dnsa = dnsa; /* Stop picky compilers warning */
811 uschar *p = (uschar *)(rr->data);
812 yield = store_get(sizeof(dns_address) + 20);
813 (void)sprintf(CS yield->address, "%d.%d.%d.%d", p[0], p[1], p[2], p[3]);
820 else if (rr->type == T_A6)
822 memset(bitvec, 0, sizeof(bitvec));
823 dns_complete_a6(&yieldptr, dnsa, rr, 0, bitvec);
825 #endif /* SUPPORT_A6 */
829 yield = store_get(sizeof(dns_address) + 50);
830 inet_ntop(AF_INET6, (uschar *)(rr->data), CS yield->address, 50);
833 #endif /* HAVE_IPV6 */