allowing localhost for virtual server

This commit is contained in:
maliakal_d 2022-02-14 10:25:34 +01:00
parent fa929b138e
commit 83a65f85ab
2 changed files with 5 additions and 13 deletions

View File

@ -1046,7 +1046,7 @@ void Module::setDestinationUDPIP(const IpAddr ip) {
if (ip == 0) {
throw RuntimeError("Invalid destination udp ip address");
}
if (ip.str() == LOCALHOST_IP) {
if (ip.str() == LOCALHOST_IP && !isVirtualDetectorServer()) {
throw RuntimeError("Invalid destination udp ip. Change rx_hostname "
"from localhost or change udp_dstip from auto?");
}
@ -1069,8 +1069,8 @@ 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 "
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);

View File

@ -1388,10 +1388,6 @@ 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());
@ -1414,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");
}
@ -1430,10 +1426,6 @@ 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());
@ -1453,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");