]> git.ipfire.org Git - thirdparty/glibc.git/commit
resolv: fix rotate option
authorAurelien Jarno <aurelien@aurel32.net>
Tue, 6 Jan 2015 16:50:23 +0000 (08:50 -0800)
committerH.J. Lu <hjl.tools@gmail.com>
Tue, 6 Jan 2015 17:00:20 +0000 (09:00 -0800)
commit38949026b3600d035281d8eaf833dd327585bdd0
tree9331f16fe31c1a68179daeb5fbf502b7a19b8f2d
parent5fe55e9c654be9055d5ee22dce749c0ee8a3bb75
resolv: fix rotate option

The rotate option doesn't work correctly, and only send the query to the
same server (the second in the list). The rotation code in itself is not
broken, but the nsaddrs structure is reinitialized each time at the
beginning of __libc_res_nsend unless RES_STAYOPEN is enabled.

This is due to a call to __res_iclose from the end of __libc_res_nsend
when answers from the name server have been received. This function
closes all the sockets, but doesn't free the addresses (it can do that,
but in that case the second argument is false).

This patch change the code of __res_iclose to clear statp->_u._ext.nsinit
 only when the addresses are actually freed.

* resolv/res_init.c (__res_iclose): Only clear nsinit if the
addresses have been freed.
ChangeLog
resolv/res_init.c