When the config options ARES_OPT_UDP_PORT or ARES_OPT_TCP_PORT are used,
make sure to convert them to network byte order!
Bug: http://c-ares.haxx.se/mail/c-ares-archive-2012-02/0004.shtml
if ((optmask & ARES_OPT_ROTATE) && channel->rotate == -1)
channel->rotate = 1;
if ((optmask & ARES_OPT_UDP_PORT) && channel->udp_port == -1)
- channel->udp_port = options->udp_port;
+ channel->udp_port = htons(options->udp_port);
if ((optmask & ARES_OPT_TCP_PORT) && channel->tcp_port == -1)
- channel->tcp_port = options->tcp_port;
+ channel->tcp_port = htons(options->tcp_port);
if ((optmask & ARES_OPT_SOCK_STATE_CB) && channel->sock_state_cb == NULL)
{
channel->sock_state_cb = options->sock_state_cb;