Greetings,

I was doing a review of my network activity and I noticed that PDNS
Recursor (verified in 3.1.4) ignores the query-local-address option when
performing TCP queries.

I've attached a quick and dirty patch that makes a call to Socket.bind()
in lwres.cc.  It isn't the most elegant code, but it's about the limit
of what I can remember how to do in C++ these days.  So far it hasn't
caused any trouble on my system (Linux, 2.6.8 kernel), but I haven't
tested it extensively yet.

- Wayne
*** lwres.cc.orig	2006-11-12 16:56:13.000000000 +0000
--- lwres.cc	2006-12-08 20:09:23.761138682 +0000
***************
*** 96,103 ****
--- 96,105 ----
        if(ip.sin4.sin_family != AF_INET) // sstuff isn't yet ready for IPv6
  	return -1;
        Socket s(InterNetwork, Stream);
+       IPEndpoint li(::arg()["query-local-address"], 0);
        IPEndpoint ie(U32ToIP(ntohl(ip.sin4.sin_addr.s_addr)), 53);   // WRONG WRONG WRONG XXX FIXME
        s.setNonBlocking();
+       s.bind(li);
        s.connect(ie);
        
        uint16_t len=htons(vpacket.size());
_______________________________________________
Pdns-users mailing list
[email protected]
http://mailman.powerdns.com/mailman/listinfo/pdns-users

Reply via email to