]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Remove dead code handling address family mismatches for TCP sockets
authorMichał Kępień <michal@isc.org>
Tue, 8 Jan 2019 10:17:39 +0000 (11:17 +0100)
committerMichał Kępień <michal@isc.org>
Tue, 8 Jan 2019 10:17:39 +0000 (11:17 +0100)
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.

bin/dig/dighost.c

index 2b6cab552e8c37f5a742fc84a0de14a6f0dadd48..400fcaf34fe81cef02c31ac6d87bc5db1a4cf33e 100644 (file)
@@ -2730,27 +2730,6 @@ send_tcp_connect(dig_query_t *query) {
                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)) {