Skip to content
This repository has been archived by the owner on Jan 30, 2021. It is now read-only.

Commit

Permalink
If you ran ntop with -S and -M and then ran ntop with only -S,
Browse files Browse the repository at this point in the history
it was possible for the persistent value of actualReportDeviceId
to specify a value > 0 and so the reporting would be pointed
at a device[] entry that was not being populated with data.

This forces actualReportDeviceId to zero if we're merging interfaces.

Similarly, if you have a stored actualReportDeviceId greater than the
actual number of devices (say you ran ntop with -i a,b,c and switched
reporting to c, then reran with only -i a,b), the value could be out
of range.

That case was already fixed, but this patch adds a note to the log:

Note: stored actualReportDeviceId(%d) > numDevices(#). Probably leftover, reset.

-----Burton (ref 141)
  • Loading branch information
burton committed Oct 16, 2002
1 parent 0a31d00 commit 7777544
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions webInterface.c
Original file line number Diff line number Diff line change
Expand Up @@ -2902,13 +2902,22 @@ void printNtopConfigInfo(int textPrintFlag) {
initReports();
initializeWeb();

if(fetchPrefsValue("actualReportDeviceId", value, sizeof(value)) == -1) {
if(myGlobals.mergeInterfaces) {
storePrefsValue("actualReportDeviceId", "0");
myGlobals.actualReportDeviceId = 0;
} else if(fetchPrefsValue("actualReportDeviceId", value, sizeof(value)) == -1) {
storePrefsValue("actualReportDeviceId", "0");
myGlobals.actualReportDeviceId = 0;
} else {
myGlobals.actualReportDeviceId = atoi(value);
if(myGlobals.actualReportDeviceId > myGlobals.numDevices)
myGlobals.actualReportDeviceId = 0; /* Default */
if(myGlobals.actualReportDeviceId > myGlobals.numDevices) {
traceEvent(TRACE_INFO, "Note: stored actualReportDeviceId(%d) > numDevices(%d). "
"Probably leftover, reset.\n",
myGlobals.actualReportDeviceId,
myGlobals.numDevices);
storePrefsValue("actualReportDeviceId", "0");
myGlobals.actualReportDeviceId = 0; /* Default */
}
}

if(myGlobals.webPort > 0) {
Expand Down

0 comments on commit 7777544

Please sign in to comment.