14 Commits

Author SHA1 Message Date
Jan Engelhardt
01f97bfdd1 iptaccount: cast from uint64_t to please printf
%llu wants an "unsigned long long", which is not necessarily
the same as uint64_t.
2015-06-05 13:51:56 +02:00
Neal P. Murphy
1324442bce xt_ACCOUNT: make counters 64-bit wide
The Smoothwall Express traffic stats collector (traffiClogger) does
not handle counter rollovers well and does not perform read&flush.
(Yes, the code is somewhat aged.) To change it to perform read&flush
is non-trivial. Then, it occurred to me that it might be easier to
change ipt_ACCOUNT in xtables-addons to use 64-bit counters,
considering it was designed around single kernel pages.

The following submission counts to at least 100 GB, produces no
obvious kernel gripes, and adjacent counters do not seem to interfere
with each other. Yes, it uses more memory, but RAM costs much less
than bugs that grown out of complex software.

The theory:

  - Use two kernel pages for the counters for each group of 256
    addresses.
  - Change counters to 64-bit.
  - Change to __get_free_pages/free_pages, using order=2
    (two consecutive pages), and zero both pages.
  - Change "%u" to "%llu" as needed.
  - Everything else pretty much stays the same.

I also changed tmpbuf to two pages (Justin Case's idea), but I
do not know if that's really necessary.
2015-06-05 13:51:55 +02:00
Jan Engelhardt
aceca54912 iptaccount: fix being a no-op program
A PPC system has been observed where "char" is unsigned; with that,
the getopt loop will never terminate because optchar != -1 could not
happen.
2013-03-31 21:11:24 +02:00
Jan Engelhardt
d5ff452ea5 iptaccount: fix a compile warning
iptaccount.c: In function 'addr_to_dotted':
iptaccount.c:42: warning: implicit declaration of function 'htonl'
2009-11-09 16:00:25 +01:00
Jan Engelhardt
359ecc7a8c ACCOUNT: transfer table data in host order
Make compatibility happy.
2009-11-04 23:37:34 +01:00
Jan Engelhardt
df7168bb4d ACCOUNT: use more precise types and fix minor tidbits 2009-10-30 18:48:04 +01:00
Jan Engelhardt
0aa7be2f1d ACCOUNT: annotate source where BE is used 2009-10-30 18:42:40 +01:00
Jan Engelhardt
8bd6ef78f9 ACCOUNT: correctly account for network-order addresses on BE arches 2009-10-30 18:36:47 +01:00
Jan Engelhardt
e37985b527 ACCOUNT/userspace: use bool type 2009-09-24 01:48:16 +02:00
Jan Engelhardt
0ccd55abd9 ACCOUNT/userspace: remove pointless casts 2009-09-24 01:46:56 +02:00
Jan Engelhardt
60123a8c07 ACCOUNT/userspace: remove static zero initializers 2009-09-24 01:46:56 +02:00
Jan Engelhardt
504f1089fb ACCOUNT/userspace: simple reformat, use tabs instead of spaces 2009-09-24 01:46:55 +02:00
Jan Engelhardt
e119350000 ACCOUNT/userspace: remove trailing whitespace 2009-09-24 01:35:45 +02:00
Jan Rafaj
a260e3349f ACCOUNT: import userspace utilities 2009-09-24 01:27:11 +02:00