Hello, I am busy on the last steps to integrate NSD with our setup, so that we can move a nameserver (hopefully all of them) to NSD. I noticed that it is not possible for nsd-xfer to create a socket with an arbitrary local IP address. We slave zones from many master servers which are not managed by ourselves. These people are all expecting our AXFR's to come from a known IP which is not the interface's primary IP (for various reasons, mainly that we can quickly move the nameserver IP alias between machines in case of hardware failure). So I created a small patch for NSD 2.3.0 to specify the source address to nsd-xfer. It may be useful to others as well, so perhaps this* could be included in a future release. (* = Or something which functions like it, I won't say I am a world class C programmer) :) The patch adds a command line parameter to nsd-xfer: -a src Local hostname/IP for the connection. Also it adds nsdxfer_flags to nsdc which can be set in nsdc.conf. I have tested it only on FreeBSD 5.4 with IPv4. If you'd specify a hostname which has both A and AAAA records, I'm pretty sure both protocols would be handled correctly by taking res->ai_family of the current server and passing it to gethostbyname2(). Any comments are welcome... On FreeBSD, the following patch can be applied to /usr/ports/dns/nsd after doing a "make extract". http://www.lifeforms.nl/~walter/nsd-xfer_2.3.0_bindip.patch PS: It seems that there were two leftovers called "namedxfer" in Makefile.in and nsdc.conf.sample.in, I changed these to read "nsdxfer" as well.. Cheers, Walter Hop Transip BV -- Transip BV | http://www.transip.nl/ Hoogwaardige Innovatie | Aangename Zekerheid
On Mon, Aug 15, 2005 at 12:11:30AM +0200, Walter Hop wrote:> On FreeBSD, the following patch can be applied to /usr/ports/dns/nsd > after doing a "make extract". > http://www.lifeforms.nl/~walter/nsd-xfer_2.3.0_bindip.patchIt's a good idea, binding to a local IP is useful. The code isn't very portable though :/ Don't use gethostbyname2(), use getaddrinfo(). Same goes for bzero and bcopy, use memset and memcpy. bzero and bcopy arn't portable. -- Colm MacC?rthaigh / HEAnet, Teach Brooklawn, / Innealt?ir L?onra +353 1 6609040 / B?thar Shelbourne, B?C, IE / http://www.hea.net/
Walter Hop wrote:> On FreeBSD, the following patch can be applied to /usr/ports/dns/nsd > after doing a "make extract". > http://www.lifeforms.nl/~walter/nsd-xfer_2.3.0_bindip.patchThanks, I'll add this patch (modified for portability) to NSD. Erik