Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
BIND
Commits
bcf369e5
Commit
bcf369e5
authored
Jun 23, 2005
by
Mark Andrews
Browse files
1889. [func] The lame cache is now done on a <qname,qclass,qtype>
basis as some servers only appear to be lame for certain query types. [RT #14916]
parent
045eca6d
Changes
6
Hide whitespace changes
Inline
Side-by-side
CHANGES
View file @
bcf369e5
1889. [func] The lame cache is now done on a <qname,qclass,qtype>
basis as some servers only appear to be lame for
certain query types. [RT #14916]
1888. [func] "USE INTERNAL MALLOC" is now runtime selectable.
[RT #14892]
...
...
bin/named/lwdgabn.c
View file @
bcf369e5
...
...
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: lwdgabn.c,v 1.1
7
2005/0
4
/2
9
0
0
:2
2:28
marka Exp $ */
/* $Id: lwdgabn.c,v 1.1
8
2005/0
6
/2
3
0
4
:2
1:59
marka Exp $ */
/*! \file */
...
...
@@ -434,7 +434,7 @@ restart_find(ns_lwdclient_t *client) {
client
->
clientmgr
->
task
,
process_gabn_finddone
,
client
,
dns_fixedname_name
(
&
client
->
target_name
),
dns_rootname
,
options
,
0
,
dns_rootname
,
0
,
options
,
0
,
dns_fixedname_name
(
&
client
->
target_name
),
client
->
clientmgr
->
view
->
dstport
,
&
client
->
find
);
...
...
lib/dns/adb.c
View file @
bcf369e5
...
...
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: adb.c,v 1.22
1
2005/0
4
/2
7
04:
56:44 sr
a Exp $ */
/* $Id: adb.c,v 1.22
2
2005/0
6
/2
3
04:
22:01 mark
a Exp $ */
/*! \file
*
...
...
@@ -52,6 +52,7 @@
#include
<dns/rdata.h>
#include
<dns/rdataset.h>
#include
<dns/rdatastruct.h>
#include
<dns/rdatatype.h>
#include
<dns/resolver.h>
#include
<dns/result.h>
...
...
@@ -61,8 +62,8 @@
#define DNS_ADBNAME_VALID(x) ISC_MAGIC_VALID(x, DNS_ADBNAME_MAGIC)
#define DNS_ADBNAMEHOOK_MAGIC ISC_MAGIC('a', 'd', 'N', 'H')
#define DNS_ADBNAMEHOOK_VALID(x) ISC_MAGIC_VALID(x, DNS_ADBNAMEHOOK_MAGIC)
#define DNS_ADB
ZON
EINFO_MAGIC ISC_MAGIC('a', 'd', 'b', 'Z')
#define DNS_ADB
ZON
EINFO_VALID(x) ISC_MAGIC_VALID(x, DNS_ADB
ZON
EINFO_MAGIC)
#define DNS_ADB
LAM
EINFO_MAGIC ISC_MAGIC('a', 'd', 'b', 'Z')
#define DNS_ADB
LAM
EINFO_VALID(x) ISC_MAGIC_VALID(x, DNS_ADB
LAM
EINFO_MAGIC)
#define DNS_ADBENTRY_MAGIC ISC_MAGIC('a', 'd', 'b', 'E')
#define DNS_ADBENTRY_VALID(x) ISC_MAGIC_VALID(x, DNS_ADBENTRY_MAGIC)
#define DNS_ADBFETCH_MAGIC ISC_MAGIC('a', 'd', 'F', '4')
...
...
@@ -107,7 +108,7 @@
typedef
ISC_LIST
(
dns_adbname_t
)
dns_adbnamelist_t
;
typedef
struct
dns_adbnamehook
dns_adbnamehook_t
;
typedef
ISC_LIST
(
dns_adbnamehook_t
)
dns_adbnamehooklist_t
;
typedef
struct
dns_adb
zon
einfo
dns_adb
zon
einfo_t
;
typedef
struct
dns_adb
lam
einfo
dns_adb
lam
einfo_t
;
typedef
ISC_LIST
(
dns_adbentry_t
)
dns_adbentrylist_t
;
typedef
struct
dns_adbfetch
dns_adbfetch_t
;
typedef
struct
dns_adbfetch6
dns_adbfetch6_t
;
...
...
@@ -135,7 +136,7 @@ struct dns_adb {
isc_mutex_t
mplock
;
isc_mempool_t
*
nmp
;
/*%< dns_adbname_t */
isc_mempool_t
*
nhmp
;
/*%< dns_adbnamehook_t */
isc_mempool_t
*
z
imp
;
/*%< dns_adb
zon
einfo_t */
isc_mempool_t
*
l
imp
;
/*%< dns_adb
lam
einfo_t */
isc_mempool_t
*
emp
;
/*%< dns_adbentry_t */
isc_mempool_t
*
ahmp
;
/*%< dns_adbfind_t */
isc_mempool_t
*
aimp
;
/*%< dns_adbaddrinfo_t */
...
...
@@ -218,17 +219,18 @@ struct dns_adbnamehook {
};
/*%
* This is a small widget that holds
zon
e-specific information about an
* This is a small widget that holds
qnam
e-specific information about an
* address. Currently limited to lameness, but could just as easily be
* extended to other types of information about zones.
*/
struct
dns_adb
zon
einfo
{
struct
dns_adb
lam
einfo
{
unsigned
int
magic
;
dns_name_t
zone
;
dns_name_t
qname
;
dns_rdatatype_t
qtype
;
isc_stdtime_t
lame_timer
;
ISC_LINK
(
dns_adb
zon
einfo_t
)
plink
;
ISC_LINK
(
dns_adb
lam
einfo_t
)
plink
;
};
/*%
...
...
@@ -255,7 +257,7 @@ struct dns_adbentry {
* name.
*/
ISC_LIST
(
dns_adb
zon
einfo_t
)
zon
einfo
;
ISC_LIST
(
dns_adb
lam
einfo_t
)
lam
einfo
;
ISC_LINK
(
dns_adbentry_t
)
plink
;
};
...
...
@@ -267,8 +269,9 @@ static inline void free_adbname(dns_adb_t *, dns_adbname_t **);
static
inline
dns_adbnamehook_t
*
new_adbnamehook
(
dns_adb_t
*
,
dns_adbentry_t
*
);
static
inline
void
free_adbnamehook
(
dns_adb_t
*
,
dns_adbnamehook_t
**
);
static
inline
dns_adbzoneinfo_t
*
new_adbzoneinfo
(
dns_adb_t
*
,
dns_name_t
*
);
static
inline
void
free_adbzoneinfo
(
dns_adb_t
*
,
dns_adbzoneinfo_t
**
);
static
inline
dns_adblameinfo_t
*
new_adblameinfo
(
dns_adb_t
*
,
dns_name_t
*
,
dns_rdatatype_t
);
static
inline
void
free_adblameinfo
(
dns_adb_t
*
,
dns_adblameinfo_t
**
);
static
inline
dns_adbentry_t
*
new_adbentry
(
dns_adb_t
*
);
static
inline
void
free_adbentry
(
dns_adb_t
*
,
dns_adbentry_t
**
);
static
inline
dns_adbfind_t
*
new_adbfind
(
dns_adb_t
*
);
...
...
@@ -1324,42 +1327,42 @@ free_adbnamehook(dns_adb_t *adb, dns_adbnamehook_t **namehook) {
isc_mempool_put
(
adb
->
nhmp
,
nh
);
}
static
inline
dns_adb
zon
einfo_t
*
new_adb
zon
einfo
(
dns_adb_t
*
adb
,
dns_name_t
*
zon
e
)
{
dns_adb
zon
einfo_t
*
z
i
;
static
inline
dns_adb
lam
einfo_t
*
new_adb
lam
einfo
(
dns_adb_t
*
adb
,
dns_name_t
*
qname
,
dns_rdatatype_t
qtyp
e
)
{
dns_adb
lam
einfo_t
*
l
i
;
z
i
=
isc_mempool_get
(
adb
->
z
imp
);
if
(
z
i
==
NULL
)
l
i
=
isc_mempool_get
(
adb
->
l
imp
);
if
(
l
i
==
NULL
)
return
(
NULL
);
dns_name_init
(
&
z
i
->
zon
e
,
NULL
);
if
(
dns_name_dup
(
zon
e
,
adb
->
mctx
,
&
z
i
->
zon
e
)
!=
ISC_R_SUCCESS
)
{
isc_mempool_put
(
adb
->
z
imp
,
z
i
);
dns_name_init
(
&
l
i
->
qnam
e
,
NULL
);
if
(
dns_name_dup
(
qnam
e
,
adb
->
mctx
,
&
l
i
->
qnam
e
)
!=
ISC_R_SUCCESS
)
{
isc_mempool_put
(
adb
->
l
imp
,
l
i
);
return
(
NULL
);
}
li
->
magic
=
DNS_ADBLAMEINFO_MAGIC
;
li
->
lame_timer
=
0
;
li
->
qtype
=
qtype
;
ISC_LINK_INIT
(
li
,
plink
);
zi
->
magic
=
DNS_ADBZONEINFO_MAGIC
;
zi
->
lame_timer
=
0
;
ISC_LINK_INIT
(
zi
,
plink
);
return
(
zi
);
return
(
li
);
}
static
inline
void
free_adb
zon
einfo
(
dns_adb_t
*
adb
,
dns_adb
zon
einfo_t
**
zon
einfo
)
{
dns_adb
zon
einfo_t
*
z
i
;
free_adb
lam
einfo
(
dns_adb_t
*
adb
,
dns_adb
lam
einfo_t
**
lam
einfo
)
{
dns_adb
lam
einfo_t
*
l
i
;
INSIST
(
zon
einfo
!=
NULL
&&
DNS_ADB
ZON
EINFO_VALID
(
*
zon
einfo
));
z
i
=
*
zon
einfo
;
*
zon
einfo
=
NULL
;
INSIST
(
lam
einfo
!=
NULL
&&
DNS_ADB
LAM
EINFO_VALID
(
*
lam
einfo
));
l
i
=
*
lam
einfo
;
*
lam
einfo
=
NULL
;
INSIST
(
!
ISC_LINK_LINKED
(
z
i
,
plink
));
INSIST
(
!
ISC_LINK_LINKED
(
l
i
,
plink
));
dns_name_free
(
&
z
i
->
zon
e
,
adb
->
mctx
);
dns_name_free
(
&
l
i
->
qnam
e
,
adb
->
mctx
);
z
i
->
magic
=
0
;
l
i
->
magic
=
0
;
isc_mempool_put
(
adb
->
z
imp
,
z
i
);
isc_mempool_put
(
adb
->
l
imp
,
l
i
);
}
static
inline
dns_adbentry_t
*
...
...
@@ -1378,7 +1381,7 @@ new_adbentry(dns_adb_t *adb) {
isc_random_get
(
&
r
);
e
->
srtt
=
(
r
&
0x1f
)
+
1
;
e
->
expires
=
0
;
ISC_LIST_INIT
(
e
->
zon
einfo
);
ISC_LIST_INIT
(
e
->
lam
einfo
);
ISC_LINK_INIT
(
e
,
plink
);
return
(
e
);
...
...
@@ -1387,7 +1390,7 @@ new_adbentry(dns_adb_t *adb) {
static
inline
void
free_adbentry
(
dns_adb_t
*
adb
,
dns_adbentry_t
**
entry
)
{
dns_adbentry_t
*
e
;
dns_adb
zon
einfo_t
*
z
i
;
dns_adb
lam
einfo_t
*
l
i
;
INSIST
(
entry
!=
NULL
&&
DNS_ADBENTRY_VALID
(
*
entry
));
e
=
*
entry
;
...
...
@@ -1399,11 +1402,11 @@ free_adbentry(dns_adb_t *adb, dns_adbentry_t **entry) {
e
->
magic
=
0
;
z
i
=
ISC_LIST_HEAD
(
e
->
zon
einfo
);
while
(
z
i
!=
NULL
)
{
ISC_LIST_UNLINK
(
e
->
zon
einfo
,
z
i
,
plink
);
free_adb
zon
einfo
(
adb
,
&
z
i
);
z
i
=
ISC_LIST_HEAD
(
e
->
zon
einfo
);
l
i
=
ISC_LIST_HEAD
(
e
->
lam
einfo
);
while
(
l
i
!=
NULL
)
{
ISC_LIST_UNLINK
(
e
->
lam
einfo
,
l
i
,
plink
);
free_adb
lam
einfo
(
adb
,
&
l
i
);
l
i
=
ISC_LIST_HEAD
(
e
->
lam
einfo
);
}
isc_mempool_put
(
adb
->
emp
,
e
);
...
...
@@ -1650,45 +1653,47 @@ find_entry_and_lock(dns_adb_t *adb, isc_sockaddr_t *addr, int *bucketp) {
* Entry bucket MUST be locked!
*/
static
isc_boolean_t
entry_is_
bad_for_zon
e
(
dns_adb_t
*
adb
,
dns_adbentry_t
*
entry
,
dns_name_t
*
zon
e
,
isc_stdtime_t
now
)
entry_is_
lam
e
(
dns_adb_t
*
adb
,
dns_adbentry_t
*
entry
,
dns_name_t
*
qnam
e
,
dns_rdatatype_t
qtype
,
isc_stdtime_t
now
)
{
dns_adb
zon
einfo_t
*
z
i
,
*
next_
z
i
;
dns_adb
lam
einfo_t
*
l
i
,
*
next_
l
i
;
isc_boolean_t
is_bad
;
is_bad
=
ISC_FALSE
;
z
i
=
ISC_LIST_HEAD
(
entry
->
zon
einfo
);
if
(
z
i
==
NULL
)
l
i
=
ISC_LIST_HEAD
(
entry
->
lam
einfo
);
if
(
l
i
==
NULL
)
return
(
ISC_FALSE
);
while
(
z
i
!=
NULL
)
{
next_
z
i
=
ISC_LIST_NEXT
(
z
i
,
plink
);
while
(
l
i
!=
NULL
)
{
next_
l
i
=
ISC_LIST_NEXT
(
l
i
,
plink
);
/*
* Has the entry expired?
*/
if
(
z
i
->
lame_timer
<
now
)
{
ISC_LIST_UNLINK
(
entry
->
zon
einfo
,
z
i
,
plink
);
free_adb
zon
einfo
(
adb
,
&
z
i
);
if
(
l
i
->
lame_timer
<
now
)
{
ISC_LIST_UNLINK
(
entry
->
lam
einfo
,
l
i
,
plink
);
free_adb
lam
einfo
(
adb
,
&
l
i
);
}
/*
* Order tests from least to most expensive.
*/
if
(
zi
!=
NULL
&&
!
is_bad
)
{
if
(
dns_name_equal
(
zone
,
&
zi
->
zone
))
if
(
li
!=
NULL
&&
!
is_bad
)
{
if
(
li
->
qtype
==
qtype
&&
dns_name_equal
(
qname
,
&
li
->
qname
))
is_bad
=
ISC_TRUE
;
}
z
i
=
next_
z
i
;
l
i
=
next_
l
i
;
}
return
(
is_bad
);
}
static
void
copy_namehook_lists
(
dns_adb_t
*
adb
,
dns_adbfind_t
*
find
,
dns_name_t
*
zone
,
dns_adbname_t
*
name
,
isc_stdtime_t
now
)
copy_namehook_lists
(
dns_adb_t
*
adb
,
dns_adbfind_t
*
find
,
dns_name_t
*
qname
,
dns_rdatatype_t
qtype
,
dns_adbname_t
*
name
,
isc_stdtime_t
now
)
{
dns_adbnamehook_t
*
namehook
;
dns_adbaddrinfo_t
*
addrinfo
;
...
...
@@ -1705,7 +1710,7 @@ copy_namehook_lists(dns_adb_t *adb, dns_adbfind_t *find, dns_name_t *zone,
LOCK
(
&
adb
->
entrylocks
[
bucket
]);
if
(
!
FIND_RETURNLAME
(
find
)
&&
entry_is_
bad_for_zon
e
(
adb
,
entry
,
zon
e
,
now
))
{
&&
entry_is_
lam
e
(
adb
,
entry
,
qname
,
qtyp
e
,
now
))
{
find
->
options
|=
DNS_ADBFIND_LAMEPRUNED
;
goto
nextv4
;
}
...
...
@@ -1734,7 +1739,7 @@ copy_namehook_lists(dns_adb_t *adb, dns_adbfind_t *find, dns_name_t *zone,
bucket
=
entry
->
lock_bucket
;
LOCK
(
&
adb
->
entrylocks
[
bucket
]);
if
(
entry_is_
bad_for_zon
e
(
adb
,
entry
,
zon
e
,
now
))
if
(
entry_is_
lam
e
(
adb
,
entry
,
qname
,
qtyp
e
,
now
))
goto
nextv6
;
addrinfo
=
new_adbaddrinfo
(
adb
,
entry
,
find
->
port
);
if
(
addrinfo
==
NULL
)
{
...
...
@@ -1974,7 +1979,7 @@ destroy(dns_adb_t *adb) {
isc_mempool_destroy
(
&
adb
->
nmp
);
isc_mempool_destroy
(
&
adb
->
nhmp
);
isc_mempool_destroy
(
&
adb
->
z
imp
);
isc_mempool_destroy
(
&
adb
->
l
imp
);
isc_mempool_destroy
(
&
adb
->
emp
);
isc_mempool_destroy
(
&
adb
->
ahmp
);
isc_mempool_destroy
(
&
adb
->
aimp
);
...
...
@@ -2022,7 +2027,7 @@ dns_adb_create(isc_mem_t *mem, dns_view_t *view, isc_timermgr_t *timermgr,
adb
->
irefcnt
=
0
;
adb
->
nmp
=
NULL
;
adb
->
nhmp
=
NULL
;
adb
->
z
imp
=
NULL
;
adb
->
l
imp
=
NULL
;
adb
->
emp
=
NULL
;
adb
->
ahmp
=
NULL
;
adb
->
aimp
=
NULL
;
...
...
@@ -2094,7 +2099,7 @@ dns_adb_create(isc_mem_t *mem, dns_view_t *view, isc_timermgr_t *timermgr,
MPINIT
(
dns_adbname_t
,
adb
->
nmp
,
"adbname"
);
MPINIT
(
dns_adbnamehook_t
,
adb
->
nhmp
,
"adbnamehook"
);
MPINIT
(
dns_adb
zon
einfo_t
,
adb
->
z
imp
,
"adb
zon
einfo"
);
MPINIT
(
dns_adb
lam
einfo_t
,
adb
->
l
imp
,
"adb
lam
einfo"
);
MPINIT
(
dns_adbentry_t
,
adb
->
emp
,
"adbentry"
);
MPINIT
(
dns_adbfind_t
,
adb
->
ahmp
,
"adbfind"
);
MPINIT
(
dns_adbaddrinfo_t
,
adb
->
aimp
,
"adbaddrinfo"
);
...
...
@@ -2147,8 +2152,8 @@ dns_adb_create(isc_mem_t *mem, dns_view_t *view, isc_timermgr_t *timermgr,
isc_mempool_destroy
(
&
adb
->
nmp
);
if
(
adb
->
nhmp
!=
NULL
)
isc_mempool_destroy
(
&
adb
->
nhmp
);
if
(
adb
->
z
imp
!=
NULL
)
isc_mempool_destroy
(
&
adb
->
z
imp
);
if
(
adb
->
l
imp
!=
NULL
)
isc_mempool_destroy
(
&
adb
->
l
imp
);
if
(
adb
->
emp
!=
NULL
)
isc_mempool_destroy
(
&
adb
->
emp
);
if
(
adb
->
ahmp
!=
NULL
)
...
...
@@ -2268,8 +2273,9 @@ dns_adb_shutdown(dns_adb_t *adb) {
isc_result_t
dns_adb_createfind
(
dns_adb_t
*
adb
,
isc_task_t
*
task
,
isc_taskaction_t
action
,
void
*
arg
,
dns_name_t
*
name
,
dns_name_t
*
zone
,
unsigned
int
options
,
isc_stdtime_t
now
,
dns_name_t
*
target
,
void
*
arg
,
dns_name_t
*
name
,
dns_name_t
*
qname
,
dns_rdatatype_t
qtype
,
unsigned
int
options
,
isc_stdtime_t
now
,
dns_name_t
*
target
,
in_port_t
port
,
dns_adbfind_t
**
findp
)
{
dns_adbfind_t
*
find
;
...
...
@@ -2286,7 +2292,7 @@ dns_adb_createfind(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action,
REQUIRE
(
action
!=
NULL
);
}
REQUIRE
(
name
!=
NULL
);
REQUIRE
(
zon
e
!=
NULL
);
REQUIRE
(
qnam
e
!=
NULL
);
REQUIRE
(
findp
!=
NULL
&&
*
findp
==
NULL
);
REQUIRE
(
target
==
NULL
||
dns_name_hasbuffer
(
target
));
...
...
@@ -2514,7 +2520,7 @@ dns_adb_createfind(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action,
* Run through the name and copy out the bits we are
* interested in.
*/
copy_namehook_lists
(
adb
,
find
,
zon
e
,
adbname
,
now
);
copy_namehook_lists
(
adb
,
find
,
qname
,
qtyp
e
,
adbname
,
now
);
post_copy:
if
(
NAME_FETCH_V4
(
adbname
))
...
...
@@ -2830,8 +2836,9 @@ dump_entry(FILE *f, dns_adbentry_t *entry, isc_boolean_t debug,
isc_stdtime_t
now
)
{
char
addrbuf
[
ISC_NETADDR_FORMATSIZE
];
char
typebuf
[
DNS_RDATATYPE_FORMATSIZE
];
isc_netaddr_t
netaddr
;
dns_adb
zon
einfo_t
*
z
i
;
dns_adb
lam
einfo_t
*
l
i
;
isc_netaddr_fromsockaddr
(
&
netaddr
,
&
entry
->
sockaddr
);
isc_netaddr_format
(
&
netaddr
,
addrbuf
,
sizeof
(
addrbuf
));
...
...
@@ -2844,12 +2851,14 @@ dump_entry(FILE *f, dns_adbentry_t *entry, isc_boolean_t debug,
if
(
entry
->
expires
!=
0
)
fprintf
(
f
,
" [ttl %d]"
,
entry
->
expires
-
now
);
fprintf
(
f
,
"
\n
"
);
for
(
z
i
=
ISC_LIST_HEAD
(
entry
->
zon
einfo
);
z
i
!=
NULL
;
z
i
=
ISC_LIST_NEXT
(
z
i
,
plink
))
{
for
(
l
i
=
ISC_LIST_HEAD
(
entry
->
lam
einfo
);
l
i
!=
NULL
;
l
i
=
ISC_LIST_NEXT
(
l
i
,
plink
))
{
fprintf
(
f
,
";
\t\t
"
);
print_dns_name
(
f
,
&
zi
->
zone
);
fprintf
(
f
,
" [lame TTL %d]
\n
"
,
zi
->
lame_timer
-
now
);
print_dns_name
(
f
,
&
li
->
qname
);
dns_rdatatype_format
(
li
->
qtype
,
typebuf
,
sizeof
(
typebuf
));
fprintf
(
f
,
" %s [lame TTL %d]
\n
"
,
typebuf
,
li
->
lame_timer
-
now
);
}
}
...
...
@@ -3336,36 +3345,37 @@ fetch_name(dns_adbname_t *adbname,
* since these can be extracted from the find itself.
*/
isc_result_t
dns_adb_marklame
(
dns_adb_t
*
adb
,
dns_adbaddrinfo_t
*
addr
,
dns_name_t
*
zon
e
,
isc_stdtime_t
expire_time
)
dns_adb_marklame
(
dns_adb_t
*
adb
,
dns_adbaddrinfo_t
*
addr
,
dns_name_t
*
qnam
e
,
dns_rdatatype_t
qtype
,
isc_stdtime_t
expire_time
)
{
dns_adb
zon
einfo_t
*
z
i
;
dns_adb
lam
einfo_t
*
l
i
;
int
bucket
;
isc_result_t
result
=
ISC_R_SUCCESS
;
REQUIRE
(
DNS_ADB_VALID
(
adb
));
REQUIRE
(
DNS_ADBADDRINFO_VALID
(
addr
));
REQUIRE
(
zon
e
!=
NULL
);
REQUIRE
(
qnam
e
!=
NULL
);
bucket
=
addr
->
entry
->
lock_bucket
;
LOCK
(
&
adb
->
entrylocks
[
bucket
]);
zi
=
ISC_LIST_HEAD
(
addr
->
entry
->
zoneinfo
);
while
(
zi
!=
NULL
&&
!
dns_name_equal
(
zone
,
&
zi
->
zone
))
zi
=
ISC_LIST_NEXT
(
zi
,
plink
);
if
(
zi
!=
NULL
)
{
if
(
expire_time
>
zi
->
lame_timer
)
zi
->
lame_timer
=
expire_time
;
li
=
ISC_LIST_HEAD
(
addr
->
entry
->
lameinfo
);
while
(
li
!=
NULL
&&
li
->
qtype
!=
qtype
&&
!
dns_name_equal
(
qname
,
&
li
->
qname
))
li
=
ISC_LIST_NEXT
(
li
,
plink
);
if
(
li
!=
NULL
)
{
if
(
expire_time
>
li
->
lame_timer
)
li
->
lame_timer
=
expire_time
;
goto
unlock
;
}
z
i
=
new_adb
zon
einfo
(
adb
,
zon
e
);
if
(
z
i
==
NULL
)
{
l
i
=
new_adb
lam
einfo
(
adb
,
qname
,
qtyp
e
);
if
(
l
i
==
NULL
)
{
result
=
ISC_R_NOMEMORY
;
goto
unlock
;
}
z
i
->
lame_timer
=
expire_time
;
l
i
->
lame_timer
=
expire_time
;
ISC_LIST_PREPEND
(
addr
->
entry
->
zon
einfo
,
z
i
,
plink
);
ISC_LIST_PREPEND
(
addr
->
entry
->
lam
einfo
,
l
i
,
plink
);
unlock:
UNLOCK
(
&
adb
->
entrylocks
[
bucket
]);
...
...
lib/dns/include/dns/adb.h
View file @
bcf369e5
...
...
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: adb.h,v 1.7
8
2005/0
4
/2
9
0
0
:22:
54
marka Exp $ */
/* $Id: adb.h,v 1.7
9
2005/0
6
/2
3
0
4
:22:
02
marka Exp $ */
#ifndef DNS_ADB_H
#define DNS_ADB_H 1
...
...
@@ -50,9 +50,9 @@
* Records are stored internally until a timer expires. The timer is the
* smaller of the TTL or signature validity period.
*
* Lameness is stored per
-zon
e, and this data hangs off each
address field.
* When an address is marked lame for a given
zon
e the address
will not
* be returned to a caller.
* Lameness is stored per
<qname,qtype> tupl
e, and this data hangs off each
*
address field.
When an address is marked lame for a given
tupl
e the address
*
will not
be returned to a caller.
*
*
* MP:
...
...
@@ -330,8 +330,9 @@ dns_adb_shutdown(dns_adb_t *adb);
isc_result_t
dns_adb_createfind
(
dns_adb_t
*
adb
,
isc_task_t
*
task
,
isc_taskaction_t
action
,
void
*
arg
,
dns_name_t
*
name
,
dns_name_t
*
zone
,
unsigned
int
options
,
isc_stdtime_t
now
,
dns_name_t
*
target
,
void
*
arg
,
dns_name_t
*
name
,
dns_name_t
*
qname
,
dns_rdatatype_t
qtype
,
unsigned
int
options
,
isc_stdtime_t
now
,
dns_name_t
*
target
,
in_port_t
port
,
dns_adbfind_t
**
find
);
/*%<
* Main interface for clients. The adb will look up the name given in
...
...
@@ -385,7 +386,7 @@ dns_adb_createfind(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action,
*
*\li *name is a valid dns_name_t.
*
*\li
zon
e != NULL and *
zon
e be a valid dns_name_t.
*\li
qnam
e != NULL and *
qnam
e be a valid dns_name_t.
*
*\li target == NULL or target is a valid name with a buffer.
*
...
...
@@ -487,10 +488,10 @@ dns_adb_dumpfind(dns_adbfind_t *find, FILE *f);
*/
isc_result_t
dns_adb_marklame
(
dns_adb_t
*
adb
,
dns_adbaddrinfo_t
*
addr
,
dns_name_t
*
zon
e
,
isc_stdtime_t
expire_time
);
dns_adb_marklame
(
dns_adb_t
*
adb
,
dns_adbaddrinfo_t
*
addr
,
dns_name_t
*
qnam
e
,
dns_rdatatype_t
type
,
isc_stdtime_t
expire_time
);
/*%<
* Mark the given address as lame for the
zone "zone"
. expire_time should
* Mark the given address as lame for the
<qname,qtype>
. expire_time should
* be set to the time when the entry should expire. That is, if it is to
* expire 10 minutes in the future, it should set it to (now + 10 * 60).
*
...
...
@@ -500,7 +501,7 @@ dns_adb_marklame(dns_adb_t *adb, dns_adbaddrinfo_t *addr, dns_name_t *zone,
*
*\li addr be valid.
*
*\li
zon
e be the
zon
e used in the dns_adb_createfind() call.
*\li
qnam
e be the
qnam
e used in the dns_adb_createfind() call.
*
* Returns:
*
...
...
lib/dns/resolver.c
View file @
bcf369e5
...
...
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: resolver.c,v 1.31
1
2005/06/
17 01:58:22
marka Exp $ */
/* $Id: resolver.c,v 1.31
2
2005/06/
23 04:22:01
marka Exp $ */
/*! \file */
...
...
@@ -1757,7 +1757,7 @@ sort_finds(fetchctx_t *fctx) {
static
void
findname
(
fetchctx_t
*
fctx
,
dns_name_t
*
name
,
in_port_t
port
,
unsigned
int
options
,
unsigned
int
flags
,
isc_stdtime_t
now
,
isc_boolean_t
*
pruned
,
isc_boolean_t
*
need_alternate
)
isc_boolean_t
*
need_alternate
)
{
dns_adbaddrinfo_t
*
ai
;
dns_adbfind_t
*
find
;
...
...
@@ -1786,7 +1786,8 @@ findname(fetchctx_t *fctx, dns_name_t *name, in_port_t port,
result
=
dns_adb_createfind
(
fctx
->
adb
,
res
->
buckets
[
fctx
->
bucketnum
].
task
,
fctx_finddone
,
fctx
,
name
,
&
fctx
->
domain
,
options
,
now
,
NULL
,
&
fctx
->
name
,
fctx
->
type
,
options
,
now
,
NULL
,
res
->
view
->
dstport
,
&
find
);
if
(
result
!=
ISC_R_SUCCESS
)
{
if
(
result
==
DNS_R_ALIAS
)
{
...
...
@@ -1849,18 +1850,6 @@ findname(fetchctx_t *fctx, dns_name_t *name, in_port_t port,
(
res
->
dispatchv6
==
NULL
&&
find
->
result_v4
==
DNS_R_NXRRSET
)))
*
need_alternate
=
ISC_TRUE
;
/*
* And ADB isn't going to send us any events
* either. This find loses.
*/
if
((
find
->
options
&
DNS_ADBFIND_LAMEPRUNED
)
!=
0
)
{
/*
* The ADB pruned lame servers for
* this name. Remember that in case
* we get desperate later on.
*/
*
pruned
=
ISC_TRUE
;
}
dns_adb_destroyfind
(
&
find
);
}
}
...
...
@@ -1875,7 +1864,7 @@ fctx_getaddresses(fetchctx_t *fctx) {
unsigned
int
stdoptions
;
isc_sockaddr_t
*
sa
;
dns_adbaddrinfo_t
*
ai
;
isc_boolean_t
pruned
,
all_bad
;
isc_boolean_t
all_bad
;
dns_rdata_ns_t
ns
;
isc_boolean_t
need_alternate
=
ISC_FALSE
;
isc_boolean_t
unshared
;
...
...
@@ -1892,7 +1881,6 @@ fctx_getaddresses(fetchctx_t *fctx) {
}
res
=
fctx
->
res
;
pruned
=
ISC_FALSE
;
stdoptions
=
0
;
/* Keep compiler happy. */
unshared
=
ISC_TF
((
fctx
->
options
|
DNS_FETCHOPT_UNSHARED
)
!=
0
);
...
...
@@ -1985,7 +1973,6 @@ fctx_getaddresses(fetchctx_t *fctx) {
stdoptions
|=
DNS_ADBFIND_INET6
;
isc_stdtime_get
(
&
now
);
restart:
INSIST
(
ISC_LIST_EMPTY
(
fctx
->
finds
));
INSIST
(
ISC_LIST_EMPTY
(
fctx
->
altfinds
));
...
...
@@ -2002,7 +1989,7 @@ fctx_getaddresses(fetchctx_t *fctx) {
continue
;
findname
(
fctx
,
&
ns
.
name
,
0
,
stdoptions
,
0
,
now
,
&
pruned
,
&
need_alternate
);
&
need_alternate
);
dns_rdata_reset
(
&
rdata
);
dns_rdata_freestruct
(
&
ns
);
}
...
...
@@ -2022,7 +2009,7 @@ fctx_getaddresses(fetchctx_t *fctx) {
if
(
!
a
->
isaddress
)
{
findname
(
fctx
,
&
a
->
_u
.
_n
.
name
,
a
->
_u
.
_n
.
port
,
stdoptions
,
FCTX_ADDRINFO_FORWARDER
,
now
,
&
pruned
,
NULL
);
now
,
NULL
);
continue
;
}
if
(
isc_sockaddr_pf
(
&
a
->
_u
.
addr
)
!=
family
)
...
...
@@ -2065,18 +2052,6 @@ fctx_getaddresses(fetchctx_t *fctx) {
* yet. Tell the caller to wait for an answer.
*/
result
=
DNS_R_WAIT
;
}
else
if
(
pruned
)
{
/*
* Some addresses were removed by lame pruning.
* Turn pruning off and try again.
*/
FCTXTRACE
(
"restarting with returnlame"
);
INSIST
((
stdoptions
&
DNS_ADBFIND_RETURNLAME
)
==
0
);
stdoptions
|=
DNS_ADBFIND_RETURNLAME
;
pruned
=
ISC_FALSE
;
fctx_cleanupaltfinds
(
fctx
);
fctx_cleanupfinds
(
fctx
);
goto
restart
;
}
else
{
/*
* We've lost completely. We don't know any
...
...
@@ -5344,7 +5319,7 @@ resquery_response(isc_task_t *task, isc_event_t *event) {
is_lame
(
fctx
))
{
log_lame
(
fctx
,
query
->
addrinfo
);
result
=
dns_adb_marklame
(
fctx
->
adb
,
query
->
addrinfo
,
&
fctx
->
domain
,
&
fctx
->
domain
,
fctx
->
type
,
now
+
fctx
->
res
->
lame_ttl
);
if
(
result
!=
ISC_R_SUCCESS
)
isc_log_write
(
dns_lctx
,
DNS_LOGCATEGORY_RESOLVER
,
...
...
lib/dns/zone.c
View file @
bcf369e5
...
...
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: zone.c,v 1.44
0
2005/06/2
0
0
1:03:53
marka Exp $ */
/* $Id: zone.c,v 1.44
1
2005/06/2
3
0
4:22:02
marka Exp $ */