mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 14:35:26 +00:00
Move isc_socket_getsockname() calls into dispatch
We now use dns_dispentry_getlocaladdress(). (this API is likely to be cleaned up further later.)
This commit is contained in:
@@ -2678,6 +2678,23 @@ dns_dispatch_getlocaladdress(dns_dispatch_t *disp, isc_sockaddr_t *addrp) {
|
|||||||
return (ISC_R_NOTIMPLEMENTED);
|
return (ISC_R_NOTIMPLEMENTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isc_result_t
|
||||||
|
dns_dispentry_getlocaladdress(dns_dispentry_t *resp, isc_sockaddr_t *addrp) {
|
||||||
|
REQUIRE(VALID_RESPONSE(resp));
|
||||||
|
REQUIRE(addrp != NULL);
|
||||||
|
|
||||||
|
if (resp->disp->socktype == isc_sockettype_tcp) {
|
||||||
|
return (isc_socket_getsockname(resp->disp->socket, addrp));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (resp->dispsocket != NULL) {
|
||||||
|
return (isc_socket_getsockname(resp->dispsocket->socket,
|
||||||
|
addrp));
|
||||||
|
}
|
||||||
|
|
||||||
|
return (ISC_R_NOTIMPLEMENTED);
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int
|
unsigned int
|
||||||
dns_dispatch_getattributes(dns_dispatch_t *disp) {
|
dns_dispatch_getattributes(dns_dispatch_t *disp) {
|
||||||
REQUIRE(VALID_DISPATCH(disp));
|
REQUIRE(VALID_DISPATCH(disp));
|
||||||
|
@@ -374,7 +374,21 @@ dns_dispatch_getlocaladdress(dns_dispatch_t *disp, isc_sockaddr_t *addrp);
|
|||||||
*
|
*
|
||||||
* Requires:
|
* Requires:
|
||||||
*\li disp is valid.
|
*\li disp is valid.
|
||||||
*\li addrp to be non null.
|
*\li addrp to be non NULL.
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
*\li ISC_R_SUCCESS
|
||||||
|
*\li ISC_R_NOTIMPLEMENTED
|
||||||
|
*/
|
||||||
|
|
||||||
|
isc_result_t
|
||||||
|
dns_dispentry_getlocaladdress(dns_dispentry_t *resp, isc_sockaddr_t *addrp);
|
||||||
|
/*%<
|
||||||
|
* Return the local address for this dispatch entry.
|
||||||
|
*
|
||||||
|
* Requires:
|
||||||
|
*\li resp is valid.
|
||||||
|
*\li addrp to be non NULL.
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
*\li ISC_R_SUCCESS
|
*\li ISC_R_SUCCESS
|
||||||
|
@@ -2370,7 +2370,7 @@ resquery_send(resquery_t *query) {
|
|||||||
isc_region_t r;
|
isc_region_t r;
|
||||||
dns_resolver_t *res = NULL;
|
dns_resolver_t *res = NULL;
|
||||||
isc_task_t *task;
|
isc_task_t *task;
|
||||||
isc_socket_t *sock;
|
isc_socket_t *sock = NULL;
|
||||||
isc_buffer_t tcpbuffer;
|
isc_buffer_t tcpbuffer;
|
||||||
isc_sockaddr_t *address = NULL;
|
isc_sockaddr_t *address = NULL;
|
||||||
isc_buffer_t *buffer = NULL;
|
isc_buffer_t *buffer = NULL;
|
||||||
@@ -2849,7 +2849,7 @@ resquery_send(resquery_t *query) {
|
|||||||
dtmsgtype = DNS_DTTYPE_RQ;
|
dtmsgtype = DNS_DTTYPE_RQ;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = isc_socket_getsockname(sock, &localaddr);
|
result = dns_dispentry_getlocaladdress(query->dispentry, &localaddr);
|
||||||
if (result == ISC_R_SUCCESS) {
|
if (result == ISC_R_SUCCESS) {
|
||||||
la = &localaddr;
|
la = &localaddr;
|
||||||
}
|
}
|
||||||
@@ -9801,7 +9801,6 @@ rctx_logpacket(respctx_t *rctx) {
|
|||||||
#ifdef HAVE_DNSTAP
|
#ifdef HAVE_DNSTAP
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
fetchctx_t *fctx = rctx->fctx;
|
fetchctx_t *fctx = rctx->fctx;
|
||||||
isc_socket_t *sock = NULL;
|
|
||||||
isc_sockaddr_t localaddr, *la = NULL;
|
isc_sockaddr_t localaddr, *la = NULL;
|
||||||
unsigned char zone[DNS_NAME_MAXWIRE];
|
unsigned char zone[DNS_NAME_MAXWIRE];
|
||||||
dns_dtmsgtype_t dtmsgtype;
|
dns_dtmsgtype_t dtmsgtype;
|
||||||
@@ -9838,13 +9837,11 @@ rctx_logpacket(respctx_t *rctx) {
|
|||||||
dtmsgtype = DNS_DTTYPE_RR;
|
dtmsgtype = DNS_DTTYPE_RR;
|
||||||
}
|
}
|
||||||
|
|
||||||
sock = dns_dispatch_getentrysocket(rctx->query);
|
result = dns_dispentry_getlocaladdress(rctx->query->dispentry,
|
||||||
if (sock != NULL) {
|
&localaddr);
|
||||||
result = isc_socket_getsockname(sock, &localaddr);
|
|
||||||
if (result == ISC_R_SUCCESS) {
|
if (result == ISC_R_SUCCESS) {
|
||||||
la = &localaddr;
|
la = &localaddr;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
dns_dt_send(fctx->res->view, dtmsgtype, la,
|
dns_dt_send(fctx->res->view, dtmsgtype, la,
|
||||||
&rctx->query->addrinfo->sockaddr,
|
&rctx->query->addrinfo->sockaddr,
|
||||||
|
Reference in New Issue
Block a user