]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
add test support for dropping edns messages (-T dropedns); ignoring edns in queries...
authorMark Andrews <marka@isc.org>
Mon, 15 Oct 2012 23:23:08 +0000 (10:23 +1100)
committerMark Andrews <marka@isc.org>
Mon, 15 Oct 2012 23:23:08 +0000 (10:23 +1100)
bin/named/client.c
bin/named/include/named/globals.h
bin/named/main.c
bin/tests/system/start.pl
lib/isc/unix/socket.c

index 9671907bd66b75e7c00bb2e292fc1495de685502..508d26998783d77af85f31fb954c2c10cec6c4b8 100644 (file)
@@ -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.
                 */
index 72dd1e86397c4a273aa84d4042b1c748849ed4f3..8197f5544909f6ec670eb07720d682f4428e5e6c 100644 (file)
@@ -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);
index eb3b3f4e7f11051c12be85e9ace2f7451ac4c30f..3c8c08fec22625581aeb69381cdd2d1d0d77d98f 100644 (file)
@@ -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);
index fb243c27d4be10bd38663035387b9202f5250c1e..12f7c7a854c2ee0e36337737ab5679ef25118fc9 100644 (file)
@@ -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`;
index da9d82608afd4cdb4275e08cade8c2d4904bef5f..a7fc65ed98e681926a1f320ca67d869cbf137ba9 100644 (file)
@@ -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;
 
        /*