Before commit
c2ec022f5784a2ff844f7d062c2022197dc4ad09, using the "-b"
command line switch for dig did not disable use of the other address
family than the one to which the address supplied to that option
belonged to. Thus, bind9_getaddresses() could e.g. prepare an
isc_sockaddr_t structure for an IPv6 address when an IPv4 address has
been passed to the "-b" command line option. To avoid attempting the
impossible (e.g. querying an IPv6 address from a socket bound to an IPv4
address), a certain code block in send_tcp_connect() checked whether the
address family of the server to be queried was the same as the address
family of the socket set up for sending that query; if there was a
mismatch, that particular server address was skipped.
Commit
c2ec022f5784a2ff844f7d062c2022197dc4ad09 made
bind9_getaddresses() fail upon an address family mismatch between the
address the hostname passed to it resolved to and the address supplied
to the "-b" command line option. Such failures were fatal to dig back
then.
Commit
7f658603910358db7ee27ffb9783096250afab62 made
bind9_getaddresses() failures non-fatal, but also ensured that a
get_address() failure in send_tcp_connect() still causes the given query
address to be skipped (and also made such failures trigger an early
return from send_tcp_connect()).
Summing up, the code block handling address family mismatches in
send_tcp_connect() has been redundant since commit
c2ec022f5784a2ff844f7d062c2022197dc4ad09. Remove it.
return;
}
- if (specified_source &&
- (isc_sockaddr_pf(&query->sockaddr) !=
- isc_sockaddr_pf(&bind_address))) {
- printf(";; Skipping server %s, incompatible "
- "address family\n", query->servname);
- query->waiting_connect = false;
- if (ISC_LINK_LINKED(query, link))
- next = ISC_LIST_NEXT(query, link);
- else
- next = NULL;
- l = query->lookup;
- clear_query(query);
- if (next == NULL) {
- printf(";; No acceptable nameservers\n");
- check_next_lookup(l);
- return;
- }
- send_tcp_connect(next);
- return;
- }
-
INSIST(query->sock == NULL);
if (keep != NULL && isc_sockaddr_equal(&keepaddr, &query->sockaddr)) {