mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-03 16:15:27 +00:00
add test support for dropping edns messages (-T dropedns); ignoring edns in queries (-T noedns); variable max UDP (-T maxudp=value)
This commit is contained in:
@@ -1656,8 +1656,18 @@ client_request(isc_task_t *task, isc_event_t *event) {
|
||||
/*
|
||||
* Deal with EDNS.
|
||||
*/
|
||||
if (ns_g_noedns)
|
||||
opt = NULL;
|
||||
else
|
||||
opt = dns_message_getopt(client->message);
|
||||
if (opt != NULL) {
|
||||
/*
|
||||
* Are we dropping all EDNS queries?
|
||||
*/
|
||||
if (ns_g_dropedns) {
|
||||
ns_client_next(client, ISC_R_SUCCESS);
|
||||
goto cleanup;
|
||||
}
|
||||
/*
|
||||
* Set the client's UDP buffer size.
|
||||
*/
|
||||
|
@@ -152,6 +152,8 @@ EXTERN int ns_g_listen INIT(3);
|
||||
EXTERN isc_time_t ns_g_boottime;
|
||||
EXTERN isc_boolean_t ns_g_memstatistics INIT(ISC_FALSE);
|
||||
EXTERN isc_boolean_t ns_g_clienttest INIT(ISC_FALSE);
|
||||
EXTERN isc_boolean_t ns_g_dropedns INIT(ISC_FALSE);
|
||||
EXTERN isc_boolean_t ns_g_noedns INIT(ISC_FALSE);
|
||||
EXTERN isc_boolean_t ns_g_nosoa INIT(ISC_FALSE);
|
||||
EXTERN isc_boolean_t ns_g_noaa INIT(ISC_FALSE);
|
||||
EXTERN unsigned int ns_g_delay INIT(0);
|
||||
|
@@ -525,6 +525,13 @@ parse_command_line(int argc, char *argv[]) {
|
||||
maxudp = 512;
|
||||
else if (!strcmp(isc_commandline_argument, "maxudp1460"))
|
||||
maxudp = 1460;
|
||||
else if (!strcmp(isc_commandline_argument, "dropedns"))
|
||||
ns_g_dropedns = ISC_TRUE;
|
||||
else if (!strcmp(isc_commandline_argument, "noedns"))
|
||||
ns_g_noedns = ISC_TRUE;
|
||||
else if (!strncmp(isc_commandline_argument,
|
||||
"maxudp=", 7))
|
||||
maxudp = atoi(isc_commandline_argument + 7);
|
||||
else if (!strncmp(isc_commandline_argument,
|
||||
"delay=", 6))
|
||||
ns_g_delay = atoi(isc_commandline_argument + 6);
|
||||
|
@@ -253,7 +253,7 @@ sub verify_server {
|
||||
|
||||
my $tries = 0;
|
||||
while (1) {
|
||||
my $return = system("$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd -p 5300 version.bind. chaos txt \@10.53.0.$n > dig.out");
|
||||
my $return = system("$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd +noedns -p 5300 version.bind. chaos txt \@10.53.0.$n > dig.out");
|
||||
last if ($return == 0);
|
||||
if (++$tries >= 30) {
|
||||
print `grep ";" dig.out > /dev/null`;
|
||||
|
@@ -1765,7 +1765,7 @@ doio_recv(isc__socket_t *sock, isc_socketevent_t *dev) {
|
||||
}
|
||||
/*
|
||||
* Simulate a firewall blocking UDP responses bigger than
|
||||
* 512 bytes.
|
||||
* 'maxudp' bytes.
|
||||
*/
|
||||
if (sock->manager->maxudp != 0 && cc > sock->manager->maxudp)
|
||||
return (DOIO_SOFT);
|
||||
@@ -1859,6 +1859,11 @@ doio_send(isc__socket_t *sock, isc_socketevent_t *dev) {
|
||||
build_msghdr_send(sock, dev, &msghdr, iov, &write_count);
|
||||
|
||||
resend:
|
||||
if (sock->type == isc_sockettype_udp &&
|
||||
sock->manager->maxudp != 0 &&
|
||||
write_count > (size_t)sock->manager->maxudp)
|
||||
cc = write_count;
|
||||
else
|
||||
cc = sendmsg(sock->fd, &msghdr, 0);
|
||||
send_errno = errno;
|
||||
|
||||
|
Reference in New Issue
Block a user