mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 22:15:20 +00:00
removed more needless attaching and detaching of the blackhole ACL
This commit is contained in:
@@ -15,7 +15,7 @@
|
|||||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* 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>
|
#include <config.h>
|
||||||
|
|
||||||
@@ -1121,15 +1121,10 @@ dns_dispatchmgr_setblackhole(dns_dispatchmgr_t *mgr, dns_acl_t *blackhole) {
|
|||||||
dns_acl_attach(blackhole, &mgr->blackhole);
|
dns_acl_attach(blackhole, &mgr->blackhole);
|
||||||
}
|
}
|
||||||
|
|
||||||
isc_result_t
|
dns_acl_t *
|
||||||
dns_dispatchmgr_getblackhole(dns_dispatchmgr_t *mgr, dns_acl_t **blackholep) {
|
dns_dispatchmgr_getblackhole(dns_dispatchmgr_t *mgr) {
|
||||||
REQUIRE(VALID_DISPATCHMGR(mgr));
|
REQUIRE(VALID_DISPATCHMGR(mgr));
|
||||||
REQUIRE(blackholep != NULL && *blackholep == NULL);
|
return (mgr->blackhole);
|
||||||
|
|
||||||
if (mgr->blackhole == NULL)
|
|
||||||
return (ISC_R_NOTFOUND);
|
|
||||||
dns_acl_attach(mgr->blackhole, blackholep);
|
|
||||||
return (ISC_R_SUCCESS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static isc_result_t
|
static isc_result_t
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* 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
|
#ifndef DNS_DISPATCH_H
|
||||||
#define DNS_DISPATCH_H 1
|
#define DNS_DISPATCH_H 1
|
||||||
@@ -157,8 +157,8 @@ dns_dispatchmgr_destroy(dns_dispatchmgr_t **mgrp);
|
|||||||
void
|
void
|
||||||
dns_dispatchmgr_setblackhole(dns_dispatchmgr_t *mgr, dns_acl_t *blackhole);
|
dns_dispatchmgr_setblackhole(dns_dispatchmgr_t *mgr, dns_acl_t *blackhole);
|
||||||
/*
|
/*
|
||||||
* Sets the list of addresses that will be blackholed (ignored)
|
* Sets the dispatcher's "blackhole list," a list of addresses that will
|
||||||
* by all dispatchers created by the dispatchmgr.
|
* be ignored by all dispatchers created by the dispatchmgr.
|
||||||
*
|
*
|
||||||
* Requires:
|
* Requires:
|
||||||
* mgrp is a valid dispatchmgr
|
* mgrp is a valid dispatchmgr
|
||||||
@@ -166,15 +166,16 @@ dns_dispatchmgr_setblackhole(dns_dispatchmgr_t *mgr, dns_acl_t *blackhole);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
isc_result_t
|
dns_acl_t *
|
||||||
dns_dispatchmgr_getblackhole(dns_dispatchmgr_t *mgr, dns_acl_t **blackholep);
|
dns_dispatchmgr_getblackhole(dns_dispatchmgr_t *mgr);
|
||||||
/*
|
/*
|
||||||
* Gets the list of addresses that will be blackholed (ignored)
|
* Gets a pointer to the dispatcher's current blackhole list,
|
||||||
* by all dispatchers created by the dispatchmgr.
|
* without incrementing its reference count.
|
||||||
*
|
*
|
||||||
* Requires:
|
* Requires:
|
||||||
* mgr is a valid dispatchmgr
|
* mgr is a valid dispatchmgr
|
||||||
* blackholep != NULL && *blackholep == NULL
|
* Returns:
|
||||||
|
* A pointer to the current blackhole list, or NULL.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
isc_result_t
|
isc_result_t
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* 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>
|
#include <config.h>
|
||||||
|
|
||||||
@@ -467,20 +467,19 @@ new_request(isc_mem_t *mctx, dns_request_t **requestp) {
|
|||||||
|
|
||||||
static isc_boolean_t
|
static isc_boolean_t
|
||||||
isblackholed(dns_dispatchmgr_t *dispatchmgr, isc_sockaddr_t *destaddr) {
|
isblackholed(dns_dispatchmgr_t *dispatchmgr, isc_sockaddr_t *destaddr) {
|
||||||
dns_acl_t *blackhole = NULL;
|
dns_acl_t *blackhole;
|
||||||
isc_netaddr_t netaddr;
|
isc_netaddr_t netaddr;
|
||||||
int match;
|
int match;
|
||||||
isc_boolean_t drop = ISC_FALSE;
|
isc_boolean_t drop = ISC_FALSE;
|
||||||
char netaddrstr[ISC_NETADDR_FORMATSIZE];
|
char netaddrstr[ISC_NETADDR_FORMATSIZE];
|
||||||
|
|
||||||
(void)dns_dispatchmgr_getblackhole(dispatchmgr, &blackhole);
|
blackhole = dns_dispatchmgr_getblackhole(dispatchmgr);
|
||||||
if (blackhole != NULL) {
|
if (blackhole != NULL) {
|
||||||
isc_netaddr_fromsockaddr(&netaddr, destaddr);
|
isc_netaddr_fromsockaddr(&netaddr, destaddr);
|
||||||
if (dns_acl_match(&netaddr, NULL, blackhole,
|
if (dns_acl_match(&netaddr, NULL, blackhole,
|
||||||
NULL, &match, NULL) == ISC_R_SUCCESS &&
|
NULL, &match, NULL) == ISC_R_SUCCESS &&
|
||||||
match > 0)
|
match > 0)
|
||||||
drop = ISC_TRUE;
|
drop = ISC_TRUE;
|
||||||
dns_acl_detach(&blackhole);
|
|
||||||
}
|
}
|
||||||
if (drop) {
|
if (drop) {
|
||||||
isc_netaddr_format(&netaddr, netaddrstr, sizeof(netaddrstr));
|
isc_netaddr_format(&netaddr, netaddrstr, sizeof(netaddrstr));
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* 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>
|
#include <config.h>
|
||||||
|
|
||||||
@@ -850,7 +850,7 @@ resquery_send(resquery_t *query) {
|
|||||||
isc_buffer_t *buffer;
|
isc_buffer_t *buffer;
|
||||||
isc_netaddr_t ipaddr;
|
isc_netaddr_t ipaddr;
|
||||||
dns_tsigkey_t *tsigkey = NULL;
|
dns_tsigkey_t *tsigkey = NULL;
|
||||||
dns_acl_t *blackhole = NULL;
|
dns_acl_t *blackhole;
|
||||||
dns_peer_t *peer = NULL;
|
dns_peer_t *peer = NULL;
|
||||||
isc_boolean_t bogus;
|
isc_boolean_t bogus;
|
||||||
isc_boolean_t aborted = ISC_FALSE;
|
isc_boolean_t aborted = ISC_FALSE;
|
||||||
@@ -1039,7 +1039,8 @@ resquery_send(resquery_t *query) {
|
|||||||
address = &query->addrinfo->sockaddr;
|
address = &query->addrinfo->sockaddr;
|
||||||
isc_buffer_usedregion(buffer, &r);
|
isc_buffer_usedregion(buffer, &r);
|
||||||
|
|
||||||
(void)dns_dispatchmgr_getblackhole(query->dispatchmgr, &blackhole);
|
|
||||||
|
blackhole = dns_dispatchmgr_getblackhole(query->dispatchmgr);
|
||||||
if (blackhole != NULL) {
|
if (blackhole != NULL) {
|
||||||
int match;
|
int match;
|
||||||
|
|
||||||
@@ -1047,7 +1048,6 @@ resquery_send(resquery_t *query) {
|
|||||||
NULL, &match, NULL) == ISC_R_SUCCESS &&
|
NULL, &match, NULL) == ISC_R_SUCCESS &&
|
||||||
match > 0)
|
match > 0)
|
||||||
aborted = ISC_TRUE;
|
aborted = ISC_TRUE;
|
||||||
dns_acl_detach(&blackhole);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
peer = NULL;
|
peer = NULL;
|
||||||
|
Reference in New Issue
Block a user