diff -Naur dns.h dns.h --- dns.h 2000-03-18 16:18:42.000000000 +0100 +++ dns.h 2011-06-02 19:18:55.000000000 +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; char *servers; + uint16 port; char localip[4]; char qtype[2]; } ; diff -Naur dns_transmit.c dns_transmit.c --- dns_transmit.c 2000-03-18 16:18:42.000000000 +0100 +++ dns_transmit.c 2011-06-02 19:19:47.000000000 +0200 @@ -5,6 +5,7 @@ #include "readwrite.h" #include "uint16.h" #include "dns.h" +#include "env.h" static int serverwantstcp(char *buf,unsigned int len) { @@ -109,7 +110,7 @@ if (!d->s1) { dns_transmit_free(d); return -1; } if (randombind(d) == -1) { dns_transmit_free(d); return -1; } - if (socket_connect4(d->s1 - 1,ip,53) == 0) + if (socket_connect4(d->s1 - 1,ip,d->port) == 0) if (send(d->s1 - 1,d->query + 2,d->querylen - 2,0) == d->querylen - 2) { struct taia now; taia_now(&now); @@ -163,7 +164,7 @@ taia_now(&now); taia_uint(&d->deadline,10); taia_add(&d->deadline,&d->deadline,&now); - if (socket_connect4(d->s1 - 1,ip,53) == 0) { + if (socket_connect4(d->s1 - 1,ip,d->port) == 0) { d->tcpstate = 2; return 0; } @@ -211,6 +212,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,4,localip); d->udploop = flagrecursive ? 1 : 0;