1
0
mirror of https://frontier.innolan.net/rainlance/c-ares.git synced 2025-10-05 18:30:31 +00:00

port numbers: convert them to network order!

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
This commit is contained in:
Daniel Stenberg
2012-02-25 22:42:39 +01:00
parent 1c26242c52
commit 506d586276

View File

@ -434,9 +434,9 @@ static int init_by_options(ares_channel channel,
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;