dig source port patch

Ladislav Vobr lvobr at ies.etisalat.ae
Thu Aug 28 07:48:28 UTC 2003


If you are running recursive server behind the firewall, which does not 
support "udp states", and restricted the firewall to only bind 
source-port, which is good thing to do imho, this might be handy for you 
to run dig directly from such a server.

here is the patch for the dig 9.2.2 to use user specified client port.
abc# diff dig.c dig.c.orig

920,930d919
<
<               {
<                 char *p;
<                 short lport = 0;
<
<                 if ((p = strchr(value, ':')) != NULL)
<                 {
<                 *p++ = '\0';
<                 lport = atoi(p);
<                 }
<
934c923
<                       isc_sockaddr_fromin(&bind_address, &in4, lport);
---
 >                       isc_sockaddr_fromin(&bind_address, &in4, 0);
939d927
<               }

abc# pwd
/var/linux/bind-9.2.2/bin/dig

just run dig with -b sourceaddress:sourceport

Ladislav



More information about the bind-users mailing list