2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 14:07:59 +00:00

drop ::1.2.3.4 and ::ffff:1.2.3.4 in the resolver, not the adb.

This commit is contained in:
Michael Graff
2000-05-26 02:16:10 +00:00
parent 35fc29dd6d
commit bd81a43c73
2 changed files with 40 additions and 25 deletions

View File

@@ -475,20 +475,6 @@ import_rdataset(dns_adbname_t *adbname, dns_rdataset_t *rdataset,
isc_sockaddr_fromin6(&sockaddr, &in6a, 53); isc_sockaddr_fromin6(&sockaddr, &in6a, 53);
} }
if (IN6_IS_ADDR_V4MAPPED(&sockaddr.type.sin6.sin6_addr)
|| IN6_IS_ADDR_V4COMPAT(&sockaddr.type.sin6.sin6_addr)) {
isc_buffer_t buffer;
char buff[80];
isc_buffer_init(&buffer, buff, sizeof buff);
isc_sockaddr_totext(&sockaddr, &buffer);
DP(1, "Ignoring IPv6 mapped IPv4 address: %*s",
isc_buffer_usedlength(&buffer),
isc_buffer_base(&buffer));
goto next;
}
INSIST(nh == NULL); INSIST(nh == NULL);
nh = new_adbnamehook(adb, NULL); nh = new_adbnamehook(adb, NULL);
if (nh == NULL) { if (nh == NULL) {
@@ -526,8 +512,6 @@ import_rdataset(dns_adbname_t *adbname, dns_rdataset_t *rdataset,
ISC_LIST_APPEND(adbname->v6, nh, plink); ISC_LIST_APPEND(adbname->v6, nh, plink);
nh = NULL; nh = NULL;
next:
result = dns_rdataset_next(rdataset); result = dns_rdataset_next(rdataset);
} }
@@ -596,11 +580,6 @@ import_a6(dns_a6context_t *a6ctx) {
isc_buffer_init(&buffer, buff, sizeof buff); isc_buffer_init(&buffer, buff, sizeof buff);
isc_sockaddr_totext(&sockaddr, &buffer); isc_sockaddr_totext(&sockaddr, &buffer);
DP(1, "Ignoring IPv6 mapped IPv4 address: %*s",
isc_buffer_usedlength(&buffer),
isc_buffer_base(&buffer));
goto fail;
} }
foundentry = find_entry_and_lock(adb, &sockaddr, &addr_bucket); foundentry = find_entry_and_lock(adb, &sockaddr, &addr_bucket);

View File

@@ -57,6 +57,12 @@
DNS_LOGMODULE_RESOLVER, \ DNS_LOGMODULE_RESOLVER, \
ISC_LOG_DEBUG(3), \ ISC_LOG_DEBUG(3), \
"fctx %p: %s", fctx, (m)) "fctx %p: %s", fctx, (m))
#define FCTXTRACE2(m1, m2) \
isc_log_write(dns_lctx, \
DNS_LOGCATEGORY_RESOLVER, \
DNS_LOGMODULE_RESOLVER, \
ISC_LOG_DEBUG(3), \
"fctx %p: %s %s", fctx, (m1), (m2))
#define FTRACE(m) isc_log_write(dns_lctx, \ #define FTRACE(m) isc_log_write(dns_lctx, \
DNS_LOGCATEGORY_RESOLVER, \ DNS_LOGCATEGORY_RESOLVER, \
DNS_LOGMODULE_RESOLVER, \ DNS_LOGMODULE_RESOLVER, \
@@ -1293,7 +1299,7 @@ fctx_getaddresses(fetchctx_t *fctx) {
INSIST(ISC_LIST_EMPTY(fctx->forwaddrs)); INSIST(ISC_LIST_EMPTY(fctx->forwaddrs));
/* /*
* If this fctx has forwarders, use them; otherwise the use * If this fctx has forwarders, use them; otherwise use the
* resolver's forwarders (if any). * resolver's forwarders (if any).
*/ */
sa = ISC_LIST_HEAD(fctx->forwarders); sa = ISC_LIST_HEAD(fctx->forwarders);
@@ -1474,6 +1480,31 @@ fctx_getaddresses(fetchctx_t *fctx) {
return (result); return (result);
} }
static inline void
possibly_mark(fetchctx_t *fctx, dns_adbaddrinfo_t *addr)
{
isc_netaddr_t na;
char buf[80];
isc_sockaddr_t *sa;
sa = addr->sockaddr;
if (sa->type.sa.sa_family != AF_INET6)
return;
if (IN6_IS_ADDR_V4MAPPED(&sa->type.sin6.sin6_addr)) {
isc_netaddr_fromsockaddr(&na, addr->sockaddr);
isc_netaddr_format(&na, buf, sizeof buf);
addr->flags |= FCTX_ADDRINFO_MARK;
FCTXTRACE2("Ignoring IPv6 mapped IPV4 address: ", buf);
} else if (IN6_IS_ADDR_V4COMPAT(&sa->type.sin6.sin6_addr)) {
isc_netaddr_fromsockaddr(&na, addr->sockaddr);
isc_netaddr_format(&na, buf, sizeof buf);
addr->flags |= FCTX_ADDRINFO_MARK;
FCTXTRACE2("Ignoring IPv6 compatibility IPV4 address: ", buf);
}
}
static inline dns_adbaddrinfo_t * static inline dns_adbaddrinfo_t *
fctx_nextaddress(fetchctx_t *fctx) { fctx_nextaddress(fetchctx_t *fctx) {
dns_adbfind_t *find; dns_adbfind_t *find;
@@ -1489,6 +1520,7 @@ fctx_nextaddress(fetchctx_t *fctx) {
for (addrinfo = ISC_LIST_HEAD(fctx->forwaddrs); for (addrinfo = ISC_LIST_HEAD(fctx->forwaddrs);
addrinfo != NULL; addrinfo != NULL;
addrinfo = ISC_LIST_NEXT(addrinfo, publink)) { addrinfo = ISC_LIST_NEXT(addrinfo, publink)) {
possibly_mark(fctx, addrinfo);
if (UNMARKED(addrinfo)) { if (UNMARKED(addrinfo)) {
addrinfo->flags |= FCTX_ADDRINFO_MARK; addrinfo->flags |= FCTX_ADDRINFO_MARK;
fctx->find = NULL; fctx->find = NULL;
@@ -1516,6 +1548,7 @@ fctx_nextaddress(fetchctx_t *fctx) {
for (addrinfo = ISC_LIST_HEAD(find->list); for (addrinfo = ISC_LIST_HEAD(find->list);
addrinfo != NULL; addrinfo != NULL;
addrinfo = ISC_LIST_NEXT(addrinfo, publink)) { addrinfo = ISC_LIST_NEXT(addrinfo, publink)) {
possibly_mark(fctx, addrinfo);
if (UNMARKED(addrinfo)) { if (UNMARKED(addrinfo)) {
addrinfo->flags |= FCTX_ADDRINFO_MARK; addrinfo->flags |= FCTX_ADDRINFO_MARK;
break; break;
@@ -1568,10 +1601,13 @@ fctx_try(fetchctx_t *fctx) {
addrinfo = fctx_nextaddress(fctx); addrinfo = fctx_nextaddress(fctx);
/* /*
* fctx_getaddresses() returned success, so at least one * While we may have addresses from the ADB, they
* of the find lists should be nonempty. * might be bad ones. In this case, return SERVFAIL.
*/ */
INSIST(addrinfo != NULL); if (addrinfo == NULL) {
fctx_done(fctx, DNS_R_SERVFAIL);
return;
}
} }
result = fctx_query(fctx, addrinfo, fctx->options); result = fctx_query(fctx, addrinfo, fctx->options);