On 1/22/14 8:30 AM, [email protected] wrote:
> Hi,
>
> we are looking to run a set of IOCs that bind channel access to just
> the loopback interface on the computer; however I saw from the 3.14
> docs that EPICS_CAS_INTF_ADDR_LIST is not currently implemented in the
> iocCore CA Server. I had a look at the code in base/src/rsrv and the
> attached diff (against 3.14.12.2) seems to work for us with:
>
> EPICS_CAS_INTF_ADDR_LIST=127.0.0.1
> EPICS_CAS_BEACON_ADDR_LIST=127.255.255.255
Below is an adaptation of the patch for caRepeater to let it play too.
I'm unclear on whether caRepeater is considered part of CAS. It
gets started by the IOC automatically if it's not already running,
so I considered it part of CAS. Hence, it uses the same environment
variable. But if it's not considered part of CAS, then I guess it
should get its own environment variable.
Andrew, I don't think you've committed Freddie's patch to the 3.15 tree,
so I'm just posting this additional patch in the hope that it could go
in with Freddie's patch when you get around to it.
Thanks!
Lewis
--- src/ca/repeater.cpp.orig 2013-12-16 15:56:27.000000000 -0600
+++ src/ca/repeater.cpp 2014-10-03 17:12:12.000000000 -0500
@@ -115,6 +115,7 @@
struct sockaddr_in ia;
struct sockaddr sa;
} bd;
+ const char* pStr;
SOCKET sock = epicsSocketCreate ( AF_INET, SOCK_DGRAM, 0 );
if ( sock == INVALID_SOCKET ) {
@@ -128,8 +129,19 @@
memset ( (char *) &bd, 0, sizeof (bd) );
bd.ia.sin_family = AF_INET;
- bd.ia.sin_addr.s_addr = htonl ( INADDR_ANY );
- bd.ia.sin_port = htons ( port );
+ pStr = envGetConfigParamPtr ( & EPICS_CAS_INTF_ADDR_LIST );
+ if (pStr) {
+ /* this implementation only allows for specifying a single address in EPICS_CAS_INTF_ADDR_LIST */
+ status = aToIPAddr ( pStr, port, &bd.ia );
+ if (status) {
+ fprintf( stderr, "CA Repeater: error parsing %s '%s'\n", EPICS_CAS_INTF_ADDR_LIST.name, pStr );
+ bd.ia.sin_addr.s_addr = htonl ( INADDR_ANY );
+ bd.ia.sin_port = htons ( port );
+ }
+ } else {
+ bd.ia.sin_addr.s_addr = htonl ( INADDR_ANY );
+ bd.ia.sin_port = htons ( port );
+ }
status = bind ( sock, &bd.sa, (int) sizeof(bd) );
if ( status < 0 ) {
epicsSocketDestroy ( sock );
- Replies:
- Re: Binding an IOC to a single network interface Andrew Johnson
- References:
- Binding an IOC to a single network interface freddie.akeroyd
- Navigate by Date:
- Prev:
Epics Qt at APS: Formal presentation + discussion Emmanuel Mayssat
- Next:
Re: Binding an IOC to a single network interface Andrew Johnson
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
<2014>
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Re: Binding an IOC to a single network interface Andrew Johnson
- Next:
Re: Binding an IOC to a single network interface Andrew Johnson
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
<2014>
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|