* [PATCH] Avoid unncessary checksum validation in TCP/UDP netfilter
@ 2005-05-27 11:03 Keir Fraser
2005-05-27 11:20 ` Phil Oester
0 siblings, 1 reply; 4+ messages in thread
From: Keir Fraser @ 2005-05-27 11:03 UTC (permalink / raw)
To: linux-kernel; +Cc: xen-devel, Keir.Fraser, cedric, coreteam
[-- Attachment #1: Type: text/plain, Size: 750 bytes --]
The TCP/UDP connection-tracking code in netfilter validates the
checksum of incoming packets, to prevent nastier errors further down
the road. This check is unnecessary if the skb is marked as
CHECKSUM_UNNECESSARY.
This patch will improve performance for networkinterfaces that perform
CHECKSUM_UNNECESSARY-style checksum offload (that's most modern
ones). More importantly (for me :-)) is that this makes netfilter play
nicely with checksum avoidance in the Xen virtual machine
monitor. Inter-domain traffic has no checksum calculated, so
validation checks will fail even though the packet data is good.
Of course, this avoidance relies on the network stack respecting
CHECKSUM_UNNECESSARY.
Signed-off-by: Keir Fraser <Keir.Fraser@xl.cam.ac.uk>
[-- Attachment #2: Checksum patch --]
[-- Type: text/plain, Size: 1351 bytes --]
diff -ur linux-2.6.11/net/ipv4/netfilter/ip_conntrack_proto_tcp.c linux-2.6.11-csum/net/ipv4/netfilter/ip_conntrack_proto_tcp.c
--- linux-2.6.11/net/ipv4/netfilter/ip_conntrack_proto_tcp.c 2005-05-27 11:47:48 +01:00
+++ linux-2.6.11-csum/net/ipv4/netfilter/ip_conntrack_proto_tcp.c 2005-05-27 11:48:07 +01:00
@@ -803,6 +803,7 @@
*/
/* FIXME: Source route IP option packets --RR */
if (hooknum == NF_IP_PRE_ROUTING
+ && skb->ip_summed != CHECKSUM_UNNECESSARY
&& csum_tcpudp_magic(iph->saddr, iph->daddr, tcplen, IPPROTO_TCP,
skb->ip_summed == CHECKSUM_HW ? skb->csum
: skb_checksum(skb, iph->ihl*4, tcplen, 0))) {
diff -ur linux-2.6.11/net/ipv4/netfilter/ip_conntrack_proto_udp.c linux-2.6.11-csum/net/ipv4/netfilter/ip_conntrack_proto_udp.c
--- linux-2.6.11/net/ipv4/netfilter/ip_conntrack_proto_udp.c 2005-05-27 11:47:48 +01:00
+++ linux-2.6.11-csum/net/ipv4/netfilter/ip_conntrack_proto_udp.c 2005-05-27 11:48:07 +01:00
@@ -120,6 +120,7 @@
* and moreover root might send raw packets.
* FIXME: Source route IP option packets --RR */
if (hooknum == NF_IP_PRE_ROUTING
+ && skb->ip_summed != CHECKSUM_UNNECESSARY
&& csum_tcpudp_magic(iph->saddr, iph->daddr, udplen, IPPROTO_UDP,
skb->ip_summed == CHECKSUM_HW ? skb->csum
: skb_checksum(skb, iph->ihl*4, udplen, 0))) {
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] Avoid unncessary checksum validation in TCP/UDP netfilter
2005-05-27 11:03 [PATCH] Avoid unncessary checksum validation in TCP/UDP netfilter Keir Fraser
@ 2005-05-27 11:20 ` Phil Oester
2005-05-28 8:48 ` Keir Fraser
0 siblings, 1 reply; 4+ messages in thread
From: Phil Oester @ 2005-05-27 11:20 UTC (permalink / raw)
To: Keir Fraser; +Cc: linux-kernel, xen-devel, cedric, coreteam
On Fri, May 27, 2005 at 12:03:08PM +0100, Keir Fraser wrote:
> The TCP/UDP connection-tracking code in netfilter validates the
> checksum of incoming packets, to prevent nastier errors further down
> the road. This check is unnecessary if the skb is marked as
> CHECKSUM_UNNECESSARY.
It seems at least part of this has already been merged in 2.6.12-rc
http://www.kernel.org/git/gitweb.cgi?p=linux/kernel/git/torvalds/linux-2.6.git;a=blobdiff;h=721ddbf522b422d554479a7ab15c0955798f16ee;hp=2b87c1974be605d5bdb1ee769188d7e03fb2ddc8;hb=31da185d8162ae0f30a13ed945f1f4d28d158133;f=net/ipv4/netfilter/ip_conntrack_proto_tcp.c
Phil
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Avoid unncessary checksum validation in TCP/UDP netfilter
2005-05-27 11:20 ` Phil Oester
@ 2005-05-28 8:48 ` Keir Fraser
2005-06-12 15:06 ` [netfilter-core] " Patrick McHardy
0 siblings, 1 reply; 4+ messages in thread
From: Keir Fraser @ 2005-05-28 8:48 UTC (permalink / raw)
To: Phil Oester; +Cc: coreteam, xen-devel, linux-kernel, cedric
On 27 May 2005, at 12:20, Phil Oester wrote:
> On Fri, May 27, 2005 at 12:03:08PM +0100, Keir Fraser wrote:
>> The TCP/UDP connection-tracking code in netfilter validates the
>> checksum of incoming packets, to prevent nastier errors further down
>> the road. This check is unnecessary if the skb is marked as
>> CHECKSUM_UNNECESSARY.
>
> It seems at least part of this has already been merged in 2.6.12-rc
It would be great if the UDP code also would observe
CHECKSUM_UNNECESSARY. I'll wait for 2.6.12 to appear and then submit a
new patch if UDP has been missed.
Thanks,
Keir
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [netfilter-core] Re: [PATCH] Avoid unncessary checksum validation in TCP/UDP netfilter
2005-05-28 8:48 ` Keir Fraser
@ 2005-06-12 15:06 ` Patrick McHardy
0 siblings, 0 replies; 4+ messages in thread
From: Patrick McHardy @ 2005-06-12 15:06 UTC (permalink / raw)
To: Keir Fraser; +Cc: Phil Oester, cedric, coreteam, xen-devel, linux-kernel
Keir Fraser wrote:
> On 27 May 2005, at 12:20, Phil Oester wrote:
>> On Fri, May 27, 2005 at 12:03:08PM +0100, Keir Fraser wrote:
>>
>>> The TCP/UDP connection-tracking code in netfilter validates the
>>> checksum of incoming packets, to prevent nastier errors further down
>>> the road. This check is unnecessary if the skb is marked as
>>> CHECKSUM_UNNECESSARY.
>>
>> It seems at least part of this has already been merged in 2.6.12-rc
>
> It would be great if the UDP code also would observe
> CHECKSUM_UNNECESSARY. I'll wait for 2.6.12 to appear and then submit a
> new patch if UDP has been missed.
TCP was changed to fix a regression with loopback packets. I've added
the UDP part of your patch to my 2.6.13 tree.
Regards
Patrick
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-06-12 15:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-27 11:03 [PATCH] Avoid unncessary checksum validation in TCP/UDP netfilter Keir Fraser
2005-05-27 11:20 ` Phil Oester
2005-05-28 8:48 ` Keir Fraser
2005-06-12 15:06 ` [netfilter-core] " Patrick McHardy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox