< Previous by Date Date Index Next by Date >
  Thread Index  

[reSIProcate] [PATCH] (Mac platform) Getting DNS servers from system and no network connectivity assert


Hi,

This patch, created by our Mac folks, of 'ares_init.c' only applies to Mac
implementations. I'll check it in later tomorrow, but thought I'd give those
interested a heads-up to review.


It solves 2 problems:

1) an assert in open_udp_socket which is as good as a crash on a Mac

2) it populates the DNS servers data structures, channel->servers[x], using
information from the host system. Much like the Windows' path.


Details:
----------
1)

The vague scenario:
i) compile stack with 'USE_IPV6' 
ii) no network connectivity (unplug net cable)
iii) have the stack/ares do a dns query

ares will assert in 'open_udp_socket' of ares_process.c:

static int open_udp_socket(ares_channel channel, struct server_state
*server)
...
  assert(server->family == AF_INET || server->family == AF_INET6);

This is due to channel->servers[x].family not being initialized at all along
the no-network path.


2) see 'init_by_defaults_systemconfiguration'


Van.

Attachment: ares_init.c.diff
Description: Binary data