Skip to content

Commit 50216ba

Browse files
committed
net.netflow.flush=2 to clean stat counters.
1 parent c40fc87 commit 50216ba

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

ipt_NETFLOW.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1313,9 +1313,20 @@ static int flush_procctl(ctl_table *ctl, int write, BEFORE2632(struct file *filp
13131313
return ret;
13141314

13151315
if (val > 0) {
1316-
printk(KERN_INFO "ipt_NETFLOW: forced flush\n");
1316+
char *stat = "";
1317+
13171318
pause_scan_worker();
13181319
netflow_scan_and_export(AND_FLUSH);
1320+
if (val > 1) {
1321+
int cpu;
1322+
1323+
for_each_present_cpu(cpu) {
1324+
struct ipt_netflow_stat *st = &per_cpu(ipt_netflow_stat, cpu);
1325+
memset(st, 0, sizeof(*st));
1326+
}
1327+
stat = " (reset stat counters)";
1328+
}
1329+
printk(KERN_INFO "ipt_NETFLOW: forced flush%s.\n", stat);
13191330
cont_scan_worker();
13201331
}
13211332

0 commit comments

Comments
 (0)