[Spread-users] spread-5.0.0rc1 : Solaris setsockopt issue

Martin Schu martin.sc11111 at gmail.com
Wed Dec 14 06:04:52 EST 2016


John,

attached is our patch for spread-src-5.0.0rc1/libspread-util/src/data_link.c
to avoid setsockopt failing at runtime at Solaris.

This code is running well now on both Solaris and Linux. We use the same
parameter style for setsockopt as you did it in the older
spread-src-4.4.0/.../data_link.c. Concerning Solaris the setsockopt value
parameter must be unsigned char or int depending on the kind of option to
be set. We don't like and understand this, but apparently it is necessary
at Solaris. On the other hand the new code is running well at both Solaris
and Linux. So there is no need to make it OS dependent.

We would be glad if you could include that patch in your upcoming release.

Kind regards,
Martin

*** libspread-util/src/data_link.c.orig    2016-11-22 21:07:12.000000000
+0100
--- libspread-util/src/data_link.c    2016-12-13 09:32:34.707739959 +0100
***************
*** 167 ****
!  * TODO: check on sizeof setsockopt types across platforms (i.e. - Sun:
char vs. int)
--- 167 ----
!  * DONE: check on sizeof setsockopt types across platforms (i.e. - Sun:
char vs. int)
***************
*** 174 ****
--- 175,176 ----
+   int           on =1, off =0;
+   unsigned char one=1, zero=0;
***************
*** 176 ****
!   Alarmp(SPLOG_INFO, DATA_LINK, "DL_init_channel_gen: creating a
SOCK_DGRAM socket of family %d\n", family);
--- 178 ----
!   Alarmp(SPLOG_INFO, DATA_LINK, "DL_init_channel_gen: 5.0.0-rc1-p1
creating a SOCK_DGRAM socket of family %d\n", family);
***************
*** 200 ****
!       if (setsockopt(chan, SOL_SOCKET, SO_BROADCAST, (tmp = 1, &tmp),
sizeof(tmp)))
--- 202 ----
!       if (setsockopt(chan, SOL_SOCKET, SO_BROADCAST, (char *)&on,
sizeof(on)))
***************
*** 205 ****
!       if (setsockopt(chan, IPPROTO_IP, IP_MULTICAST_TTL, (tmp = 1, &tmp),
sizeof(tmp)))
--- 207 ----
!       if (setsockopt(chan, IPPROTO_IP, IP_MULTICAST_TTL, (void *)&one,
sizeof(one)))
***************
*** 213 ****
!         if (setsockopt(chan, IPPROTO_IP, IP_MULTICAST_LOOP, (tmp = 0,
&tmp), sizeof(tmp)))
--- 215 ----
!         if (setsockopt(chan, IPPROTO_IP, IP_MULTICAST_LOOP, (void
*)&zero, sizeof(zero)))
***************
*** 221 ****
!       if (setsockopt(chan, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, (tmp = 1,
&tmp), sizeof(tmp)))
--- 223 ----
!       if (setsockopt(chan, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, (void
*)&one, sizeof(one)))
***************
*** 229 ****
!         if (setsockopt(chan, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, (tmp = 0,
&tmp), sizeof(tmp)))
--- 231 ----
!         if (setsockopt(chan, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, (void
*)&zero, sizeof(zero)))
***************
*** 243 ****
!       if (setsockopt(chan, SOL_SOCKET, SO_BROADCAST, (tmp = 1, &tmp),
sizeof(tmp)))
--- 245 ----
!       if (setsockopt(chan, SOL_SOCKET, SO_BROADCAST, (char *)&on,
sizeof(on)))
***************
*** 254 ****
!       if (setsockopt(chan, SOL_SOCKET, SO_REUSEADDR, (tmp = 1, &tmp),
sizeof(tmp)))
--- 256 ----
!       if (setsockopt(chan, SOL_SOCKET, SO_REUSEADDR, (char *)&on,
sizeof(on)))





On Thu, Dec 8, 2016 at 3:13 PM, John Lane Schultz <
jschultz at spreadconcepts.com> wrote:

> Martin,
>
> Yes, I am vaguely aware that SunOS expects different sized parameters for
> options to setsockopt than other platforms but I have no SunOS instance
> with which to test readily available.
>
> My hope was that SunOS would have changed to allow larger than expected
> parameters (e.g. - int) so that the same code was more cross platform.
>
> If you could take a crack at modifying and testing that bit of code and
> post the diff here, then I’d appreciate it.  Otherwise, I will try my best
> (without testing) for the next release candidate.
>
> Cheers!
>
> -----
> John Lane Schultz
> Spread Concepts LLC
> Cell: 443 838 2200
>
> On Dec 8, 2016, at 8:10 AM, Martin Schu <martin.sc11111 at gmail.com> wrote:
>
> Hi John,
>
> we are very glad to see the new version, 5.0.0 RC1, of The Spread Toolkit.
> Apparently you've not only added IPv6 support but did further polishing,
> e.g. improved logging and error handling.
>
> We've tested 5.0.0rc1 in our environment and observed some problems.
>
> In our Sun/Oracle/Solaris environment spread 5.0.0rc1 fails during startup
> saying:
> "DL_init_channel_gen: problem (22: Invalid argument) in setsockopt of
> multicast ttl = 1; ignore on Windows"
>
> In spread-src-5.0.0rc1:libspread-util/src/data_link.c you made some
> comment:
>
> " * TODO: check on sizeof setsockopt types across platforms (i.e. - Sun:
> char vs. int)"
>
> This leads to my assumption that you are aware of that issue, aren't you?
> Are you planning to fix it?
>
> Kind regards,
>
> Martin
>
> Set Alarm mask to: ffffffff
> 2016-12-06 14:42:29 GMT Disabling Dangerous Monitor Commands!
> 2016-12-06 14:42:29 GMT Setting SO_REUSEADDR to auto
> 2016-12-06 14:42:29 GMT Hash value for this configuration is: 3310648069
> 2016-12-06 14:42:29 GMT Finished configuration file.
> 2016-12-06 14:42:29 GMT Conf_load_conf_file: using sin6_scope_id 0 for
> interface 172.16.0.171
> 2016-12-06 14:42:29 GMT Conf_load_conf_file: My name: easy-serv-02b, id:
> 176040470, addr: 172.16.0.171, port: 7982
> 2016-12-06 14:42:29 GMT E_init: went ok
> 2016-12-06 14:42:29 GMT new: creating pointer 0x39f7b0 to object type 2
> named pack_head
> 2016-12-06 14:42:29 GMT new: creating pointer 0x385a10 to object type 50
> named packet_body
> 2016-12-06 14:42:29 GMT new: creating pointer 0x39f800 to object type 8
> named token_head
> 2016-12-06 14:42:29 GMT new: creating pointer 0x3a1fb0 to object type 9
> named token_body
> 2016-12-06 14:42:29 GMT new: creating pointer 0x39f850 to object type 8
> named token_head
> 2016-12-06 14:42:29 GMT new: creating pointer 0x385fd0 to object type 50
> named packet_body
> 2016-12-06 14:42:29 GMT Net_signal_conf_reload: Bcast is not needed
> 2016-12-06 14:42:29 GMT Net_init: implicit: binding bcast recv channel to
> [0.0.0.0]:7982
> 2016-12-06 14:42:29 GMT DL_init_channel_gen: creating a SOCK_DGRAM socket
> of family 2
> 2016-12-06 14:42:29 GMT DL_init_channel_gen: turning SO_BROADCAST on for
> recv IPv4 channel
> 2016-12-06 14:42:29 GMT DL_init_channel_gen: binding recv channel to
> [0.0.0.0]:7982
> 2016-12-06 14:42:29 GMT DL_init_channel_gen: success; chan = 4
> 2016-12-06 14:42:29 GMT Net_init: implicit: binding token recv channel to
> [0.0.0.0]:7983
> 2016-12-06 14:42:29 GMT DL_init_channel_gen: creating a SOCK_DGRAM socket
> of family 2
> 2016-12-06 14:42:29 GMT DL_init_channel_gen: turning SO_BROADCAST on for
> recv IPv4 channel
> 2016-12-06 14:42:29 GMT DL_init_channel_gen: binding recv channel to
> [0.0.0.0]:7983
> 2016-12-06 14:42:29 GMT DL_init_channel_gen: success; chan = 5
> 2016-12-06 14:42:29 GMT Net_init: creating send channel bound to
> 172.16.0.171
> 2016-12-06 14:42:29 GMT DL_init_channel_gen: creating a SOCK_DGRAM socket
> of family 2
> 2016-12-06 14:42:29 GMT DL_init_channel_gen: turning SO_BROADCAST on for
> send IPv4 channel
> 2016-12-06 14:42:29 GMT DL_init_channel_gen: setting IPv4 multicast TTL to
> 1 for send channel
> 2016-12-06 14:42:29 GMT DL_init_channel_gen: problem (22: Invalid
> argument) in setsockopt of multicast ttl = 1; ignore on Windows
> Exit caused by Alarm!
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spread.org/pipermail/spread-users/attachments/20161214/c2453106/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: spread-setsockopt.patch
Type: application/octet-stream
Size: 2295 bytes
Desc: not available
URL: <http://lists.spread.org/pipermail/spread-users/attachments/20161214/c2453106/attachment.obj>


More information about the Spread-users mailing list