Luca,

Here is the patch file.  Found disagreements between unsigned short and 
unsigned integers.   The unsigned short as a 65535 limit, thus where the 
sessions would not go beyond.

Synopsis of patches:

1. Created new function for processing unsigned integer preferences to 
eliminate complaints from compiler.
2. Updated ntopInterface struct to use unsigned integers instead of unsigned 
short
3. Updated function in report.c that defined numSessions as an integer, changed 
it to unsigned int.
4. Increased two buffer sizes due to logging output complaint.

--Brian


________________________________
From: [email protected] 
[[email protected]] on behalf of Luca Deri [[email protected]]
Sent: Tuesday, January 17, 2012 7:12 AM
To: [email protected]
Subject: Re: [Ntop-misc] Last svn patch.

Great!

Luca

On 01/17/2012 02:10 PM, Brian Behrens wrote:

Luca,



Thanks, I have found the issue.   I am correcting it now, working on a patch 
and will submit it to you, probably within the hour...



--Brian

________________________________
From: 
[email protected]<mailto:[email protected]>
 
[[email protected]<mailto:[email protected]>]
 on behalf of Luca Deri [[email protected]<mailto:[email protected]>]
Sent: Tuesday, January 17, 2012 7:04 AM
To: [email protected]<mailto:[email protected]>
Subject: Re: [Ntop-misc] Last svn patch.

Brian
thanks for the update. Please let me know if you need support from my side

Cheers Luca

On 01/17/2012 01:14 PM, Brian Behrens wrote:

Luca,



As of this morning, my one instance passed 65535 sessions, and ntop would not 
see more than that even though the command line is set.   I will try to look 
through and see why this is...



--Brian

________________________________
From: 
[email protected]<mailto:[email protected]>
 
[[email protected]<mailto:[email protected]>]
 on behalf of Luca Deri [[email protected]<mailto:[email protected]>]
Sent: Monday, January 16, 2012 7:22 AM
To: [email protected]<mailto:[email protected]>
Subject: Re: [Ntop-misc] Last svn patch.

Brian
I did that change because the compiler (it was right) was complaining. Is this 
causing side effects? If so let's address them: I didn't want to break your 
code at all

Luca

On Jan 16, 2012, at 2:09 PM, Brian Behrens wrote:

Luca,



I noticed you changed my u_int back to int in prefs.c.   I had to change this 
because I could not get the max sessions, max hash above 65535.  Did you find 
somewhere else that fixes this issue?



--Brian
_______________________________________________
Ntop-misc mailing list
[email protected]<mailto:[email protected]>
http://listgateway.unipi.it/mailman/listinfo/ntop-misc




_______________________________________________
Ntop-misc mailing list
[email protected]<mailto:[email protected]>
http://listgateway.unipi.it/mailman/listinfo/ntop-misc





_______________________________________________
Ntop-misc mailing list
[email protected]<mailto:[email protected]>
http://listgateway.unipi.it/mailman/listinfo/ntop-misc


diff -rupN ntop1/globals-core.h ntop/globals-core.h
--- ntop1/globals-core.h	2012-01-17 07:04:16.300415261 -0600
+++ ntop/globals-core.h	2012-01-17 06:52:23.813152198 -0600
@@ -489,6 +489,7 @@ extern void delPrefsValue(char *key);
 extern void delPwValue(char *key);
 extern void processStrPref(char *key, char *value, char **globalVar, bool savePref);
 extern void processIntPref(char *key, char *value, int *globalVar, bool savePref);
+extern void processUIntPref(char *key, char *value, u_int *globalVar, bool savePref);
 extern void processBoolPref(char *key, bool value, bool *globalVar, bool savePref);
 extern bool processNtopPref(char *key, char *value, bool savePref, UserPref *pref);
 extern void initUserPrefs(UserPref *pref);
diff -rupN ntop1/globals-structtypes.h ntop/globals-structtypes.h
--- ntop1/globals-structtypes.h	2012-01-17 07:04:16.243414777 -0600
+++ ntop/globals-structtypes.h	2012-01-17 06:51:14.188663062 -0600
@@ -1442,7 +1442,7 @@ typedef struct ntopInterface {
 
   IpFragment *fragmentList;
   IPSession **sessions;
-  u_short numSessions, maxNumSessions;
+  u_int numSessions, maxNumSessions;
 
   /* ************************** */
 
diff -rupN ntop1/prefs.c ntop/prefs.c
--- ntop1/prefs.c	2012-01-17 07:04:16.244414786 -0600
+++ ntop/prefs.c	2012-01-17 06:56:20.894779549 -0600
@@ -1041,6 +1041,22 @@ void processIntPref(char *key, char *val
 
 /* ******************************** */
 
+void processUIntPref(char *key, char *value, u_int *globalVar, bool savePref)
+{
+  char buf[512];
+
+  if((key == NULL) || (value == NULL)) return;
+
+  *globalVar = strtoul(value,NULL,0);
+
+  if(savePref) {
+    safe_snprintf(__FILE__, __LINE__, buf, sizeof(buf), "%d", *globalVar);
+    storePrefsValue(key, buf);
+  }
+}
+
+/* ******************************** */
+
 void processBoolPref(char *key, bool value, bool *globalVar, bool savePref)
 {
   char buf[512];
@@ -1219,16 +1235,16 @@ bool processNtopPref(char *key, char *va
 		     -1);
       value = buf;
     }
-    processIntPref(NTOP_PREF_MAXHASH, value,
-		   (int*)&pref->maxNumHashEntries, savePref);
+    processUIntPref(NTOP_PREF_MAXHASH, value,
+		   (u_int*)&pref->maxNumHashEntries, savePref);
   } else if(strcmp(key, NTOP_PREF_MAXSESSIONS) == 0) {
     if(value == NULL) {
       safe_snprintf (__FILE__, __LINE__, buf, sizeof(buf), "%d",
 		     -1);
       value = buf;
     }
-    processIntPref(NTOP_PREF_MAXSESSIONS, value,
-		   (int*)&pref->maxNumSessions, savePref);
+    processUIntPref(NTOP_PREF_MAXSESSIONS, value,
+		   (u_int*)&pref->maxNumSessions, savePref);
   } else if(strcmp(key, NTOP_PREF_MERGEIF) == 0) {
     processBoolPref(NTOP_PREF_MERGEIF, value2bool(value),
 		     &pref->mergeInterfaces, savePref);
diff -rupN ntop1/report.c ntop/report.c
--- ntop1/report.c	2012-01-17 07:04:16.301415270 -0600
+++ ntop/report.c	2012-01-17 06:53:43.366704218 -0600
@@ -3924,7 +3924,7 @@ void printActiveSessions(int actualDevic
 #ifdef PRINT_SESSION_DETAILS
   char flags_buf[64];
 #endif
-  int numSessions, printedSessions;
+  u_int numSessions, printedSessions;
   char formatBuf[64], formatBuf1[64], formatBuf2[64],
     formatBuf4[64], formatBuf5[64], formatBuf6[64], formatBuf7[64];
 
diff -rupN ntop1/sessions.c ntop/sessions.c
--- ntop1/sessions.c	2012-01-17 07:04:16.095413513 -0600
+++ ntop/sessions.c	2012-01-16 07:10:33.302167752 -0600
@@ -908,7 +908,7 @@ static void handleSCCPSession(const stru
     && (packetDataLength > 200)) {
       char *calling_party_name, *calling_party;
       char *called_party_name, *called_party;
-      char caller[1024], called[1024];
+      char caller[2048], called[2048];
 
       if((rcStr = (char*)malloc(packetDataLength+1)) == NULL) {
 	traceEvent(CONST_TRACE_WARNING, "handleSCCPSession: Unable to "
@@ -943,7 +943,7 @@ static void handleSCCPSession(const stru
 	safe_snprintf(__FILE__, __LINE__, called, sizeof(called), "%s", called_party);
 
       if(theSession->session_info == NULL) {
-	char tmpStr[1024];
+	char tmpStr[2048];
 
 	safe_snprintf(__FILE__, __LINE__, tmpStr, sizeof(tmpStr), "%s called %s", caller, called);
 	theSession->session_info = strdup(tmpStr);
_______________________________________________
Ntop-misc mailing list
[email protected]
http://listgateway.unipi.it/mailman/listinfo/ntop-misc

Reply via email to