Skip to content

Commit

Permalink
Added better error message when adding networks
Browse files Browse the repository at this point in the history
In case of failure when adding a networ, the add process continue
  • Loading branch information
lucaderi committed May 16, 2024
1 parent 1e51775 commit 7fd4cb3
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Ntop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3579,8 +3579,7 @@ bool Ntop::addLocalNetwork(char *_net) {
int i, pos = 0;

if (id >= CONST_MAX_NUM_NETWORKS) {
ntop->getTrace()->traceEvent(
TRACE_ERROR, "Too many networks defined (%d): ignored %s", id, _net);
ntop->getTrace()->traceEvent(TRACE_ERROR, "Too many networks defined (%d): ignored %s", id, _net);
return (false);
}

Expand Down Expand Up @@ -3656,7 +3655,11 @@ void Ntop::addLocalNetworkList(const char *rule) {
char *tmp, *net = strtok_r((char *)rule, ",", &tmp);

while (net != NULL) {
if (!addLocalNetwork(net)) return;
if (!addLocalNetwork(net))
ntop->getTrace()->traceEvent(TRACE_WARNING, "Unable to parse network %s or already defined: skipping it", net);
else
ntop->getTrace()->traceEvent(TRACE_INFO, "Added network %s", net);

net = strtok_r(NULL, ",", &tmp);
}
}
Expand Down

0 comments on commit 7fd4cb3

Please sign in to comment.