Commit 6ef15459 authored by Mark Andrews's avatar Mark Andrews
Browse files

535. [func] Use xfrsource[46] when forwarding update requests.

parent c5c77ccb
535. [func] Use xfrsource[46] when forwarding update requests.
534. [func] Ancestors have been removed from RBT chains. Ancestor
information can be discerned via node parent pointers.
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: request.c,v 1.38 2000/10/06 18:58:17 bwelling Exp $ */
/* $Id: request.c,v 1.39 2000/10/30 05:08:06 marka Exp $ */
#include <config.h>
......@@ -434,6 +434,7 @@ dns_request_createraw(dns_requestmgr_t *requestmgr, isc_buffer_t *msgbuf,
isc_result_t result;
isc_mem_t *mctx;
isc_sockaddr_t bind_any;
isc_sockaddr_t src;
isc_interval_t interval;
dns_messageid_t id;
isc_time_t expires;
......@@ -448,18 +449,18 @@ dns_request_createraw(dns_requestmgr_t *requestmgr, isc_buffer_t *msgbuf,
REQUIRE(action != NULL);
REQUIRE(requestp != NULL && *requestp == NULL);
REQUIRE(timeout > 0);
if (srcaddr != NULL)
REQUIRE(isc_sockaddr_pf(srcaddr) == isc_sockaddr_pf(destaddr));
mctx = requestmgr->mctx;
req_log(ISC_LOG_DEBUG(3), "dns_request_createraw");
if (srcaddr != NULL)
return (ISC_R_NOTIMPLEMENTED);
request = isc_mem_get(mctx, sizeof(*request));
if (request == NULL) {
return (ISC_R_NOMEMORY);
}
/*
* Zero structure.
*/
......@@ -513,8 +514,15 @@ dns_request_createraw(dns_requestmgr_t *requestmgr, isc_buffer_t *msgbuf,
isc_sockettype_tcp, &socket);
if (result != ISC_R_SUCCESS)
goto cleanup;
isc_sockaddr_anyofpf(&bind_any, isc_sockaddr_pf(destaddr));
result = isc_socket_bind(socket, &bind_any);
if (srcaddr == NULL) {
isc_sockaddr_anyofpf(&bind_any,
isc_sockaddr_pf(destaddr));
result = isc_socket_bind(socket, &bind_any);
} else {
src = *srcaddr;
isc_sockaddr_setport(&src, 0);
result = isc_socket_bind(socket, &src);
}
if (result != ISC_R_SUCCESS) {
isc_socket_detach(&socket);
goto cleanup;
......@@ -536,18 +544,50 @@ dns_request_createraw(dns_requestmgr_t *requestmgr, isc_buffer_t *msgbuf,
goto cleanup;
} else {
dns_dispatch_t *disp = NULL;
switch (isc_sockaddr_pf(destaddr)) {
case PF_INET:
disp = requestmgr->dispatchv4;
break;
case PF_INET6:
disp = requestmgr->dispatchv6;
break;
default:
result = ISC_R_NOTIMPLEMENTED;
goto cleanup;
if (srcaddr == NULL) {
switch (isc_sockaddr_pf(destaddr)) {
case PF_INET:
disp = requestmgr->dispatchv4;
break;
case PF_INET6:
disp = requestmgr->dispatchv6;
break;
default:
result = ISC_R_NOTIMPLEMENTED;
goto cleanup;
}
} else {
unsigned int attrs, attrmask;
attrs = 0;
attrs |= DNS_DISPATCHATTR_UDP;
switch (isc_sockaddr_pf(srcaddr)) {
case PF_INET:
attrs |= DNS_DISPATCHATTR_IPV4;
break;
case PF_INET6:
attrs |= DNS_DISPATCHATTR_IPV6;
break;
default:
result = ISC_R_NOTIMPLEMENTED;
goto cleanup;
}
attrmask = 0;
attrmask |= DNS_DISPATCHATTR_UDP;
attrmask |= DNS_DISPATCHATTR_TCP;
attrmask |= DNS_DISPATCHATTR_IPV4;
attrmask |= DNS_DISPATCHATTR_IPV6;
result = dns_dispatch_getudp(requestmgr->dispatchmgr,
requestmgr->socketmgr,
requestmgr->taskmgr,
srcaddr, 4096,
1000, 32768, 16411, 16433,
attrs, attrmask, &disp);
if (result != ISC_R_SUCCESS)
goto cleanup;
}
if (disp == NULL) {
result = ISC_R_FAMILYNOSUPPORT;
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: zone.c,v 1.240 2000/10/25 04:26:54 marka Exp $ */
/* $Id: zone.c,v 1.241 2000/10/30 05:08:07 marka Exp $ */
#include <config.h>
......@@ -4696,6 +4696,7 @@ forward_destroy(dns_forward_t *forward) {
static isc_result_t
sendtomaster(dns_forward_t *forward) {
isc_result_t result;
isc_sockaddr_t src;
LOCK(&forward->zone->lock);
if (forward->which >= forward->zone->masterscnt) {
......@@ -4709,14 +4710,26 @@ sendtomaster(dns_forward_t *forward) {
* used TCP.
* XXX The timeout may but a bit small if we are far down a
* transfer graph and the master has to try several masters.
* XXX should be using xfrsource{4,6}.
*/
switch (isc_sockaddr_pf(&forward->addr)) {
case PF_INET:
src = forward->zone->xfrsource4;
break;
case PF_INET6:
src = forward->zone->xfrsource6;
break;
default:
result = ISC_R_NOTIMPLEMENTED;
goto unlock;
}
result = dns_request_createraw(forward->zone->view->requestmgr,
forward->msgbuf, NULL, &forward->addr,
forward->msgbuf,
&src, &forward->addr,
DNS_REQUESTOPT_TCP, 15 /* XXX */,
forward->zone->task,
forward_callback, forward,
&forward->request);
unlock:
UNLOCK(&forward->zone->lock);
return (result);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment