--- old/bind-8.1/src/bin/named/ns_config.c Wed May 7 01:13:29 1997 +++ bind-8.1/src/bin/named/ns_config.c Wed Jun 11 16:40:57 1997 @@ -819,6 +819,7 @@ case OPTION_NONOTIFY: case OPTION_NONAUTH_NXDOMAIN: case OPTION_MULTIPLE_CNAMES: + case OPTION_QUERY_PROTOCOL: if (value) op->flags |= bool_opt; else --- old/bind-8.1/src/bin/named/ns_defs.h Wed May 7 01:13:29 1997 +++ bind-8.1/src/bin/named/ns_defs.h Wed Jun 11 16:10:11 1997 @@ -138,6 +138,7 @@ #define OPTION_NONAUTH_NXDOMAIN 0x0020 /* Generate non-auth NXDOMAINs? */ #define OPTION_MULTIPLE_CNAMES 0x0040 /* Allow a name to have multiple * CNAME RRs */ +#define OPTION_QUERY_PROTOCOL 0x0080 /* force using TCP in queries */ #ifdef BIND_UPDATE #define SOAINCRINTVL 300 /* default value for the time after which --- old/bind-8.1/src/bin/named/ns_lexer.c Fri Apr 25 02:14:57 1997 +++ bind-8.1/src/bin/named/ns_lexer.c Wed Jun 11 16:16:24 1997 @@ -264,6 +264,7 @@ {"print-category", T_PRINT_CATEGORY}, {"print-severity", T_PRINT_SEVERITY}, {"print-time", T_PRINT_TIME}, + {"query-protocol", T_QUERY_PROTOCOL}, {"query-source", T_QUERY_SOURCE}, {"recursion", T_RECURSION}, {"response", T_RESPONSE}, @@ -275,6 +276,7 @@ {"stacksize", T_STACKSIZE}, {"stub", T_STUB}, {"syslog", T_SYSLOG}, + {"tcp", T_TCP}, {"topology", T_TOPOLOGY}, {"transfer-format", T_TRANSFER_FORMAT}, {"transfers", T_TRANSFERS}, @@ -283,6 +285,7 @@ {"transfers-per-ns", T_TRANSFERS_PER_NS}, {"true", T_TRUE}, {"type", T_TYPE}, + {"udp", T_UDP}, {"unlimited", T_UNLIMITED}, {"versions", T_VERSIONS}, {"warn", T_WARN}, --- old/bind-8.1/src/bin/named/ns_parser.y Fri Apr 25 02:31:43 1997 +++ bind-8.1/src/bin/named/ns_parser.y Wed Jun 11 16:14:56 1997 @@ -121,7 +121,9 @@ %token T_OPTIONS %token T_DIRECTORY T_PIDFILE T_NAMED_XFER %token T_FAKE_IQUERY T_RECURSION T_FETCH_GLUE +%token T_QUERY_PROTOCOL %token T_QUERY_SOURCE T_LISTEN_ON T_PORT T_ADDRESS +%type query_protocol %type in_port %type maybe_port %type maybe_wild_port @@ -324,6 +326,10 @@ } } '{' opt_forwarders_list '}' + | T_QUERY_PROTOCOL query_protocol + { + set_boolean_option(current_options, OPTION_QUERY_PROTOCOL, $2); + } | T_QUERY_SOURCE query_source | T_ALLOW_QUERY '{' address_match_list '}' { @@ -397,6 +403,16 @@ maybe_port: /* nothing */ { $$ = htons(NS_DEFAULTPORT); } | T_PORT in_port { $$ = $2; } + ; + +query_protocol: T_TCP + { + $$ = 1; + } + | T_UDP + { + $$ = 0; + } ; yea_or_nay: T_YES --- old/bind-8.1/src/bin/named/ns_req.c Fri Apr 25 02:39:24 1997 +++ bind-8.1/src/bin/named/ns_req.c Wed Jun 11 16:13:03 1997 @@ -895,7 +895,7 @@ *msglenp = n; } n = ns_forw(nsp, msg, *msglenp, from, qsp, dfd, &qp, - dname, class, type, np, 0); + dname, class, type, np, ns_option_p(OPTION_QUERY_PROTOCOL)); if (n != FW_OK && cname) free(omsg); switch (n) { --- old/bind-8.1/src/bin/named/ns_resp.c Mon Apr 28 22:16:20 1997 +++ bind-8.1/src/bin/named/ns_resp.c Wed Jun 11 23:46:41 1997 @@ -2084,7 +2084,10 @@ /* build new qinfo struct */ qp->q_cmsg = qp->q_msg = NULL; - qp->q_dfd = ds; + if (ns_option_p(OPTION_QUERY_PROTOCOL)) + qp->q_flags |= Q_USEVC; + if (!(qp->q_flags & Q_USEVC)) + qp->q_dfd = ds; if (nss && nsc) qp->q_fwd = NULL; else @@ -2202,7 +2205,15 @@ fp_nquery(qp->q_msg, qp->q_msglen, log_get_stream(packet_channel)); #endif - if (sendto(qp->q_dfd, (char*)qp->q_msg, qp->q_msglen, 0, + if (qp->q_flags & Q_USEVC) { + if (tcp_send(qp) != NOERROR) { + if (!haveComplained(ina_ulong(nsa->sin_addr), + (u_long)tcpsendStr)) + ns_info(ns_log_default, + "ns_forw: tcp_send(%s) failed: %s", + sin_ntoa(*nsa), strerror(errno)); + } + } else if (sendto(qp->q_dfd, (char*)qp->q_msg, qp->q_msglen, 0, (struct sockaddr *)nsa, sizeof(struct sockaddr_in)) < 0) { if (!haveComplained(ina_ulong(nsa->sin_addr), --- old/bind-8.1/src/bin/named/ns_udp.c Wed Jan 29 11:01:58 1997 +++ bind-8.1/src/bin/named/ns_udp.c Wed Jun 11 14:45:23 1997 @@ -34,7 +34,9 @@ #include #include #include +#if defined(CHECK_UDP_SUM) || defined(FIX_UDP_SUM) #include +#endif #include #include #include --- old/bind-8.1/src/bin/named/ns_update.c Sat Apr 26 06:58:09 1997 +++ bind-8.1/src/bin/named/ns_update.c Wed Jun 11 23:11:11 1997 @@ -872,7 +872,8 @@ /* * If the request came in over TCP, forward it over TCP */ - should_use_tcp = (qsp != NULL); + should_use_tcp = + (qsp != NULL) || ns_option_p(OPTION_QUERY_PROTOCOL); n = ns_forw(nsp, msg, eom-msg, from, qsp, dfd, &qp, dname, class, type, NULL, should_use_tcp); free_nsp(nsp); --- old/bind-8.1/src/port/linux/Makefile.set Fri Apr 25 00:53:17 1997 +++ bind-8.1/src/port/linux/Makefile.set Wed Jun 11 14:42:15 1997 @@ -1,5 +1,5 @@ 'CC=gcc' -'CDEBUG=-O -g' +'CDEBUG=-O6 -m486' 'DESTBIN=/usr/bin' 'DESTSBIN=/usr/sbin' 'DESTEXEC=/usr/sbin' --- old/bind-8.1/src/port/linux/probe Wed Dec 4 11:39:09 1996 +++ bind-8.1/src/port/linux/probe Wed Jun 11 16:12:43 1997 @@ -8,4 +8,12 @@ esac fi +uname=/usr/bin/uname + +if [ -f $uname ]; then + case `$uname -s` in + Linux) exit 0 ;; + esac +fi + exit 1