]> granicus.if.org Git - libevent/commit
Fix getaddrinfo under solaris (for multiprotocol case)
authorAzat Khuzhin <azat@solaris.azat>
Mon, 9 May 2016 22:34:28 +0000 (22:34 +0000)
committerAzat Khuzhin <a3at.mail@gmail.com>
Wed, 10 Aug 2016 08:15:15 +0000 (11:15 +0300)
commit40730ae33310a3fd81bb00457d75c6e54494bad7
tree803a60eddbd79a8c0c4081c222fe0fbd1b8fdaa8
parentdc95823cd79d32be8154e94f64f30e61a90850e2
Fix getaddrinfo under solaris (for multiprotocol case)

During testing on solaris 11.3, util/getaddrinfo failed at:
  memset(&hints, 0, sizeof(hints));
  hints.ai_flags = EVUTIL_AI_NUMERICHOST;
  r = evutil_getaddrinfo("1.2.3.4", NULL, &hints, &ai);
  tt_assert(ai_find_by_protocol(ai, IPPROTO_TCP));

And this is because solaris's getaddrinfo() returns:
$6 = {
  ai_flags = 32,
  ai_family = 2,
  ai_socktype = 0,
  ai_protocol = 0, <-- no proto
  ai_addrlen = 16,
  ai_canonname = 0x0,
  ai_addr = 0x815d658,
  ai_next = 0x0 <-- nothing else
}

So we should emulate this too.

Plus introduce helper that will search through all results, not only first one.

Fixes: util/getaddrinfo
Fixes: #354
evutil.c