mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 14:07:59 +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);
|
||||
}
|
||||
|
||||
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
|
||||
dns_dispatch_getattributes(dns_dispatch_t *disp) {
|
||||
REQUIRE(VALID_DISPATCH(disp));
|
||||
|
@@ -374,7 +374,21 @@ dns_dispatch_getlocaladdress(dns_dispatch_t *disp, isc_sockaddr_t *addrp);
|
||||
*
|
||||
* Requires:
|
||||
*\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:
|
||||
*\li ISC_R_SUCCESS
|
||||
|
@@ -2370,7 +2370,7 @@ resquery_send(resquery_t *query) {
|
||||
isc_region_t r;
|
||||
dns_resolver_t *res = NULL;
|
||||
isc_task_t *task;
|
||||
isc_socket_t *sock;
|
||||
isc_socket_t *sock = NULL;
|
||||
isc_buffer_t tcpbuffer;
|
||||
isc_sockaddr_t *address = NULL;
|
||||
isc_buffer_t *buffer = NULL;
|
||||
@@ -2849,7 +2849,7 @@ resquery_send(resquery_t *query) {
|
||||
dtmsgtype = DNS_DTTYPE_RQ;
|
||||
}
|
||||
|
||||
result = isc_socket_getsockname(sock, &localaddr);
|
||||
result = dns_dispentry_getlocaladdress(query->dispentry, &localaddr);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
la = &localaddr;
|
||||
}
|
||||
@@ -9801,7 +9801,6 @@ rctx_logpacket(respctx_t *rctx) {
|
||||
#ifdef HAVE_DNSTAP
|
||||
isc_result_t result;
|
||||
fetchctx_t *fctx = rctx->fctx;
|
||||
isc_socket_t *sock = NULL;
|
||||
isc_sockaddr_t localaddr, *la = NULL;
|
||||
unsigned char zone[DNS_NAME_MAXWIRE];
|
||||
dns_dtmsgtype_t dtmsgtype;
|
||||
@@ -9838,12 +9837,10 @@ rctx_logpacket(respctx_t *rctx) {
|
||||
dtmsgtype = DNS_DTTYPE_RR;
|
||||
}
|
||||
|
||||
sock = dns_dispatch_getentrysocket(rctx->query);
|
||||
if (sock != NULL) {
|
||||
result = isc_socket_getsockname(sock, &localaddr);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
la = &localaddr;
|
||||
}
|
||||
result = dns_dispentry_getlocaladdress(rctx->query->dispentry,
|
||||
&localaddr);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
la = &localaddr;
|
||||
}
|
||||
|
||||
dns_dt_send(fctx->res->view, dtmsgtype, la,
|
||||
|
Reference in New Issue
Block a user