EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Binding an IOC to a single network interface
From: "J. Lewis Muir" <[email protected]>
To: Andrew Johnson <[email protected]>
Cc: [email protected]
Date: Tue, 7 Oct 2014 12:30:31 -0500
On 10/6/14 5:03 PM, J. Lewis Muir wrote:
> If a new environment variable such as EPICS_CA_REPEATER_INTF_ADDR_LIST
> were used, would you be open to that?

Below is an updated patch that now uses a new environment
variable: EPICS_CA_REPEATER_INTF_ADDR_LIST.  On my machine, setting
that variable to 127.0.0.1 makes caRepeater bind to that address on my
loopback interface as desired.

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_CA_REPEATER_INTF_ADDR_LIST );
+        if (pStr) {
+            /* this implementation only allows for specifying a single address in EPICS_CA_REPEATER_INTF_ADDR_LIST */
+            status = aToIPAddr ( pStr, port, &bd.ia );
+            if (status) {
+                fprintf( stderr, "CA Repeater: error parsing %s '%s'\n", EPICS_CA_REPEATER_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 );
--- src/libCom/env/envDefs.h.orig	2013-12-16 15:56:27.000000000 -0600
+++ src/libCom/env/envDefs.h	2014-10-07 09:52:14.000000000 -0500
@@ -45,6 +45,7 @@
 epicsShareExtern const ENV_PARAM EPICS_CA_ADDR_LIST;
 epicsShareExtern const ENV_PARAM EPICS_CA_CONN_TMO;
 epicsShareExtern const ENV_PARAM EPICS_CA_AUTO_ADDR_LIST;
+epicsShareExtern const ENV_PARAM EPICS_CA_REPEATER_INTF_ADDR_LIST;
 epicsShareExtern const ENV_PARAM EPICS_CA_REPEATER_PORT;
 epicsShareExtern const ENV_PARAM EPICS_CA_SERVER_PORT;
 epicsShareExtern const ENV_PARAM EPICS_CA_MAX_ARRAY_BYTES;

Replies:
Re: Binding an IOC to a single network interface J. Lewis Muir
References:
Binding an IOC to a single network interface freddie.akeroyd
Re: Binding an IOC to a single network interface J. Lewis Muir
Re: Binding an IOC to a single network interface Andrew Johnson
Re: Binding an IOC to a single network interface J. Lewis Muir

Navigate by Date:
Prev: RE: waveform record with Nexus Mark Rivers
Next: RE: waveform record with Nexus Juliano Ferreira Jorge Murari
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Binding an IOC to a single network interface J. Lewis Muir
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  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 17 Dec 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·