iptables: use skb->len for accounting
Subsystems (3)
PATCH 1/1 iptables: use skb->len for accounting
iptables: use skb->len for accounting
use skb->len for accounting as xt_quota does.
----
net/ipv4/netfilter/ip_tables.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/netfilter/ip_tables.c +1 -1
@@ -364,7 +364,7 @@ ipt_do_table(struct sk_buff *skb, goto no_match; } -ADD_COUNTER (e->counters,ntohs (ip->tot_len),1 ); +ADD_COUNTER (e->counters, skb->len,1 ); t =ipt_get_target (e);IP_NF_ASSERT (t->u.kernel.target);
Quoted 4 lines · Changli Gao
iptables: use
skb->lenfor accountinguse
skb->lenfor accounting asxt_quotadoes.
Why ?
This is a gratuitous change, unless you have very strong arguments.
xt_quota is an exception, dont change all others because of it !
It is about actual data on wire, including overhead (excess bytes after IP frame if any).
But IP tables accounting is about IP only.
Quoted 9 lines
Signed-off-by Changli Gao <[email protected]>----
net/ipv4/netfilter/ip_tables.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/ipv4/netfilter/ip_tables.c +0
-0
net/ipv4/netfilter/ip_tables.c ipt_do_table(struct sk_buff *skb,
Quoted 9 lines
net/ipv4/netfilter/ip_tables.c +1
-2@@ -364,7 +364,7 @@ ipt_do_table(struct sk_buff *skb, goto no_match; } -ADD_COUNTER (e->counters,ntohs (ip->tot_len),1 ); +ADD_COUNTER (e->counters, skb->len,1 ); t =ipt_get_target (e);IP_NF_ASSERT (t->u.kernel.target); --
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 11 lines · Eric Dumazet
Quoted 4 lines · Changli Gao
iptables: use
skb->lenfor accountinguse
skb->lenfor accounting asxt_quotadoes.Why ?
This is a gratuitous change, unless you have very strong arguments.
xt_quotais an exception, dont change all others because of it !
exception ? Why ?
Quoted 6 lines
It is about actual data on wire, including overhead (excess bytes after IP frame if any).
But IP tables accounting is about IP only.
Is the assumption that: the packets in netfilter have the padding bytes removed, and skb->data points to the network header? Thanks.
Signature · 6 lines
Regards, Changli Gao([email protected]) -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 7 lines · Changli Gao
Quoted 6 lines · Eric Dumazet
Quoted 4 lines · Changli Gao
iptables: use
skb->lenfor accountinguse
skb->lenfor accounting asxt_quotadoes.
Quoted 7 lines
Quoted 5 lines
Why ?
This is a gratuitous change, unless you have very strong arguments.
xt_quotais an exception, dont change all others because of it !exception ? Why ?
Because it handles all protocols...
So skb->len is a shortcut, an approximation if you want.
At IPV4 level, ip->tot_len is an exact value.
Quoted 14 lines · Eric Dumazet
Quoted 13 lines · Changli Gao
Quoted 11 lines · Eric Dumazet
Quoted 4 lines · Changli Gao
iptables: use
skb->lenfor accountinguse
skb->lenfor accounting asxt_quotadoes.Why ?
This is a gratuitous change, unless you have very strong arguments.
xt_quotais an exception, dont change all others because of it !
Quoted 7 lines
Quoted 1 line
exception ? Why ?
Because it handles all protocols...
So
skb->lenis a shortcut, an approximation if you want.At IPV4 level,
ip->tot_lenis an exact value.
Actually skb->len is also exact at the IPv4 level. I'm inclined to apply this patch for consistency with ip6_tables, where using skb->len fixes jumbo frame accounting.
Quoted 4 lines · Patrick McHardy
Actually
skb->lenis also exact at the IPv4 level. I'm inclined to apply this patch for consistency withip6_tables, where usingskb->lenfixes jumbo frame accounting.
Thats right.
I was confused by recent problem raised with UDP checksums.
But pskb_trim_rcsum() is indeed called from ip_rcv() so skb->len == ntohs(iph->tot_len)
Thanks
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Patrick McHardy
AppliedQuoted 4 lines · Changli Gao
iptables: use
skb->lenfor accountinguse
skb->lenfor accounting asxt_quotadoes.
Applied, thanks.