diff --git a/bin/named/client.c b/bin/named/client.c index 9671907bd6..508d269987 100644 --- a/bin/named/client.c +++ b/bin/named/client.c @@ -1656,8 +1656,18 @@ client_request(isc_task_t *task, isc_event_t *event) { /* * Deal with EDNS. */ - opt = dns_message_getopt(client->message); + 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. */ diff --git a/bin/named/include/named/globals.h b/bin/named/include/named/globals.h index 72dd1e8639..8197f55449 100644 --- a/bin/named/include/named/globals.h +++ b/bin/named/include/named/globals.h @@ -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); diff --git a/bin/named/main.c b/bin/named/main.c index eb3b3f4e7f..3c8c08fec2 100644 --- a/bin/named/main.c +++ b/bin/named/main.c @@ -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); diff --git a/bin/tests/system/start.pl b/bin/tests/system/start.pl index fb243c27d4..12f7c7a854 100644 --- a/bin/tests/system/start.pl +++ b/bin/tests/system/start.pl @@ -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`; diff --git a/lib/isc/unix/socket.c b/lib/isc/unix/socket.c index da9d82608a..a7fc65ed98 100644 --- a/lib/isc/unix/socket.c +++ b/lib/isc/unix/socket.c @@ -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,7 +1859,12 @@ doio_send(isc__socket_t *sock, isc_socketevent_t *dev) { build_msghdr_send(sock, dev, &msghdr, iov, &write_count); resend: - cc = sendmsg(sock->fd, &msghdr, 0); + 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; /*