diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | ext/socket/option.c | 17 |
2 files changed, 19 insertions, 4 deletions
@@ -1,3 +1,9 @@ +Tue Jan 21 00:39:15 2014 Tanaka Akira <akr@fsij.org> + + * 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. + Mon Jan 20 20:20:27 2014 Tanaka Akira <akr@fsij.org> * ext/socket/option.c: Use preprocessor macros to avoid repeated 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 |