diff --git a/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c index 7fba144aa..dc8e1ea28 100644 --- a/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c @@ -1675,7 +1675,7 @@ int setReadNRows(int value) { } if (isHardwareVersion2()) { LOG(logERROR, ("Could not set number of rows. Only available for " - "Hardware Board version 2.0.\n")); + "Hardware Board version 2.0.\n")); return FAIL; } @@ -2175,7 +2175,7 @@ int getFlipRows() { void setFlipRows(int arg) { if (isHardwareVersion2()) { LOG(logERROR, ("Could not set flip rows. Only available for " - "Hardware Board version 2.0.\n")); + "Hardware Board version 2.0.\n")); return; } if (arg >= 0) { diff --git a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c index 9450d01f5..80c7e003c 100644 --- a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c +++ b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c @@ -37,6 +37,8 @@ const enum detectorType myDetectorType = GOTTHARD2; const enum detectorType myDetectorType = GENERIC; #endif +#define LOCALHOSTIP_INT 2130706433 + // Global variables from communication_funcs extern int lockStatus; extern uint32_t lastClientIP; @@ -119,10 +121,11 @@ int printSocketReadError() { } void init_detector() { + memset(udpDetails, 0, sizeof(udpDetails)); #ifdef VIRTUAL LOG(logINFO, ("This is a VIRTUAL detector\n")); + udpDetails[0].srcip = LOCALHOSTIP_INT; #endif - memset(udpDetails, 0, sizeof(udpDetails)); udpDetails[0].srcport = DEFAULT_UDP_SRC_PORTNO; udpDetails[0].dstport = DEFAULT_UDP_DST_PORTNO; #ifdef EIGERD @@ -4855,12 +4858,14 @@ int is_udp_configured() { LOG(logWARNING, ("%s", configureMessage)); return FAIL; } +#ifndef VIRTUAL if (udpDetails[i].dstmac == 0) { sprintf(configureMessage, "udp destination mac not configured [entry:%d]\n", i); LOG(logWARNING, ("%s", configureMessage)); return FAIL; } +#endif #if defined(JUNGFRAUD) || defined(GOTTHARD2D) if (getNumberofUDPInterfaces() == 2) { if (udpDetails[i].srcip2 == 0) { @@ -4881,12 +4886,14 @@ int is_udp_configured() { LOG(logWARNING, ("%s", configureMessage)); return FAIL; } +#ifndef VIRTUAL if (udpDetails[i].dstmac2 == 0) { sprintf(configureMessage, "udp destination mac2 not configured [entry:%d]\n", i); LOG(logWARNING, ("%s", configureMessage)); return FAIL; } +#endif } #endif } diff --git a/slsDetectorSoftware/src/Module.cpp b/slsDetectorSoftware/src/Module.cpp index 517535279..e36f69c1c 100644 --- a/slsDetectorSoftware/src/Module.cpp +++ b/slsDetectorSoftware/src/Module.cpp @@ -1046,6 +1046,10 @@ void Module::setDestinationUDPIP(const IpAddr ip) { if (ip == 0) { throw RuntimeError("Invalid destination udp ip address"); } + if (ip.str() == LOCALHOST_IP && !isVirtualDetectorServer()) { + throw RuntimeError("Invalid destination udp ip. Change rx_hostname " + "from localhost or change udp_dstip from auto?"); + } sendToDetector(F_SET_DEST_UDP_IP, ip, nullptr); if (shm()->useReceiverFlag) { sls::MacAddr retval(0LU); @@ -1065,7 +1069,10 @@ void Module::setDestinationUDPIP2(const IpAddr ip) { if (ip == 0) { throw RuntimeError("Invalid destination udp ip address2"); } - + if (ip.str() == LOCALHOST_IP && !isVirtualDetectorServer()) { + throw RuntimeError("Invalid destination udp ip2. Change rx_hostname " + "from localhost or change udp_dstip from auto?"); + } sendToDetector(F_SET_DEST_UDP_IP2, ip, nullptr); if (shm()->useReceiverFlag) { sls::MacAddr retval(0LU); diff --git a/slsReceiverSoftware/src/ClientInterface.cpp b/slsReceiverSoftware/src/ClientInterface.cpp index 44677a8f6..9fa919359 100644 --- a/slsReceiverSoftware/src/ClientInterface.cpp +++ b/slsReceiverSoftware/src/ClientInterface.cpp @@ -1410,7 +1410,7 @@ sls::MacAddr ClientInterface::setUdpIp(sls::IpAddr arg) { // get mac address auto retval = sls::InterfaceNameToMac(eth); - if (retval == 0) { + if (retval == 0 && arg.str() != LOCALHOST_IP) { throw RuntimeError("Failed to get udp mac adddress to listen to (eth:" + eth + ", ip:" + arg.str() + ")\n"); } @@ -1445,7 +1445,7 @@ sls::MacAddr ClientInterface::setUdpIp2(sls::IpAddr arg) { // get mac address auto retval = sls::InterfaceNameToMac(eth); - if (retval == 0) { + if (retval == 0 && arg.str() != LOCALHOST_IP) { throw RuntimeError( "Failed to get udp mac adddress2 to listen to (eth:" + eth + ", ip:" + arg.str() + ")\n"); diff --git a/slsSupportLib/include/sls/sls_detector_defs.h b/slsSupportLib/include/sls/sls_detector_defs.h index 06203310f..b4ceced11 100644 --- a/slsSupportLib/include/sls/sls_detector_defs.h +++ b/slsSupportLib/include/sls/sls_detector_defs.h @@ -65,6 +65,8 @@ #define DEFAULT_DET_MAC2 "00:aa:bb:cc:dd:ff" #define DEFAULT_DET_IP2 "129.129.202.46" +#define LOCALHOST_IP "127.0.0.1" + /** default maximum string length */ #define MAX_STR_LENGTH 1000 #define SHORT_STR_LENGTH 20 @@ -564,7 +566,7 @@ enum streamingInterface { #ifdef __cplusplus }; -//operators needed in ToString +// operators needed in ToString inline slsDetectorDefs::streamingInterface operator|(const slsDetectorDefs::streamingInterface &a, const slsDetectorDefs::streamingInterface &b) { @@ -579,8 +581,6 @@ operator&(const slsDetectorDefs::streamingInterface &a, static_cast(b)); }; - - #endif #ifdef __cplusplus