From 3682c6a32726db84ab933e427f8efda10a4b8844 Mon Sep 17 00:00:00 2001 From: akr Date: Mon, 20 Jan 2014 15:43:47 +0000 Subject: * ext/socket/option.c: Use "byte" as default argument for IP_MULTICAST_LOOP and IP_MULTICAST_TTL socket option to follow the original multicast implementation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44664 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/socket/option.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'ext/socket') diff --git a/ext/socket/option.c b/ext/socket/option.c index a4c3ffc4f2..957465ec02 100644 --- a/ext/socket/option.c +++ b/ext/socket/option.c @@ -7,13 +7,13 @@ VALUE rb_cSockOpt; #define CAT(x,y) x##y #define XCAT(x,y) CAT(x,y) -#if defined(__NetBSD__) || defined(__OpenBSD__) +#if defined(__linux__) || defined(__FreeBSD__) +# define TYPE_IP_MULTICAST_LOOP int +# define TYPE_IP_MULTICAST_TTL int +#else # define TYPE_IP_MULTICAST_LOOP byte # define TYPE_IP_MULTICAST_TTL byte # define USE_INSPECT_BYTE 1 -#else -# define TYPE_IP_MULTICAST_LOOP int -# define TYPE_IP_MULTICAST_TTL int #endif static VALUE @@ -590,6 +590,15 @@ inspect_timeval_as_interval(int level, int optname, VALUE data, VALUE ret) * (MULTICAST 1.2 Release) * http://www.kohala.com/start/mcast.api.txt * + * There are 2 socket options which takes a u_char (unsigned char). + * + * IP_MULTICAST_TTL + * IP_MULTICAST_LOOP + * + * However Linux and FreeBSD setsockname accepts int argument + * as well as u_char. + * Thier getsockname returns int. + * * There are 3 socket options which takes a struct. * * IP_MULTICAST_IF: struct in_addr -- cgit v1.2.3