[netfilter-cvslog] r4255 - in
trunk/patch-o-matic-ng/patchlets/connbytes/linux-2.6:
include/linux/netfilter_ipv4 net/ipv4/netfilter
gandalf at netfilter.org
gandalf at netfilter.org
Sun Sep 11 19:25:03 CEST 2005
Author: gandalf at netfilter.org
Date: 2005-09-11 19:25:01 +0200 (Sun, 11 Sep 2005)
New Revision: 4255
Modified:
trunk/patch-o-matic-ng/patchlets/connbytes/linux-2.6/include/linux/netfilter_ipv4/ipt_connbytes.h
trunk/patch-o-matic-ng/patchlets/connbytes/linux-2.6/net/ipv4/netfilter/ipt_connbytes.c
Log:
Sync with version that has been merged into kernel 2.6
Modified: trunk/patch-o-matic-ng/patchlets/connbytes/linux-2.6/include/linux/netfilter_ipv4/ipt_connbytes.h
===================================================================
--- trunk/patch-o-matic-ng/patchlets/connbytes/linux-2.6/include/linux/netfilter_ipv4/ipt_connbytes.h 2005-09-04 22:33:37 UTC (rev 4254)
+++ trunk/patch-o-matic-ng/patchlets/connbytes/linux-2.6/include/linux/netfilter_ipv4/ipt_connbytes.h 2005-09-11 17:25:01 UTC (rev 4255)
@@ -2,9 +2,9 @@
#define _IPT_CONNBYTES_H
enum ipt_connbytes_what {
- IPT_CONNBYTES_WHAT_PKTS,
- IPT_CONNBYTES_WHAT_BYTES,
- IPT_CONNBYTES_WHAT_AVGPKT,
+ IPT_CONNBYTES_PKTS,
+ IPT_CONNBYTES_BYTES,
+ IPT_CONNBYTES_AVGPKT,
};
enum ipt_connbytes_direction {
@@ -16,8 +16,8 @@
struct ipt_connbytes_info
{
struct {
- u_int64_t from; /* count to be matched */
- u_int64_t to; /* count to be matched */
+ aligned_u64 from; /* count to be matched */
+ aligned_u64 to; /* count to be matched */
} count;
u_int8_t what; /* ipt_connbytes_what */
u_int8_t direction; /* ipt_connbytes_direction */
Modified: trunk/patch-o-matic-ng/patchlets/connbytes/linux-2.6/net/ipv4/netfilter/ipt_connbytes.c
===================================================================
--- trunk/patch-o-matic-ng/patchlets/connbytes/linux-2.6/net/ipv4/netfilter/ipt_connbytes.c 2005-09-04 22:33:37 UTC (rev 4254)
+++ trunk/patch-o-matic-ng/patchlets/connbytes/linux-2.6/net/ipv4/netfilter/ipt_connbytes.c 2005-09-11 17:25:01 UTC (rev 4255)
@@ -22,23 +22,19 @@
MODULE_DESCRIPTION("iptables match for matching number of pkts/bytes per connection");
/* 64bit divisor, dividend and result. dynamic precision */
-static u_int64_t div64_64(u_int64_t divisor, u_int64_t dividend)
+static u_int64_t div64_64(u_int64_t dividend, u_int64_t divisor)
{
- u_int64_t result = divisor;
+ u_int32_t d = divisor;
- if (dividend > 0xffffffff) {
- int first_bit = find_first_bit((unsigned long *) ÷nd, sizeof(dividend));
- /* calculate number of bits to shift. shift exactly enough
- * bits to make dividend fit in 32bits. */
- int num_shift = (64 - 32 - first_bit);
- /* first bit has to be < 32, since dividend was > 0xffffffff */
- result = result >> num_shift;
- dividend = dividend >> num_shift;
+ if (divisor > 0xffffffffULL) {
+ unsigned int shift = fls(divisor >> 32);
+
+ d = divisor >> shift;
+ dividend >>= shift;
}
- do_div(divisor, dividend);
-
- return divisor;
+ do_div(dividend, d);
+ return dividend;
}
static int
@@ -58,7 +54,7 @@
return 0; /* no match */
switch (sinfo->what) {
- case IPT_CONNBYTES_WHAT_PKTS:
+ case IPT_CONNBYTES_PKTS:
switch (sinfo->direction) {
case IPT_CONNBYTES_DIR_ORIGINAL:
what = ct->counters[IP_CT_DIR_ORIGINAL].packets;
@@ -72,7 +68,7 @@
break;
}
break;
- case IPT_CONNBYTES_WHAT_BYTES:
+ case IPT_CONNBYTES_BYTES:
switch (sinfo->direction) {
case IPT_CONNBYTES_DIR_ORIGINAL:
what = ct->counters[IP_CT_DIR_ORIGINAL].bytes;
@@ -86,7 +82,7 @@
break;
}
break;
- case IPT_CONNBYTES_WHAT_AVGPKT:
+ case IPT_CONNBYTES_AVGPKT:
switch (sinfo->direction) {
case IPT_CONNBYTES_DIR_ORIGINAL:
what = div64_64(ct->counters[IP_CT_DIR_ORIGINAL].bytes,
@@ -132,9 +128,9 @@
if (matchsize != IPT_ALIGN(sizeof(struct ipt_connbytes_info)))
return 0;
- if (sinfo->what != IPT_CONNBYTES_WHAT_PKTS &&
- sinfo->what != IPT_CONNBYTES_WHAT_BYTES &&
- sinfo->what != IPT_CONNBYTES_WHAT_AVGPKT)
+ if (sinfo->what != IPT_CONNBYTES_PKTS &&
+ sinfo->what != IPT_CONNBYTES_BYTES &&
+ sinfo->what != IPT_CONNBYTES_AVGPKT)
return 0;
if (sinfo->direction != IPT_CONNBYTES_DIR_ORIGINAL &&
More information about the netfilter-cvslog
mailing list