summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-01-20 15:43:47 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-01-20 15:43:47 +0000
commit3682c6a32726db84ab933e427f8efda10a4b8844 (patch)
tree5d9e0adedc9786e33e4525a19d8bf1426812815a
parent3b8bcf42a7519110b30e596d2465d27c4629d7b2 (diff)
* 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
-rw-r--r--ChangeLog6
-rw-r--r--ext/socket/option.c17
2 files changed, 19 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index d38a554f86..e6275c2dfe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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