Avoid unncessary checksum validation in TCP/UDP netfilter
Subsystems (2)
PATCH 1/1 Avoid unncessary checksum validation in TCP/UDP netfilter
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.
net/ipv4/netfilter/ip_conntrack_proto_tcp.c +1 -0
@@ -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 ))) {
net/ipv4/netfilter/ip_conntrack_proto_udp.c +1 -0
@@ -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 ))) {
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 4 lines · Keir Fraser
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
Phil
Quoted 7 lines · Phil Oester
Quoted 4 lines · Keir Fraser
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
Quoted 8 lines · Keir Fraser
Quoted 7 lines · Phil Oester
Quoted 4 lines · Keir Fraser
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.
Quoted 5 lines
Quoted 1 line
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