mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 14:07:59 +00:00
removed more needless attaching and detaching of the blackhole ACL
This commit is contained in:
parent
b7f7a77d56
commit
97f26b88f6
@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: dispatch.c,v 1.91 2001/02/08 18:25:09 gson Exp $ */
|
||||
/* $Id: dispatch.c,v 1.92 2001/02/09 00:23:12 gson Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@ -1121,15 +1121,10 @@ dns_dispatchmgr_setblackhole(dns_dispatchmgr_t *mgr, dns_acl_t *blackhole) {
|
||||
dns_acl_attach(blackhole, &mgr->blackhole);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
dns_dispatchmgr_getblackhole(dns_dispatchmgr_t *mgr, dns_acl_t **blackholep) {
|
||||
dns_acl_t *
|
||||
dns_dispatchmgr_getblackhole(dns_dispatchmgr_t *mgr) {
|
||||
REQUIRE(VALID_DISPATCHMGR(mgr));
|
||||
REQUIRE(blackholep != NULL && *blackholep == NULL);
|
||||
|
||||
if (mgr->blackhole == NULL)
|
||||
return (ISC_R_NOTFOUND);
|
||||
dns_acl_attach(mgr->blackhole, blackholep);
|
||||
return (ISC_R_SUCCESS);
|
||||
return (mgr->blackhole);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
|
@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: dispatch.h,v 1.40 2001/02/07 05:11:58 bwelling Exp $ */
|
||||
/* $Id: dispatch.h,v 1.41 2001/02/09 00:23:16 gson Exp $ */
|
||||
|
||||
#ifndef DNS_DISPATCH_H
|
||||
#define DNS_DISPATCH_H 1
|
||||
@ -157,8 +157,8 @@ dns_dispatchmgr_destroy(dns_dispatchmgr_t **mgrp);
|
||||
void
|
||||
dns_dispatchmgr_setblackhole(dns_dispatchmgr_t *mgr, dns_acl_t *blackhole);
|
||||
/*
|
||||
* Sets the list of addresses that will be blackholed (ignored)
|
||||
* by all dispatchers created by the dispatchmgr.
|
||||
* Sets the dispatcher's "blackhole list," a list of addresses that will
|
||||
* be ignored by all dispatchers created by the dispatchmgr.
|
||||
*
|
||||
* Requires:
|
||||
* mgrp is a valid dispatchmgr
|
||||
@ -166,15 +166,16 @@ dns_dispatchmgr_setblackhole(dns_dispatchmgr_t *mgr, dns_acl_t *blackhole);
|
||||
*/
|
||||
|
||||
|
||||
isc_result_t
|
||||
dns_dispatchmgr_getblackhole(dns_dispatchmgr_t *mgr, dns_acl_t **blackholep);
|
||||
dns_acl_t *
|
||||
dns_dispatchmgr_getblackhole(dns_dispatchmgr_t *mgr);
|
||||
/*
|
||||
* Gets the list of addresses that will be blackholed (ignored)
|
||||
* by all dispatchers created by the dispatchmgr.
|
||||
* Gets a pointer to the dispatcher's current blackhole list,
|
||||
* without incrementing its reference count.
|
||||
*
|
||||
* Requires:
|
||||
* mgr is a valid dispatchmgr
|
||||
* blackholep != NULL && *blackholep == NULL
|
||||
* Returns:
|
||||
* A pointer to the current blackhole list, or NULL.
|
||||
*/
|
||||
|
||||
isc_result_t
|
||||
|
@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: request.c,v 1.54 2001/01/27 02:28:32 bwelling Exp $ */
|
||||
/* $Id: request.c,v 1.55 2001/02/09 00:23:14 gson Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@ -467,20 +467,19 @@ new_request(isc_mem_t *mctx, dns_request_t **requestp) {
|
||||
|
||||
static isc_boolean_t
|
||||
isblackholed(dns_dispatchmgr_t *dispatchmgr, isc_sockaddr_t *destaddr) {
|
||||
dns_acl_t *blackhole = NULL;
|
||||
dns_acl_t *blackhole;
|
||||
isc_netaddr_t netaddr;
|
||||
int match;
|
||||
isc_boolean_t drop = ISC_FALSE;
|
||||
char netaddrstr[ISC_NETADDR_FORMATSIZE];
|
||||
|
||||
(void)dns_dispatchmgr_getblackhole(dispatchmgr, &blackhole);
|
||||
blackhole = dns_dispatchmgr_getblackhole(dispatchmgr);
|
||||
if (blackhole != NULL) {
|
||||
isc_netaddr_fromsockaddr(&netaddr, destaddr);
|
||||
if (dns_acl_match(&netaddr, NULL, blackhole,
|
||||
NULL, &match, NULL) == ISC_R_SUCCESS &&
|
||||
match > 0)
|
||||
drop = ISC_TRUE;
|
||||
dns_acl_detach(&blackhole);
|
||||
}
|
||||
if (drop) {
|
||||
isc_netaddr_format(&netaddr, netaddrstr, sizeof(netaddrstr));
|
||||
|
@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: resolver.c,v 1.199 2001/02/09 00:13:53 gson Exp $ */
|
||||
/* $Id: resolver.c,v 1.200 2001/02/09 00:23:13 gson Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@ -850,7 +850,7 @@ resquery_send(resquery_t *query) {
|
||||
isc_buffer_t *buffer;
|
||||
isc_netaddr_t ipaddr;
|
||||
dns_tsigkey_t *tsigkey = NULL;
|
||||
dns_acl_t *blackhole = NULL;
|
||||
dns_acl_t *blackhole;
|
||||
dns_peer_t *peer = NULL;
|
||||
isc_boolean_t bogus;
|
||||
isc_boolean_t aborted = ISC_FALSE;
|
||||
@ -1039,7 +1039,8 @@ resquery_send(resquery_t *query) {
|
||||
address = &query->addrinfo->sockaddr;
|
||||
isc_buffer_usedregion(buffer, &r);
|
||||
|
||||
(void)dns_dispatchmgr_getblackhole(query->dispatchmgr, &blackhole);
|
||||
|
||||
blackhole = dns_dispatchmgr_getblackhole(query->dispatchmgr);
|
||||
if (blackhole != NULL) {
|
||||
int match;
|
||||
|
||||
@ -1047,7 +1048,6 @@ resquery_send(resquery_t *query) {
|
||||
NULL, &match, NULL) == ISC_R_SUCCESS &&
|
||||
match > 0)
|
||||
aborted = ISC_TRUE;
|
||||
dns_acl_detach(&blackhole);
|
||||
}
|
||||
|
||||
peer = NULL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user