That's it... The reset is freeing the structure

void resetDevice(int devIdx) {
...
  if(myGlobals.device[devIdx].netflowGlobals != NULL)
    free(myGlobals.device[devIdx].netflowGlobals);
  myGlobals.device[devIdx].netflowGlobals = NULL;
...
  createDeviceIpProtosList(devIdx);
} 

And the netFlow main loop isn't testing the pointer.  So the 1st reference
after the reset bombs.




Since Luca rewrote the plugin for 3.1 I'm not sure what the right fix really
is.  It may be as simple as zeroing the counters instead of freeing the
structure, or maybe he wants to split it into freeable and permanent pieces
or just whatever...


I'm going to bounce this to him...



-----Burton


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of
Naman Latif
Sent: Friday, January 21, 2005 8:15 AM
To: [email protected]
Subject: RE: [Ntop] NTOP 3.1 dies on Reset_Stats - PRQ5CVD8B

Requested Info as
++++++++++++++++++++++++++++++++++++++++++++++++
Fri Jan 21 06:06:06 2005  Resetting stats on user request...
Fri Jan 21 06:06:06 2005  Resetting traffic statistics for device eth0 Fri
Jan 21 06:06:06 2005  Resetting traffic statistics for device sb-internet
Fri Jan 21 06:06:06 2005  User requested stats reset complete

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 131081 (LWP 22394)] 0x4177d6ba in netflowMainLoop
(_deviceId=0x1) at netflowPlugin.c:1153
1153
if(FD_ISSET(myGlobals.device[deviceId].netflowGlobals->netFlowInSo
cket, &netflowMask)){

(gdb) list
1148            maxSock =
myGlobals.device[deviceId].netflowGlobals->netFlowInSc
tpSocket;
1149        }
1150    #endif
1151
1152        if((rc = select(maxSock+1, &netflowMask, NULL, NULL, NULL))
> 0) {
1153
if(FD_ISSET(myGlobals.device[deviceId].netflowGlobals->netFlowInSo
cket, &netflowMask)){
1154            len = sizeof(fromHost);
1155            rc =
recvfrom(myGlobals.device[deviceId].netflowGlobals->netFlow
InSocket,(char*)&buffer, sizeof(buffer),
1156                          0,(struct sockaddr*)&fromHost, &len);
1157          }

(gdb) info stack
#0  0x4177d6ba in netflowMainLoop (_deviceId=0x1) at
netflowPlugin.c:1153
#1  0x41286c60 in pthread_start_thread () from /lib/libpthread.so.0
#2  0x41286cdf in pthread_start_thread_event () from /lib/libpthread.so.0

(gdb) print deviceId
No symbol "deviceId" in current context.
(gdb) print
The history is empty.
(gdb) print myGlobals.device[0x1].netflowGlobals
$1 = (NetFlowGlobals *) 0x0
(gdb) print myGlobals.device[1].netflowGlobals
$2 = (NetFlowGlobals *) 0x0
(gdb) print *myGlobals.device[0x1].netflowGlobals
Cannot access memory at address 0x0
(gdb)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++

\\ Naman
-----Original Message-----
From: Burton Strauss [mailto:[EMAIL PROTECTED]
Sent: Thursday, January 20, 2005 1:18 PM
To: [email protected]
Subject: RE: [Ntop] NTOP 3.1 dies on Reset_Stats - PRQ5CVD8B

Good... Well, at least that eliminates one class of problems.

These messages:

Jan 20 12:22:37 ravi ntop[6067]:   NETFLOW: createNetFlowDevice(2)
Jan 20 12:22:37 ravi ntop[6067]:   NETFLOW: createNetFlowDevice created
device 1

Pretty well ensure that the deviceId[] 1 was created.  If that worked
(static int createNetFlowDevice(int netFlowDeviceId) {} around line 2147),
then the allocation of memory worked and
myGlobals.device[deviceId].netflowGlobals should be valid.  And yet to get
the SIGSEGV, it's got to be bogus...

So... When it crashes, do this:

(gdb) print deviceId
(gdb) print myGlobals.device[deviceId].netflowGlobals
(gdb) print *myGlobals.device[deviceId].netflowGlobals

Thanks...

-----Burton
 

_______________________________________________
Ntop mailing list
[email protected]
http://listgateway.unipi.it/mailman/listinfo/ntop

_______________________________________________
Ntop mailing list
[email protected]
http://listgateway.unipi.it/mailman/listinfo/ntop

Reply via email to