Hello everybody. I finised developing my module (actually modifying ng_netflow), and my code can be found at http://www.acaro.org/ng_netflow-0.2.4/ i added a few hooks to my code inside ng_netflow.c in the constructor, rmnode, rcvdata etc etc, and the mmap/ioctl code. The rest of my code is found in ng_counter.c. I'm testing it, and it happens it makes my box panic. I tested it using linux's packetgenerator building 95Mb/s, and the box doesn't freeze. I tested it with an nmap on ALL ports range (1-65535), and it logs it. But with high traffic, and actually general purpouse traffic (scp of a big file plus 4 nmaps + some ftp + some http etc etc) the code panics saying the kernel is trying to access a page which doesn't exist. This happens simply counting, not while doing mmap() or ioctl(). The actual code that counts is this:
static int _add_traffic(struct ng_counter_data *counters, u_int16_t dest_port, u_short packet_len, char prot) { u_int64_t * dest, old_val; if(dest_port < 0 || dest_port > 65535) return EINVAL; mtx_lock(&counters->counter_lock); switch(prot){ case UDP_P: dest = counters->B_array+ARRAY_SHIFT; break; case TCP_P: dest = counters->B_array; break; default: return EINVAL; } old_val = *(dest+dest_port); *(dest+dest_port) += packet_len; mtx_unlock(&counters->counter_lock); return 0; } i don't know how netgraph reacts with my lockings, and what the problem might be. I tested it on a freebsd 5.2.1 both on a UP and a dual SMP box, and i've got the same problem on both of them. The two big memory chunks are given me by contigmalloc(), it can be found in ng_counter.c:ng_counter_constr(). I don't know what it can be, because under medium load it works, but with high variegate load it crashes.So it doesn't seem to be a coding error, and all the shared data is under the mutex lock. TIA -- Claudio "thefly" Martella [EMAIL PROTECTED] GNU/PG keyid: 0x8EA95625
signature.asc
Description: Digital signature