That code should be pretty simple - it's a JIT allocator of the structure:
void updateInterfacePorts(int actualDeviceId, u_short sport, u_short dport,
u_int length) {
if((sport >= MAX_IP_PORT) || (dport >= MAX_IP_PORT))
return;
#ifdef CFG_MULTITHREADED
accessMutex(&myGlobals.gdbmMutex, "updateInterfacePorts");
#endif
if(myGlobals.device[actualDeviceId].ipPorts[sport] == NULL) {
myGlobals.device[actualDeviceId].ipPorts[sport] =
(PortCounter*)malloc(sizeof(PortCounter));
myGlobals.device[actualDeviceId].ipPorts[sport]->port = sport;
myGlobals.device[actualDeviceId].ipPorts[sport]->sent = 0;
myGlobals.device[actualDeviceId].ipPorts[sport]->rcvd = 0;
}
if(myGlobals.device[actualDeviceId].ipPorts[dport] == NULL) {
myGlobals.device[actualDeviceId].ipPorts[dport] =
(PortCounter*)malloc(sizeof(PortCounter));
myGlobals.device[actualDeviceId].ipPorts[dport]->port = dport;
myGlobals.device[actualDeviceId].ipPorts[dport]->sent = 0;
myGlobals.device[actualDeviceId].ipPorts[dport]->rcvd = 0;
}
myGlobals.device[actualDeviceId].ipPorts[sport]->sent += length;
myGlobals.device[actualDeviceId].ipPorts[dport]->rcvd += length;
#ifdef CFG_MULTITHREADED
releaseMutex(&myGlobals.gdbmMutex);
#endif
}
Unless, are you running out of memory? Check and see if there's a log
message?
It's not a lot of bytes being allocated:
typedef unsigned long long Counter;
typedef struct portCounter {
u_short port;
Counter sent, rcvd;
} PortCounter;
Still, you could try adding a message... in the current CVS, it would be
something like this:
void updateInterfacePorts(int actualDeviceId, u_short sport, u_short dport,
u_int length) {
if((sport >= MAX_IP_PORT) || (dport >= MAX_IP_PORT))
return;
#ifdef CFG_MULTITHREADED
accessMutex(&myGlobals.gdbmMutex, "updateInterfacePorts");
#endif
if(myGlobals.device[actualDeviceId].ipPorts[sport] == NULL) {
myGlobals.device[actualDeviceId].ipPorts[sport] =
(PortCounter*)malloc(sizeof(PortCounter));
if (myGlobals.device[actualDeviceId].ipPorts[sport] == NULL) {
traceEvent(CONST_TRACE_ERROR, "Unable to allocate memory for
tracking port %d for device %d", sport, actualDeviceId);
traceEvent(CONST_TRACE_INFO, "ntop continues without tracking
this... you should restart before something more serious goes wrong");
}
myGlobals.device[actualDeviceId].ipPorts[sport]->port = sport;
myGlobals.device[actualDeviceId].ipPorts[sport]->sent = 0;
myGlobals.device[actualDeviceId].ipPorts[sport]->rcvd = 0;
}
if(myGlobals.device[actualDeviceId].ipPorts[dport] == NULL) {
myGlobals.device[actualDeviceId].ipPorts[dport] =
(PortCounter*)malloc(sizeof(PortCounter));
if (myGlobals.device[actualDeviceId].ipPorts[sport] == NULL) {
traceEvent(CONST_TRACE_ERROR, "Unable to allocate memory for
tracking port %d for device %d", dport, actualDeviceId);
traceEvent(CONST_TRACE_INFO, "ntop continues without tracking
this... you should restart before something more serious goes wrong");
}
myGlobals.device[actualDeviceId].ipPorts[dport]->port = dport;
myGlobals.device[actualDeviceId].ipPorts[dport]->sent = 0;
myGlobals.device[actualDeviceId].ipPorts[dport]->rcvd = 0;
}
myGlobals.device[actualDeviceId].ipPorts[sport]->sent += length;
myGlobals.device[actualDeviceId].ipPorts[dport]->rcvd += length;
#ifdef CFG_MULTITHREADED
releaseMutex(&myGlobals.gdbmMutex);
#endif
}
-----Burton
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of wangzm
Sent: Thursday, March 27, 2003 10:00 PM
To: [EMAIL PROTECTED]
Subject: [Ntop] ntop crash
hi,dear sir:
Now,I run ntop-2.1.58 for redhat8.0,that run every half hours,then
crash(segment fault),so I read FAQ,use gdb to check this,that is 'bt full'
output:
#0 0x40106e07 in updateInterfacePorts (actualDeviceId=0, sport=4540,
dport=1135, length=117) at pbuf.c:595
No locals.
#1 0x40108d52 in processIpPkt (bp=0x80632a8 "E", h=0xbefff9ec, length=117,
ether_src=0xbefff9a2 "",
ether_dst=0xbefff99c "", actualDeviceId=0, vlanId=-1) at pbuf.c:992
sport = 2002
dport = 1135
ip = {ip_hl = 5, ip_v = 4, ip_tos = 0 '\0', ip_len = 26368, ip_id =
56602, ip_off = 64,
ip_ttl = 128 '\200', ip_p = 6 '\006', ip_sum = 8216, ip_src = {s_addr =
3549432094}, ip_dst = {
s_addr = 1034988853}}
tp = {th_sport = 53767, th_dport = 28420, th_seq = 3616536699,
th_ack = 396808448, th_x2 = 0 '\0',
th_off = 5 '\005', th_flags = 24 '\030', th_win = 16417, th_sum = 63621,
th_urp = 0}
up = {uh_sport = 35072, uh_dport = 35072, uh_ulen = 14848, uh_sum =
18730}
icmpPkt = {icmp_type = 0 '\0', icmp_code = 0 '\0', icmp_cksum = 0,
icmp_hun = {ih_pptr = 0 '\0',
ih_gwaddr = {s_addr = 0}, ih_idseq = {icd_id = 0, icd_seq = 0}, ih_void
= 0, ih_pmtu = {ipm_void = 0,
ipm_nextmtu = 0}, ih_rtradv = {irt_num_addrs = 0 '\0', irt_wpa = 0
'\0', irt_lifetime = 0}},
icmp_dun = {id_ts = {its_otime = 0, its_rtime = 1077657462, its_ttime =
370148982}, id_ip = {idi_ip = {
ip_hl = 0, ip_v = 0, ip_tos = 0 '\0', ip_len = 0, ip_id = 49014,
ip_off = 16443, ip_ttl = 118 'v',
ip_p = 6 '\006', ip_sum = 5648, ip_src = {s_addr = 252285139},
ip_dst = {s_addr = 2198959632}}},
id_radv = {ira_addr = 0, ira_preference = 1077657462}, id_mask = 0,
id_data = ""}}
hlen = 20
tcpDataLength = 63
udpDataLength = 50
off = 16384
tcpUdpLen = 83
srcHostIdx = 3
dstHostIdx = 1
srcHost = (struct hostTraffic *) 0x835efe8
dstHost = (struct hostTraffic *) 0x80d94f8
forceUsingIPaddress = 0 '\0'
tvstrct = {tv_sec = 0, tv_usec = 0}
theData = (u_char *) 0x80632d0 ";\003"
ctr = {value = 117, modified = 132 '\204'}
#2 0x4010b8cb in processPacket (_deviceId=0x0, h=0xbefff9ec, p=0x806329a
"") at pbuf.c:2463
pppoe_hdr = (struct pppoe_hdr *) 0x75
---Type <return> to continue, or q <return> to quit---
protocol = 0
ehdr = {ether_dhost = "\0\003?O?, ether_shost = "\0蟹?V",
ether_type = 8}
trp = (struct tokenRing_header *) 0x0
fddip = (struct fddi_header *) 0x401390a0
hlen = 14
caplen = 68
headerDisplacement = 0
length = 117
orig_p = (const u_char *) 0x806329a ""
p1 = (const u_char *) 0x0
ether_src = (u_char *) 0xbefff9a2 ""
ether_dst = (u_char *) 0xbefff99c ""
eth_type = 2048
trllc = (struct tokenRing_llc *) 0x75
fd = (struct _IO_FILE *) 0x0
ipxBuffer = "@\206\001@@[EMAIL PROTECTED]@[EMAIL PROTECTED]@牧
[EMAIL PROTECTED]@[EMAIL PROTECTED]@殆??([EMAIL PROTECTED];[EMAIL PROTECTED]@", '\0'
<repeats 16 times>, "殆?, '\0' <repeats 16 times>, "\f??
actualDeviceId = 0
vlanId = -1
#3 0x4006a1de in pcap_read_packet () from
/usr/local/lib/libntopreport-2.1.58.so
No symbol table info available.
#4 0x401039fe in pcapDispatch (_i=0x0) at ntop.c:111
rc = 0
pcap_fd = 11
readMask = {__fds_bits = {2048, 0 <repeats 31 times>}}
#5 0x403b7c0e in pthread_start_thread_event () from /lib/libpthread.so.0
No symbol table info available.
my script is:-P /var/log/ntop -u wangzm -i eth1 -b -o -t 5 -z -g -r 300 -m
192.168.1.0/255.255.255.192 -n -W 4000 -K
_______________________________________________
Ntop mailing list
[EMAIL PROTECTED]
http://listgateway.unipi.it/mailman/listinfo/ntop
_______________________________________________
Ntop mailing list
[EMAIL PROTECTED]
http://listgateway.unipi.it/mailman/listinfo/ntop