EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024  Index 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: RTEMS: rsrv: failed to set mcast loopback in src/ioc/rsrv/caservertask.c
From: Michael Davidsaver <[email protected]>
To: Heinz Junkes <[email protected]>, [email protected]
Date: Thu, 20 Apr 2017 11:19:04 -0400
I see that linux (circa 3.16) will accept either 'int' or 'char' for
IP_MULTICAST_LOOP.  Also for most other integer flags.

I find references which suggest that winsock wants BOOL (which I assume
is 'char').

However, vxworks 5.5 clearly spec's 'int'.

http://www.vxdev.com/docs/vx55man/vxworks/ref/sockLib.html

Ah, a well standardized API...

Seems like the IP_MULTI* socket options need unit-test coverage.  (maybe
add to blockingSocketTest.cpp ?)



On 04/20/2017 07:42 AM, Heinz Junkes wrote:
> diff now in the right order, sorry;-)
> 
> === modified file 'src/ioc/rsrv/caservertask.c'
> --- src/ioc/rsrv/caservertask.c 2016-05-22 12:38:18 +0000
> +++ src/ioc/rsrv/caservertask.c 2017-04-20 11:21:40 +0000
> @@ -307,13 +307,17 @@
>          }
>  #ifdef IP_ADD_MEMBERSHIP
>          {
> +#if defined(__rtems__)
> +           char flag = 1;
> +#else
>              int flag = 1;
> +#endif
>              if (setsockopt(beaconSocket, IPPROTO_IP, IP_MULTICAST_LOOP,
>                             (char *)&flag, sizeof(flag))<0) {
>                  char sockErrBuf[64];
>                  epicsSocketConvertErrnoToString (
>                              sockErrBuf, sizeof ( sockErrBuf ) );
> -                errlogPrintf("rsrv: failed to set mcast loopback\n");
> +                errlogPrintf("rsrv: failed to set mcast loopback (%d:%s)\n", errno, sockErrBuf);
>              }
>          }
>  #endif
> 
> 
> 
> 
>> On 20 Apr 2017, at 13:27, Heinz Junkes <[email protected]> wrote:
>>
>> With RTEMS (4.11.99, aka 4.12) setting the IP_MULTICAST_LOOP for the loopback gives
>>
>> rsrv: failed to set mcast loopback
>>
>> Had to use sizeof char as argument for the IP_MULTICAST_LOOP setsockopt call.
>> Changed it to 
>>
>> …
>>        int intTrue = 1;
>>        if (setsockopt (beaconSocket, SOL_SOCKET, SO_BROADCAST,
>>                        (char *)&intTrue, sizeof(intTrue))<0) {
>>            cantProceed("CAS: online socket set up error\n");
>>        }
>> #ifdef IP_ADD_MEMBERSHIP
>>        {
>> #if defined(__rtems__)
>>            char flag = 1;
>> #else
>>            int flag = 1;
>> #endif
>>            if (setsockopt(beaconSocket, IPPROTO_IP, IP_MULTICAST_LOOP,
>>                           (char *)&flag, sizeof(flag))<0) {
>>                char sockErrBuf[64];
>>                epicsSocketConvertErrnoToString (
>>                            sockErrBuf, sizeof ( sockErrBuf ) );
>>                errlogPrintf("rsrv: failed to set mcast loopback (%d:%s)\n", errno, sockErrBuf);
>>            }
>>        }
>> #endif
>>    }
>>
>>    /* populate the interface address list (default is empty) */
>>    {
>> …
>>
>>
>>
>> rtems@epics:~/EPICS/add-rtems-4.12-api$ diff -Naur src/ioc/rsrv/caservertask.c /tmp/caservertask.c
>> --- src/ioc/rsrv/caservertask.c	2017-04-20 13:21:40.613544330 +0200
>> +++ /tmp/caservertask.c	2017-04-20 13:23:06.537549469 +0200
>> @@ -307,17 +307,13 @@
>>         }
>> #ifdef IP_ADD_MEMBERSHIP
>>         {
>> -#if defined(__rtems__)
>> -	    char flag = 1;
>> -#else
>>             int flag = 1;
>> -#endif
>>             if (setsockopt(beaconSocket, IPPROTO_IP, IP_MULTICAST_LOOP,
>>                            (char *)&flag, sizeof(flag))<0) {
>>                 char sockErrBuf[64];
>>                 epicsSocketConvertErrnoToString (
>>                             sockErrBuf, sizeof ( sockErrBuf ) );
>> -                errlogPrintf("rsrv: failed to set mcast loopback (%d:%s)\n", errno, sockErrBuf);
>> +                errlogPrintf("rsrv: failed to set mcast loopback\n");
>>             }
>>         }
>> #endif
>>
> 


Replies:
Re: RTEMS: rsrv: failed to set mcast loopback in src/ioc/rsrv/caservertask.c Andrew Johnson
References:
RTEMS: rsrv: failed to set mcast loopback in src/ioc/rsrv/caservertask.c Heinz Junkes
Re: RTEMS: rsrv: failed to set mcast loopback in src/ioc/rsrv/caservertask.c Heinz Junkes

Navigate by Date:
Prev: Re: RTEMS: rsrv: failed to set mcast loopback in src/ioc/rsrv/caservertask.c Heinz Junkes
Next: Re: RTEMS: rsrv: failed to set mcast loopback in src/ioc/rsrv/caservertask.c Andrew Johnson
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: RTEMS: rsrv: failed to set mcast loopback in src/ioc/rsrv/caservertask.c Heinz Junkes
Next: Re: RTEMS: rsrv: failed to set mcast loopback in src/ioc/rsrv/caservertask.c Andrew Johnson
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024 
ANJ, 21 Dec 2017 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·