(stripping bind-users@ from the CC list since current bind versions aren't affected)
"Pawel S. Veselov" <[email protected]> writes: > On Sun, 1 Feb 2015 15:06:17 -0800 > "Pawel S. Veselov" <[email protected]> wrote: > >> Running latest amd64 5.6 (p16, just upgraded to it), for some reason >> my nslookup keeps trying to use port 48830 to connect to the NS >> server. gethostbyname() works just fine, all the apps resolve the >> hostnames just fine, but host/dig/nslookup don't. > > Of course, the problem was typo in 'nameservers' line > in /etc/resolv.conf. If there are no name servers, dig tools use > internal default, but don't set up the port number, so uninitialized > memory is used. This patch should take care of it, looks like it's the > right place for this. > > # diff -up dighost.c.old dighost.c > --- dighost.c.old Sun Feb 1 21:25:31 2015 > +++ dighost.c Sun Feb 1 21:26:39 2015 > @@ -645,10 +645,12 @@ add_nameserver > confdata->nameservers[i].family = LWRES_ADDRTYPE_V4; > confdata->nameservers[i].length = NS_INADDRSZ; > + confdata->nameserverports[i] = NAMESERVER_PORT; > break; > case AF_INET6: > confdata->nameservers[i].family = LWRES_ADDRTYPE_V6; > confdata->nameservers[i].length = NS_IN6ADDRSZ; > + confdata->nameserverports[i] = NAMESERVER_PORT; > break; > default: > return (ISC_R_FAILURE); > > Actually, lwres_conf_init is supposed to handle this (see lwres_conf_clear), but the nameserverports array was forgotten. If the port is 0, NAMESERVER_PORT is used instead. This diff also fixes your issue. ok? Index: lwconfig.c =================================================================== RCS file: /cvs/src/usr.sbin/bind/lib/lwres/lwconfig.c,v retrieving revision 1.9 diff -u -p -p -u -r1.9 lwconfig.c --- lwconfig.c 16 Aug 2009 13:17:44 -0000 1.9 +++ lwconfig.c 15 Feb 2015 01:34:26 -0000 @@ -242,8 +242,10 @@ lwres_conf_init(lwres_context_t *ctx) { confdata->ndots = 1; confdata->no_tld_query = 0; - for (i = 0; i < LWRES_CONFMAXNAMESERVERS; i++) + for (i = 0; i < LWRES_CONFMAXNAMESERVERS; i++) { lwres_resetaddr(&confdata->nameservers[i]); + confdata->nameserverports[i] = 0; + } for (i = 0; i < LWRES_CONFMAXSEARCH; i++) confdata->search[i] = NULL; -- jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE
