Greetings, I've been trying to make a few modifications to the ntop
source and started to get mysterious floating point exceptions in
areas unrelated to my additions. Some debugging in gdb led me to some
odd initializations of myGlobals.device[id].packetQueue. (or maybe
not so odd, but I'm not a very experienced coder). The following
modifications seemed to clear things up...
--- initialize.c 2008-08-05 10:07:44.000000000 -0400
+++ initialize.c.new 2008-08-05 17:16:55.000000000 -0400
@@ -887,5 +887,5 @@
createMutex(&myGlobals.device[deviceId].packetProcessMutex);
createMutex(&myGlobals.device[deviceId].packetQueueMutex);
- memset(&myGlobals.device[deviceId].packetQueue, 0,
sizeof(PacketInformation));
+ memset(myGlobals.device[deviceId].packetQueue, 0, sizeof(PacketInformation));
myGlobals.device[deviceId].packetQueueLen = 0;
myGlobals.device[deviceId].maxPacketQueueLen = 0;
@@ -901,9 +901,9 @@
if(!myGlobals.device[deviceId].ipPorts)
myGlobals.device[deviceId].ipPorts =
- (PortCounter**)calloc(sizeof(PortCounter*), MAX_IP_PORT);
+ (PortCounter**)calloc(MAX_IP_PORT, sizeof(PortCounter*));
if(!myGlobals.device[deviceId].packetQueue)
myGlobals.device[deviceId].packetQueue =
- (PacketInformation*)calloc(sizeof(PacketInformation),
(CONST_PACKET_QUEUE_LENGTH+1));
+ (PacketInformation*)calloc((CONST_PACKET_QUEUE_LENGTH+1),
sizeof(PacketInformation));
}
Does the patch seem reasonable?
--
:wq!
_______________________________________________
Ntop-dev mailing list
[email protected]
http://listgateway.unipi.it/mailman/listinfo/ntop-dev