clearer exceptions to help user fix the issue of localhost not getting mac address

This commit is contained in:
2022-02-09 11:30:34 +01:00
parent 75f98b27a3
commit bcca99e38c
3 changed files with 22 additions and 7 deletions

View File

@ -1021,6 +1021,10 @@ void Module::setDestinationUDPIP(const IpAddr ip) {
if (ip == 0) {
throw RuntimeError("Invalid destination udp ip address");
}
if (ip.str() == LOCALHOST_IP) {
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);
@ -1040,7 +1044,10 @@ void Module::setDestinationUDPIP2(const IpAddr ip) {
if (ip == 0) {
throw RuntimeError("Invalid destination udp ip address2");
}
if (ip.str() == LOCALHOST_IP) {
throw RuntimeError("Invalid destination udp ip. 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);
@ -3330,9 +3337,9 @@ sls_detector_module Module::interpolateTrim(sls_detector_module *a,
dacs_to_copy.end(),
{E_SVP, E_SVN, E_VTGSTV, E_RXB_RB, E_RXB_LB, E_VCN, E_VIS});
// interpolate vrf, vcmp, vcp
dacs_to_interpolate.insert(
dacs_to_interpolate.end(),
{E_VTR, E_VRF, E_VCMP_LL, E_VCMP_LR, E_VCMP_RL, E_VCMP_RR, E_VCP, E_VRS});
dacs_to_interpolate.insert(dacs_to_interpolate.end(),
{E_VTR, E_VRF, E_VCMP_LL, E_VCMP_LR,
E_VCMP_RL, E_VCMP_RR, E_VCP, E_VRS});
} else {
dacs_to_copy.insert(dacs_to_copy.end(),
{M_VCASSH, M_VRSHAPER, M_VRSHAPER_N, M_VIPRE_OUT,

View File

@ -1388,6 +1388,10 @@ int ClientInterface::set_read_n_rows(Interface &socket) {
}
sls::MacAddr ClientInterface::setUdpIp(sls::IpAddr arg) {
if (arg.str() == LOCALHOST_IP) {
throw RuntimeError("Invalid destination udp ip. Change rx_hostname "
"from localhost or change udp_dstip from auto?");
}
LOG(logINFO) << "Received UDP IP: " << arg;
// getting eth
std::string eth = sls::IpToInterfaceName(arg.str());
@ -1426,6 +1430,10 @@ int ClientInterface::set_udp_ip(Interface &socket) {
}
sls::MacAddr ClientInterface::setUdpIp2(sls::IpAddr arg) {
if (arg.str() == LOCALHOST_IP) {
throw RuntimeError("Invalid destination udp ip. Change rx_hostname "
"from localhost or change udp_dstip from auto?");
}
LOG(logINFO) << "Received UDP IP2: " << arg;
// getting eth
std::string eth = sls::IpToInterfaceName(arg.str());

View File

@ -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<int32_t>(b));
};
#endif
#ifdef __cplusplus