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
I was just wondering if these additions are sufficient, or have I missed something elsewhere that either needs changing too or might cause issues later on?
Thanks,
Freddie
--
Scanned by iCritical.
Index: src/rsrv/cast_server.c
===================================================================
--- src/rsrv/cast_server.c (revision 774)
+++ src/rsrv/cast_server.c (working copy)
@@ -122,6 +122,7 @@
osiSocklen_t recv_addr_size;
unsigned short port;
osiSockIoctl_t nchars;
+ const char* pStr;
if ( envGetConfigParamPtr ( &EPICS_CAS_SERVER_PORT ) ) {
port = envGetInetPortConfigParam ( &EPICS_CAS_SERVER_PORT,
@@ -178,8 +179,19 @@
/* Zero the sock_addr structure */
memset((char *)&sin, 0, sizeof(sin));
sin.sin_family = AF_INET;
- sin.sin_addr.s_addr = htonl(INADDR_ANY);
- sin.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, &sin);
+ if (status) {
+ epicsPrintf("CAS: Error parsing %s '%s'\n", EPICS_CAS_INTF_ADDR_LIST.name, pStr);
+ sin.sin_addr.s_addr = htonl(INADDR_ANY);
+ sin.sin_port = htons(port);
+ }
+ } else {
+ sin.sin_addr.s_addr = htonl(INADDR_ANY);
+ sin.sin_port = htons(port);
+ }
/* get server's Internet address */
if( bind(IOC_cast_sock, (struct sockaddr *)&sin, sizeof (sin)) < 0){
Index: src/rsrv/caservertask.c
===================================================================
--- src/rsrv/caservertask.c (revision 774)
+++ src/rsrv/caservertask.c (working copy)
@@ -69,7 +69,7 @@
SOCKET clientSock;
epicsThreadId tid;
int portChange;
-
+ const char* pStr;
epicsSignalInstallSigPipeIgnore ();
taskwdInsert ( epicsThreadGetIdSelf (), NULL, NULL );
@@ -103,8 +103,19 @@
/* Zero the sock_addr structure */
memset ( (void *) &serverAddr, 0, sizeof ( serverAddr ) );
serverAddr.sin_family = AF_INET;
- serverAddr.sin_addr.s_addr = htonl (INADDR_ANY);
- serverAddr.sin_port = htons ( ca_server_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, ca_server_port, &serverAddr);
+ if (status) {
+ epicsPrintf("CAS: Error parsing %s '%s'\n", EPICS_CAS_INTF_ADDR_LIST.name, pStr);
+ serverAddr.sin_addr.s_addr = htonl(INADDR_ANY);
+ serverAddr.sin_port = htons(ca_server_port);
+ }
+ } else {
+ serverAddr.sin_addr.s_addr = htonl(INADDR_ANY);
+ serverAddr.sin_port = htons(ca_server_port);
+ }
/* get server's Internet address */
status = bind ( IOC_sock, (struct sockaddr *) &serverAddr, sizeof ( serverAddr ) );
- Replies:
- Re: Binding an IOC to a single network interface J. Lewis Muir
- Re: Binding an IOC to a single network interface J. Lewis Muir
- Navigate by Date:
- Prev:
Socomec Diris Modbus support? keith.baker
- Next:
EPICS Collaboration Meeting 5/19 - 5/23 Institute of Modern Physics in Lanzhou, China Dalesio, Leo
- 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:
Socomec Diris Modbus support? keith.baker
- Next:
Re: Binding an IOC to a single network interface J. Lewis Muir
- 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
|