On Mon, Sep 16, 2013 at 21:23, Kapetanakis Giannis wrote:
> The following diff fixes the problem and the program works in current.
> The program is bahamut ircd and I managed to make it work up to 5.3
> without this.
> In current it's broken due to resolver errors.
>
> Don't know if you have a reason to not populate _res.nsaddr_list in the
> new res_init() from asr interface.
I think a patch like this should go in. It's just easier to be
compatible with the stupid old _res interface for now. Maybe later we
can push programs to use the builtin async resolver.
In the mean time, some feedback on the diff.
> _res.nscount = ac->ac_nscount;
> + for (i = 0; i < ac->ac_nscount; i++) {
> + _res.nsaddr_list[i] = *((struct sockaddr_in *)
> ac->ac_ns[i]);
> + }
> +
I think this will give unexpected results if ipv6 resolvers are
configured. You'll notice the asr code is allocating possibly varying
amounts of memory. I think you're going to want to memcpy the correct
length.
memcpy(&_res.nsaddr_list[i], ac->ac_ns[i], ac->ac_ns[i]->sa_len);