netfilter: fix UDP incremental checksumming
Subsystems (2)
PATCH 1/1 netfilter: fix UDP incremental checksumming
Hi Davem!
Please apply the following patchto your 2.4 tree and push it to Marcelo. Thanks.
Author: Patrick McHardy <[email protected]>
Status: Submitted for kernel inclusion at 2.4.23-pre5 time
Fix UDP checksum in ip_nat_mangle_udp_packet, remove skb->csum hacks
Signature · 5 lines
- Harald Welte <[email protected]> http://www.netfilter.org/ ============================================================================ "Fragmentation is like classful addressing -- an interesting early architectural error that shows how much experimentation was going on while IP was being designed." -- Paul Vixie
# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:
# ChangeSet 1.1133 -> 1.1134
# net/ipv4/netfilter/ip_nat_helper.c 1.9 -> 1.10
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/09/28 [email protected] 1.1134
# [NETFILTER]: Fix UDP checksum in ip_nat_mangle_udp_packet, remove skb->csum hacks # --------------------------------------------
#
net/ipv4/netfilter/ip_nat_helper.c +4 -15
@@ -195,16 +195,11 @@skb_trim (*skb, newlen); } -/* fix checksum information */ - iph->tot_len =htons (newlen); - (*skb)->csum =csum_partial ((char *)tcph + tcph->doff*4 , - newtcplen - tcph->doff*4 ,0 ); - +/* fix checksum information */ tcph->check =0 ; tcph->check =tcp_v4_check (tcph, newtcplen, iph->saddr, iph->daddr, -csum_partial ((char *)tcph, tcph->doff*4 , - (*skb)->csum)); +csum_partial ((char *)tcph, newtcplen,0 ));ip_send_check (iph);return 1 ;
@@ -299,18 +294,12 @@ iph->tot_len =htons (newlen);/* fix udp checksum if udp checksum was previously calculated */ -if ((*skb)->csum !=0 ) { - (*skb)->csum =csum_partial ((char *)udph + -sizeof (struct udphdr ), - newudplen -sizeof (struct udphdr ), -0 ); - +if (udph->check !=0 ) { udph->check =0 ; udph->check =csum_tcpudp_magic (iph->saddr, iph->daddr, newudplen,IPPROTO_UDP ,csum_partial ((char *)udph, -sizeof (struct udphdr ), - (*skb)->csum)); + newudplen,0 )); }ip_send_check (iph);
David S. Miller
AppliedQuoted 2 lines · On Thu, 2 Oct 2003 16:15:09 +0200 Harald Welte <[email protected]> wrote:
Please apply the following patchto your 2.4 tree and push it to Marcelo. Thanks.
Applied, thanks.