From 2004704111cc9944134d65512f5279eec9e15549 Mon Sep 17 00:00:00 2001 From: Michael Sawyer Date: Fri, 9 Jun 2000 23:29:35 +0000 Subject: [PATCH] Bind socket before use --- lib/dns/request.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/dns/request.c b/lib/dns/request.c index 66c5bfb0c6..b480682427 100644 --- a/lib/dns/request.c +++ b/lib/dns/request.c @@ -432,6 +432,7 @@ dns_request_create(dns_requestmgr_t *requestmgr, dns_message_t *message, isc_socket_t *socket = NULL; isc_result_t result; isc_mem_t *mctx; + isc_sockaddr_t bind_any; isc_interval_t interval; dns_messageid_t id; isc_time_t expires; @@ -499,6 +500,12 @@ dns_request_create(dns_requestmgr_t *requestmgr, dns_message_t *message, isc_sockettype_tcp, &socket); if (result != ISC_R_SUCCESS) goto cleanup; + isc_sockaddr_any(&bind_any); + result = isc_socket_bind(sock, &bind_any); + if (result != ISC_R_SUCCESS) { + isc_socket_detach(&socket); + goto cleanup; + } attrs = 0; attrs |= DNS_DISPATCHATTR_TCP; attrs |= DNS_DISPATCHATTR_PRIVATE;