Download | Plain Text | Line Numbers


diff -Naur ucspi-tcp6-1.00.orig/src/dns.h ucspi-tcp6-1.00/src/dns.h
--- ucspi-tcp6-1.00.orig/src/dns.h	2013-05-04 16:50:39.000000000 +0200
+++ ucspi-tcp6-1.00/src/dns.h	2014-05-18 23:31:30.195434565 +0200
@@ -4,6 +4,7 @@
 #include "stralloc.h"
 #include "iopause.h"
 #include "taia.h"
+#include "uint16.h"
 
 #define DNS_C_IN "\0\1"
 #define DNS_C_ANY "\0\377"
@@ -35,6 +36,7 @@
   struct taia deadline;
   unsigned int pos;
   const char *servers;
+  uint16 port;
   char localip[16];
   unsigned int scope_id;
   char qtype[2];
diff -Naur ucspi-tcp6-1.00.orig/src/dns_transmit.c ucspi-tcp6-1.00/src/dns_transmit.c
--- ucspi-tcp6-1.00.orig/src/dns_transmit.c	2014-01-08 14:57:35.000000000 +0100
+++ ucspi-tcp6-1.00/src/dns_transmit.c	2014-05-18 23:31:30.196434582 +0200
@@ -8,6 +8,7 @@
 #include "uint16.h"
 #include "dns.h"
 #include "ip6.h"
+#include "env.h"
 
 #define UDPSIZE 1024 /* IPv6 MTU size is 1280 byte */
 
@@ -114,7 +115,7 @@
         if (!d->s1) { dns_transmit_free(d); return -1; }
 	if (randombind(d) == -1) { dns_transmit_free(d); return -1; }
 
-        if (socket_connect6(d->s1 - 1,ip,53,d->scope_id) == 0)
+        if (socket_connect6(d->s1 - 1,ip,d->port,d->scope_id) == 0)
           if (send(d->s1 - 1,d->query + 2,d->querylen - 2,0) == d->querylen - 2) {
             struct taia now;
             taia_now(&now);
@@ -168,7 +169,7 @@
       taia_now(&now);
       taia_uint(&d->deadline,10);
       taia_add(&d->deadline,&d->deadline,&now);
-      if (socket_connect6(d->s1 - 1,ip,53,d->scope_id) == 0) {
+      if (socket_connect6(d->s1 - 1,ip,d->port,d->scope_id) == 0) {
         d->tcpstate = 2;
         return 0;
       }
@@ -216,6 +217,8 @@
 
   byte_copy(d->qtype,2,qtype);
   d->servers = servers;
+  d->port = 53;
+  if (env_get("DNSCACHEPORT")) scan_ulong(env_get("DNSCACHEPORT"),&d->port);
   byte_copy(d->localip,16,localip);
 
   d->udploop = flagrecursive ? 1 : 0;