From 05ef2980ee3bbd636e73f685338e8f21b88d507d Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Thu, 7 May 2015 11:51:00 -0400 Subject: [PATCH] aix: fix setsockopt for multicast options On AIX the length of socket options for multicast and ttl options is not always sizeof(char). AIX has the same issue as solaris which was fixed under PR-URL: https://github.com/libuv/libuv/pull/243 This PR extends the fix to cover AIX as well. PR-URL: https://github.com/libuv/libuv/pull/345 Reviewed-By: Ben Noordhuis --- src/unix/udp.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/unix/udp.c b/src/unix/udp.c index 22c2e138..2648fd23 100644 --- a/src/unix/udp.c +++ b/src/unix/udp.c @@ -666,13 +666,13 @@ int uv_udp_set_ttl(uv_udp_t* handle, int ttl) { * so hardcode the size of these options on this platform, * and use the general uv__setsockopt_maybe_char call on other platforms. */ -#if defined(__sun) +#if defined(__sun) || defined(_AIX) return uv__setsockopt(handle, IP_TTL, IPV6_UNICAST_HOPS, &ttl, sizeof(ttl)); -#endif /* defined(__sun) */ +#endif /* defined(__sun) || defined(_AIX) */ return uv__setsockopt_maybe_char(handle, IP_TTL, @@ -688,14 +688,14 @@ int uv_udp_set_multicast_ttl(uv_udp_t* handle, int ttl) { * IP_MULTICAST_TTL, so hardcode the size of the option in the IPv6 case, * and use the general uv__setsockopt_maybe_char call otherwise. */ -#if defined(__sun) +#if defined(__sun) || defined(_AIX) if (handle->flags & UV_HANDLE_IPV6) return uv__setsockopt(handle, IP_MULTICAST_TTL, IPV6_MULTICAST_HOPS, &ttl, sizeof(ttl)); -#endif /* defined(__sun) */ +#endif /* defined(__sun) || defined(_AIX) */ return uv__setsockopt_maybe_char(handle, IP_MULTICAST_TTL, @@ -711,14 +711,14 @@ int uv_udp_set_multicast_loop(uv_udp_t* handle, int on) { * IP_MULTICAST_LOOP, so hardcode the size of the option in the IPv6 case, * and use the general uv__setsockopt_maybe_char call otherwise. */ -#if defined(__sun) +#if defined(__sun) || defined(_AIX) if (handle->flags & UV_HANDLE_IPV6) return uv__setsockopt(handle, IP_MULTICAST_LOOP, IPV6_MULTICAST_LOOP, &on, sizeof(on)); -#endif /* defined(__sun) */ +#endif /* defined(__sun) || defined(_AIX) */ return uv__setsockopt_maybe_char(handle, IP_MULTICAST_LOOP,