BUG: warning at net/core/dev.c:1171/skb_checksum_help() 2.6.18-rc3
Subsystems (13)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
This machine has four NICs running the e1000 kernel module. Other than the BUG() messages, it seems to be running fine. I was running 2.6.15.4 without any issues on the same hardware, although I noticed the e1000 has been updated (and I went for rc3 since I was hitting the panic in -rc2)
Now, I'm not sure if it also has anything to do with this message:
NAT: no longer support implicit source local NAT
NAT: packet src 10.1.1.1 -> dst 207.166.203.131
Any suggestions as to how to go about debugging this?
BUG: warning at net/core/dev.c:1171/skb_checksum_help() [<c02e0412>] skb_checksum_help+0x4d/0xf0 [<c034e4d3>] ip_nat_fn+0x4e/0x19e [<c034e78e>] ip_nat_local_fn+0x3d/0xb9 [<c0314011>] dst_output+0x0/0x7 [<c03059ee>] nf_iterate+0x40/0x6e BUG: warning at net/core/dev.c:1171/skb_checksum_help() [<c02e0412>] skb_checksum_help+0x4d/0xf0 [<c034e4d3>] ip_nat_fn+0x4e/0x19e [<c034e78e>] ip_nat_local_fn+0x3d/0xb9 [<c0314011>] dst_output+0x0/0x7 [<c03059ee>] nf_iterate+0x40/0x6e [<c0314011>] dst_output+0x0/0x7 [<c0305a5e>] nf_hook_slow+0x42/0x98 [<c0314011>] dst_output+0x0/0x7 [<c03123c4>] ip_queue_xmit+0x3a3/0x3fc [<c0314011>] dst_output+0x0/0x7 [<c037f544>] xprt_timer+0x0/0x65 [<c01e7964>] __next_cpu+0x12/0x1f [<c0112a8c>] find_busiest_group+0x17e/0x473 [<c0320d17>] tcp_transmit_skb+0x39f/0x3bc [<c0321f7a>] tcp_write_xmit+0x1a8/0x210 [<c0322000>] __tcp_push_pending_frames+0x1e/0x6f [<c0317d5d>] do_tcp_sendpages+0x4fa/0x521 [<c0317dcf>] tcp_sendpage+0x4b/0x5e [<c02d7fa7>] sock_sendpage+0x31/0x37 [<c013242e>] file_send_actor+0x30/0x4a [<c0131e0b>] do_generic_mapping_read+0x167/0x3d5 [<c013248a>] generic_file_sendfile+0x42/0x55 [<c01323fe>] file_send_actor+0x0/0x4a [<c019a141>] nfs_file_sendfile+0x59/0x60 [<c01323fe>] file_send_actor+0x0/0x4a [<c014ad07>] do_sendfile+0x1b8/0x252 [<c01323fe>] file_send_actor+0x0/0x4a [<c014adec>] sys_sendfile+0x4b/0x86 [<c010272f>] syscall_call+0x7/0xb BUG: warning at net/core/dev.c:1225/skb_gso_segment() [<c02e053d>] skb_gso_segment+0x88/0x179 [<c02e06db>] dev_gso_segment+0x5c/0x82 [<c02e074a>] dev_hard_start_xmit+0x49/0xb1 [<c02e0957>] dev_queue_xmit+0x1a5/0x21f [<c0311fea>] ip_output+0x1ce/0x205 [<c03123d6>] ip_queue_xmit+0x3b5/0x3fc [<c037f544>] xprt_timer+0x0/0x65 [<c01e7964>] __next_cpu+0x12/0x1f [<c0112a8c>] find_busiest_group+0x17e/0x473 [<c0320d17>] tcp_transmit_skb+0x39f/0x3bc [<c0321f7a>] tcp_write_xmit+0x1a8/0x210 [<c0322000>] __tcp_push_pending_frames+0x1e/0x6f [<c0317d5d>] do_tcp_sendpages+0x4fa/0x521 [<c0317dcf>] tcp_sendpprintk: 19 messages suppressed. age+0x4b/0x5e eth2.300: received packet with own address as source address [<c02d7fa7>] sock_sendpage+0x31/0x37 [<c013242e>] file_send_actor+0x30/0x4a [<c0131e0b>] do_generic_mapping_read+0x167/0x3d5 [<c013248a>] generic_file_sendfile+0x42/0x55 [<c01323fe>] file_send_actor+0x0/0x4a [<c019a141>] nfs_file_sendfile+0x59/0x60 [<c01323fe>] file_send_actor+0x0/0x4a [<c014ad07>] do_sendfile+0x1b8/0x252 [<c01323fe>] file_send_actor+0x0/0x4a [<c014adec>] sys_sendfile+0x4b/0x86 [<c010272f>] syscall_call+0x7/0xb [<c0314011>] dst_output+0x0/0x7 [<c0305a5e>] nf_hook_slow+0x42/0x98 [<c0314011>] dst_output+0x0/0x7 [<c03123c4>] ip_queue_xmit+0x3a3/0x3fc [<c0314011>] dst_output+0x0/0x7 [<c037f544>] xprt_timer+0x0/0x65 [<c01e7964>] __next_cpu+0x12/0x1f [<c0112a8c>] find_busiest_group+0x17e/0x473 [<c0320d17>] tcp_transmit_skb+0x39f/0x3bc [<c0321f7a>] tcp_write_xmit+0x1a8/0x210 [<c0322000>] __tcp_push_pending_frames+0x1e/0x6f [<c0317d5d>] do_tcp_sendpages+0x4fa/0x521 [<c0317dcf>] tcp_sendpage+0x4b/0x5e [<c02d7fa7>] sock_sendpage+0x31/0x37 [<c013242e>] file_send_actor+0x30/0x4a [<c0131e0b>] do_generic_mapping_read+0x167/0x3d5 [<c013248a>] generic_file_sendfile+0x42/0x55 [<c01323fe>] file_send_actor+0x0/0x4a [<c019a141>] nfs_file_sendfile+0x59/0x60 [<c01323fe>] file_send_actor+0x0/0x4a [<c014ad07>] do_sendfile+0x1b8/0x252 [<c01323fe>] file_send_actor+0x0/0x4a [<c014adec>] sys_sendfile+0x4b/0x86 [<c010272f>] syscall_call+0x7/0xb
David
- --
David J. Coulson
email: [email protected]
web: http://www.davidcoulson.net/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFEzYQUTIgPQWnLowkRAqHuAKDhAovcE8dIhAofI2KTUXXZOQlXagCcC99R YGveQogGHtJV8yWbeezn45w=
=upA0
-----END PGP SIGNATURE-----
Quoted 9 lines · David Coulson
This machine has four NICs running the e1000 kernel module. Other than the
BUG()messages, it seems to be running fine. I was running 2.6.15.4 without any issues on the same hardware, although I noticed the e1000 has been updated (and I went for rc3 since I was hitting the panic in -rc2)Now, I'm not sure if it also has anything to do with this message:
NAT: no longer support implicit source local NAT
NAT: packet src 10.1.1.1 -> dst 207.166.203.131
No, this in unrelated. This message tries to tell you that the old behaviour of changing the source address implicitly to the source address routing would use for a DNATed connection is no longer done. This behaviour changed in 2.6.11, so if everything worked in 2.6.15, you should be fine.
Quoted 5 lines
Any suggestions as to how to go about debugging this?
BUG: warning at net/core/dev.c:1171/skb_checksum_help() [<c02e0412>] skb_checksum_help+0x4d/0xf0 [<c034e4d3>] ip_nat_fn+0x4e/0x19e
This is a known problem with NAT and HW checksum and will probably get fixed in 2.6.19. The message is just a warning, everything should work fine.
Quoted 10 lines · On Mon, 31 Jul 2006 00:16:21 -0400 David Coulson <[email protected]> wrote:
This machine has four NICs running the e1000 kernel module. Other than the
BUG()messages, it seems to be running fine. I was running 2.6.15.4 without any issues on the same hardware, although I noticed the e1000 has been updated (and I went for rc3 since I was hitting the panic in -rc2)Now, I'm not sure if it also has anything to do with this message:
NAT: no longer support implicit source local NAT
NAT: packet src 10.1.1.1 -> dst 207.166.203.131
Quoted 8 lines
Any suggestions as to how to go about debugging this?
BUG: warning at net/core/dev.c:1171/skb_checksum_help() [<c02e0412>] skb_checksum_help+0x4d/0xf0 [<c034e4d3>] ip_nat_fn+0x4e/0x19e [<c034e78e>] ip_nat_local_fn+0x3d/0xb9 [<c0314011>] dst_output+0x0/0x7 [<c03059ee>] nf_iterate+0x40/0x6e
Several people are reporting this. It's apparently harmless and serves as a(n odd) way for the net guys to remind themselves that this needs fixing.
It'd be nice to not let this escape into 2.6.18, please?
David Miller
maintainerFrom: Andrew Morton <[email protected]>
Date: Sun, 30 Jul 2006 21:34:37 -0700
Quoted 5 lines
Several people are reporting this. It's apparently harmless and serves as a(n odd) way for the net guys to remind themselves that this needs fixing.
It'd be nice to not let this escape into 2.6.18, please?
I'll make sure it doesn't. :)
David Miller
maintainerFrom: Patrick McHardy <[email protected]>
Date: Mon, 31 Jul 2006 06:24:31 +0200
Quoted 2 lines
This is a known problem with NAT and HW checksum and will probably get fixed in 2.6.19.
I would like to see this fixed for 2.6.18, no later.
Either that or disable the bug trap, but taking this route is severely discouraged. :)
Quoted 4 lines · David Miller
From: Patrick McHardy <[email protected]>
Date: Mon, 31 Jul 2006 06:24:31 +0200
Quoted 8 lines
Quoted 2 lines
This is a known problem with NAT and HW checksum and will probably get fixed in 2.6.19.
I would like to see this fixed for 2.6.18, no later.
Either that or disable the bug trap, but taking this route is severely discouraged. :)
I'm actually updateing my patch for this on top of Herbert's CHECKSUM_PARTIAL patch right now. Unfortunately I targeted 2.6.19, so the fixes are on top of a few cleanups (which unconvered a few unrelated bugs as well). I'll post it when I'm done so we can decide how to proceed.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Now, I started the heartbeat process on the same machine, and it blew up trying to do something with IPaddr. I can't even sysrq the box back into life at this point :-/
BUG: unable to handle kernel paging request at virtual address 9e045900 printing eip: c01119d7 *pde = 00000000 Oops: 0000 [#1] SMP CPU: 0 EIP: 0060:[<c01119d7>] Not tainted VLI EFLAGS: 00010097 (2.6.18-rc3 #2)
EIP is at resched_task+0x11/0x61
eax: c05134e0 ebx: f5024570 ecx: f5046000 edx: f76db540
esi: c200d340 edi: 00000001 ebp: f1cc3e00 esp: f1cc3dfc
ds: 007b es: 007b ss: 0068
Process IPaddr (pid: 8939, ti=f1cc2000 task=f5264ab0 task.ti=f1cc2000)
Stack: c2117030 f1cc3e5c c0112034 c0112804 00000075 00000180 c2011cdc
c2011cdc
c200ca24 00000001 0000007d 01af9500 00000001 c200d340 c2011460
00000001
00000000 00000000 00000000 0000000f 00000092 c2011460 c200d340
c200c9e0
Call Trace:
[<c0112034>] try_to_wake_up+0x262/0x285
[<c0112804>] move_tasks+0xfd/0x207
[<c0112f2b>] load_balance+0x14a/0x1d7
[<c011325e>] rebalance_tick+0xc5/0xe5
[<c012025f>] update_process_times+0x52/0x5c
[<c010a2b6>] smp_apic_timer_interrupt+0x5b/0x61
[<c0103147>] apic_timer_interrupt+0x1f/0x24
[<c038dbe6>] __mutex_lock_slowpath+0x17f/0x18e
[<c015f020>] touch_atime+0x65/0xa6
[<c0153c2b>] pipe_readv+0x67/0x272
[<c0153e52>] pipe_read+0x1c/0x20
[<c014a2e7>] vfs_read+0x84/0x123
[<c014a5df>] sys_read+0x3c/0x62
[<c010272f>] syscall_call+0x7/0xb
Code: 2b 43 18 89 42 08 89 d8 8b 53 30 e8 08 fd ff ff c7 43 30 00 00 00
00 5b 5
EIP: [<c01119d7>] resched_task+0x11/0x61 SS:ESP 0068:f1cc3dfc
<0>Kernel panic - not syncing: Fatal exception in interrupt
BUG: warning at arch/i386/kernel/smp.c:547/smp_call_function()
[<c0108ca4>] smp_call_function+0x59/0x119
[<c01034b7>] show_stack_log_lvl+0x91/0x99
[<c01185de>] printk+0xe/0x11
[<c0108daa>] smp_send_stop+0x13/0x1c
[<c0117dec>] panic+0x41/0xdb
[<c01038ad>] die+0x1c3/0x1da
[<c01185de>] printk+0xe/0x11
[<c010dd0e>] do_page_fault+0x3e3/0x4bc
[<c010d92b>] do_page_fault+0x0/0x4bc
[<c01031d5>] error_code+0x39/0x40
[<c01119d7>] resched_task+0x11/0x61
[<c0112034>] try_to_wake_up+0x262/0x285
[<c0112804>] move_tasks+0xfd/0x207
[<c0112f2b>] load_balance+0x14a/0x1d7
[<c011325e>] rebalance_tick+0xc5/0xe5
[<c012025f>] update_process_times+0x52/0x5c
[<c010a2b6>] smp_apic_timer_interrupt+0x5b/0x61
[<c0103147>] apic_timer_interrupt+0x1f/0x24
[<c038dbe6>] __mutex_lock_slowpath+0x17f/0x18e
[<c015f020>] touch_atime+0x65/0xa6
[<c0153c2b>] pipe_readv+0x67/0x272
[<c0153e52>] pipe_read+0x1c/0x20
[<c014a2e7>] vfs_read+0x84/0x123
[<c014a5df>] sys_read+0x3c/0x62
[<c010272f>] syscall_call+0x7/0xbDavid
- --
David J. Coulson
email: [email protected]
web: http://www.davidcoulson.net/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFEzYocTIgPQWnLowkRAvuKAKCCRVXMq60qIBwMq6BQ/eWFV/nTPQCgmjIl Ki3kjhWJ3dG2itFTHn8D/sw=
=/Gf/
-----END PGP SIGNATURE-----
Quoted 8 lines · Patrick McHardy
Quoted 4 lines · David Miller
I would like to see this fixed for 2.6.18, no later.
Either that or disable the bug trap, but taking this route is severely discouraged. :)
Quoted 5 lines
I'm actually updateing my patch for this on top of Herbert's
CHECKSUM_PARTIALpatch right now. Unfortunately I targeted 2.6.19, so the fixes are on top of a few cleanups (which unconvered a few unrelated bugs as well). I'll post it when I'm done so we can decide how to proceed.
These are the patches (some variantions tested, but not all) on top of Herbert's CHECKSUM_PARTIAL patch. The first one fixes up the CHECKSUM_PARTIAL patch for 2.6.18-rc3, the second one fixes checksumming in all of netfilter besides ip_queue, the third one fixes ip_queue.
Its actually not that much, if Herbert is fine with putting the CHECKSUM_PARTIAL patch in 2.6.18 I'll do some more testing and then I think these can go in as well.
[NET]: Fix up CHECKSUM_PARTIAL patch for 2.6.18-rc3
---
commit 17a40f32fc339e9f6feeb042db58d30c8caf2fad
tree 479e926c12606667a91d483223b4416da56227d5
parent 296b866d72ee7a8a577908323f2a7e8e92f4001f
author Patrick McHardy <[email protected]> Mon, 31 Jul 2006 09:23:27 +0200 committer Patrick McHardy <[email protected]> Mon, 31 Jul 2006 09:23:27 +0200
include/linux/netdevice.h | 4 ++-- net/core/dev.c | 8 ++++---- net/ipv4/tcp.c | 4 ++-- net/ipv4/tcp_ipv4.c | 2 +- net/ipv6/tcp_ipv6.c | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-)
include/linux/netdevice.h +2 -2
@@ -973,7 +973,7 @@ extern void dev_mcast_init(void);extern int netdev_max_backlog;extern int weight_p;extern int netdev_set_master (struct net_device *dev,struct net_device *master); -extern int skb_checksum_help (struct sk_buff *skb,int inward); +extern int skb_checksum_help (struct sk_buff *skb);extern struct sk_buff *skb_gso_segment (struct sk_buff *skb,int features);#ifdef CONFIG_BUG extern void netdev_rx_csum_fault (struct net_device *dev);
@@ -1009,7 +1009,7 @@ static inline int netif_needs_gso(struct {return skb_is_gso (skb) && (!skb_gso_ok (skb, dev->features) || -unlikely (skb->ip_summed !=CHECKSUM_HW )); +unlikely (skb->ip_summed !=CHECKSUM_PARTIAL )); }#endif /* __KERNEL__ */
net/core/dev.c +4 -4
@@ -1157,12 +1157,12 @@ EXPORT_SYMBOL(netif_device_attach);* Invalidate hardware checksum when packet is to be mangled, and * complete checksum manually on outgoing path. */ -int skb_checksum_help (struct sk_buff *skb,int inward) +int skb_checksum_help (struct sk_buff *skb) {unsigned int csum;int ret =0 , offset = skb->h.raw - skb->data; -if (inward) +if (skb->ip_summed ==CHECKSUM_COMPLETE ) goto out_set_summed;if (unlikely (skb_shinfo (skb)->gso_size)) {
@@ -1219,7 +1219,7 @@ struct sk_buff *skb_gso_segment(struct s skb->mac_len = skb->nh.raw - skb->data;__skb_pull (skb, skb->mac_len); -if (unlikely (skb->ip_summed !=CHECKSUM_HW )) { +if (unlikely (skb->ip_summed !=CHECKSUM_PARTIAL )) {static int warned;WARN_ON (!warned);
@@ -1233,7 +1233,7 @@ struct sk_buff *skb_gso_segment(struct srcu_read_lock ();list_for_each_entry_rcu (ptype, &ptype_base[ntohs (type) &15 ], list) {if (ptype->type == type && !ptype->dev && ptype->gso_segment) { -if (unlikely (skb->ip_summed !=CHECKSUM_HW )) { +if (unlikely (skb->ip_summed !=CHECKSUM_PARTIAL )) { err = ptype->gso_send_check (skb); segs =ERR_PTR (err);if (err ||skb_gso_ok (skb, features))
net/ipv4/tcp.c +2 -2
@@ -2204,7 +2204,7 @@ struct sk_buff *tcp_tso_segment(struct s th->fin = th->psh =0 ; th->check = ~csum_fold (th->check + delta); -if (skb->ip_summed !=CHECKSUM_HW ) +if (skb->ip_summed !=CHECKSUM_PARTIAL ) th->check =csum_fold (csum_partial (skb->h.raw, thlen, skb->csum));
@@ -2218,7 +2218,7 @@ struct sk_buff *tcp_tso_segment(struct s delta =htonl (oldlen + (skb->tail - skb->h.raw) + skb->data_len); th->check = ~csum_fold (th->check + delta); -if (skb->ip_summed !=CHECKSUM_HW ) +if (skb->ip_summed !=CHECKSUM_PARTIAL ) th->check =csum_fold (csum_partial (skb->h.raw, thlen, skb->csum));
net/ipv4/tcp_ipv4.c +1 -1
@@ -510,7 +510,7 @@ int tcp_v4_gso_send_check(struct sk_buff th->check =0 ; th->check = ~tcp_v4_check (th, skb->len, iph->saddr, iph->daddr,0 ); skb->csum = offsetof(struct tcphdr , check); - skb->ip_summed =CHECKSUM_HW ; + skb->ip_summed =CHECKSUM_PARTIAL ;return 0 ; }
net/ipv6/tcp_ipv6.c +1 -1
@@ -567,7 +567,7 @@ static int tcp_v6_gso_send_check(struct th->check = ~csum_ipv6_magic (&ipv6h->saddr, &ipv6h->daddr, skb->len,IPPROTO_TCP ,0 ); skb->csum = offsetof(struct tcphdr , check); - skb->ip_summed =CHECKSUM_HW ; + skb->ip_summed =CHECKSUM_PARTIAL ;return 0 ; }
[NETFILTER]: Get rid of HW checksum invalidation
---
commit 2d1b6c7500cd7b71a795976fe8eb3d2fd47cd39a
tree a0df4f11d6991df2f5be9d7c050b3c0c2303e968
parent 17a40f32fc339e9f6feeb042db58d30c8caf2fad
author Patrick McHardy <[email protected]> Mon, 31 Jul 2006 12:28:11 +0200 committer Patrick McHardy <[email protected]> Mon, 31 Jul 2006 12:28:11 +0200
include/linux/netfilter.h | 6 +++ net/ipv4/netfilter/ip_nat_core.c | 18 ++++++---- net/ipv4/netfilter/ip_nat_helper.c | 57 ++++++++++++++++++++++---------- net/ipv4/netfilter/ip_nat_proto_gre.c | 5 ++- net/ipv4/netfilter/ip_nat_proto_icmp.c | 8 ++-- net/ipv4/netfilter/ip_nat_proto_tcp.c | 7 ++-- net/ipv4/netfilter/ip_nat_proto_udp.c | 13 ++++--- net/ipv4/netfilter/ip_nat_standalone.c | 6 --- net/ipv4/netfilter/ipt_ECN.c | 19 +++-------- net/ipv4/netfilter/ipt_REJECT.c | 1 + net/ipv4/netfilter/ipt_TCPMSS.c | 39 +++++++++------------- net/netfilter/core.c | 23 +++++++++++++ 12 files changed, 120 insertions(+), 82 deletions(-)
include/linux/netfilter.h +6 -0
@@ -282,6 +282,12 @@ extern void nf_invalidate_cache(int pf);Returns true or false. */ extern int skb_make_writable (struct sk_buff **pskb,unsigned int writable_len); +extern u_int16_t nf_csum_update (u_int32_t oldval,u_int32_t newval, +u_int16_t csum); +extern u_int16_t nf_proto_csum_update (struct sk_buff *skb, +u_int32_t oldval,u_int32_t newval, +u_int16_t csum,int pseudohdr); +struct nf_afinfo {unsigned short family; unsigned int (*checksum)(struct sk_buff *skb, unsigned int hook,
net/ipv4/netfilter/ip_nat_core.c +11 -7
@@ -443,7 +443,9 @@ int ip_nat_icmp_reply_translation(struct/* We're actually going to mangle it beyond trivial checksum adjustment, so make sure the current checksum is correct. */ -if ((*pskb)->ip_summed !=CHECKSUM_UNNECESSARY ) { + +if ((*pskb)->ip_summed !=CHECKSUM_UNNECESSARY && + (*pskb)->ip_summed !=CHECKSUM_PARTIAL ) { hdrlen = (*pskb)->nh.iph->ihl *4 ;if ((u16 )csum_fold (skb_checksum (*pskb, hdrlen, (*pskb)->len - hdrlen,0 )))
@@ -487,12 +489,14 @@ int ip_nat_icmp_reply_translation(struct !manip))return 0 ; -/* Reloading "inside" here since manip_pkt inner. */ - inside = (void *)(*pskb)->data + (*pskb)->nh.iph->ihl*4 ; - inside->icmp.checksum =0 ; - inside->icmp.checksum =csum_fold (skb_checksum (*pskb, hdrlen, - (*pskb)->len - hdrlen, -0 )); +if ((*pskb)->ip_summed !=CHECKSUM_PARTIAL ) { +/* Reloading "inside" here since manip_pkt inner. */ + inside = (void *)(*pskb)->data + (*pskb)->nh.iph->ihl*4 ; + inside->icmp.checksum =0 ; + inside->icmp.checksum =csum_fold (skb_checksum (*pskb, hdrlen, + (*pskb)->len - hdrlen, +0 )); + }/* Change outer to look the reply to an incoming packet * (proto 0 means don't invert per-proto part). */
net/ipv4/netfilter/ip_nat_helper.c +39 -18
108 lines not on this page · raw message
net/ipv4/netfilter/ip_nat_proto_gre.c +3 -2
@@ -130,9 +130,10 @@ gre_manip_pkt(struct sk_buff **pskb,if (greh->csum) {/* FIXME: Never tested this code... */ *(gre_csum (greh)) = -ip_nat_cheat_check (~*(gre_key (greh)), +nf_proto_csum_update (*pskb, + ~*(gre_key (greh)), tuple->dst.u.gre.key, - *(gre_csum (greh))); + *(gre_csum (greh)),0 ); } *(gre_key (greh)) = tuple->dst.u.gre.key;break ;
net/ipv4/netfilter/ip_nat_proto_icmp.c +4 -4
@@ -66,10 +66,10 @@ icmp_manip_pkt(struct sk_buff **pskb,return 0 ; hdr = (struct icmphdr *)((*pskb)->data + hdroff); - - hdr->checksum =ip_nat_cheat_check (hdr->un.echo.id ^0xFFFF , - tuple->src.u.icmp.id, - hdr->checksum); + hdr->checksum =nf_proto_csum_update (*pskb, + hdr->un.echo.id ^0xFFFF , + tuple->src.u.icmp.id, + hdr->checksum,0 ); hdr->un.echo.id = tuple->src.u.icmp.id;return 1 ; }
net/ipv4/netfilter/ip_nat_proto_tcp.c +3 -4
@@ -129,10 +129,9 @@ tcp_manip_pkt(struct sk_buff **pskb,if (hdrsize <sizeof (*hdr))return 1 ; - hdr->check =ip_nat_cheat_check (~oldip, newip, -ip_nat_cheat_check (oldport ^0xFFFF , - newport, - hdr->check)); + hdr->check =nf_proto_csum_update (*pskb, ~oldip, newip, hdr->check,1 ); + hdr->check =nf_proto_csum_update (*pskb, oldport ^0xFFFF , newport, + hdr->check,0 );return 1 ; }
net/ipv4/netfilter/ip_nat_proto_udp.c +8 -5
@@ -113,11 +113,14 @@ udp_manip_pkt(struct sk_buff **pskb, newport = tuple->dst.u.udp.port; portptr = &hdr->dest; } -if (hdr->check)/* 0 is a special case meaning no checksum */ - hdr->check =ip_nat_cheat_check (~oldip, newip, -ip_nat_cheat_check (*portptr ^0xFFFF , - newport, - hdr->check)); + +if (hdr->check) { + hdr->check =nf_proto_csum_update (*pskb, ~oldip, newip, + hdr->check,1 ); + hdr->check =nf_proto_csum_update (*pskb, + *portptr ^0xFFFF , newport, + hdr->check,0 ); + } *portptr = newport;return 1 ; }
net/ipv4/netfilter/ip_nat_standalone.c +0 -6
@@ -110,12 +110,6 @@ ip_nat_fn(unsigned int hooknum,IP_NF_ASSERT (!((*pskb)->nh.iph->frag_off &htons (IP_MF |IP_OFFSET ))); -/* If we had a hardware checksum before, it's now invalid */ -if ((*pskb)->ip_summed ==CHECKSUM_PARTIAL || - (*pskb)->ip_summed ==CHECKSUM_COMPLETE ) -if (skb_checksum_help (*pskb)) -return NF_DROP ; - ct =ip_conntrack_get (*pskb, &ctinfo);/* Can't track? It's not due to stress, or conntrack would have dropped it. Hence it's the user's responsibilty to
net/ipv4/netfilter/ipt_ECN.c +6 -13
@@ -52,7 +52,7 @@ static inline int set_ect_tcp(struct sk_buff **pskb, const struct ipt_ECN_info *einfo) { struct tcphdr _tcph, *tcph; -u_int16_t diffs[2 ]; +u_int16_t oldval;/* Not enought header? */ tcph = skb_header_pointer(*pskb, (*pskb)->nh.iph->ihl*4,
@@ -70,23 +70,16 @@ set_ect_tcp(struct sk_buff **pskb, constreturn 0 ; tcph = (void *)(*pskb)->nh.iph + (*pskb)->nh.iph->ihl*4 ; -if (((*pskb)->ip_summed ==CHECKSUM_PARTIAL || - (*pskb)->ip_summed ==CHECKSUM_COMPLETE ) && -skb_checksum_help (*pskb)) -return 0 ; - - diffs[0 ] = ((u_int16_t *)tcph)[6 ]; + oldval = ((u_int16_t *)tcph)[6 ];if (einfo->operation &IPT_ECN_OP_SET_ECE ) tcph->ece = einfo->proto.tcp.ece;if (einfo->operation &IPT_ECN_OP_SET_CWR ) tcph->cwr = einfo->proto.tcp.cwr; - diffs[1 ] = ((u_int16_t *)tcph)[6 ]; - diffs[0 ] = diffs[0 ] ^0xFFFF ; -if ((*pskb)->ip_summed !=CHECKSUM_UNNECESSARY ) - tcph->check =csum_fold (csum_partial ((char *)diffs, -sizeof (diffs), - tcph->check^0xFFFF )); + tcph->check =nf_proto_csum_update ((*pskb), + oldval ^0xFFFF , + ((u_int16_t *)tcph)[6 ], + tcph->check,0 );return 1 ; }
net/ipv4/netfilter/ipt_REJECT.c +1 -0
@@ -184,6 +184,7 @@ static void send_reset(struct sk_buff *o tcph->urg_ptr =0 ;/* Adjust TCP checksum */ + nskb->ip_summed =CHECKSUM_NONE ; tcph->check =0 ; tcph->check = tcp_v4_check(tcph, sizeof(struct tcphdr), nskb->nh.iph->saddr,
net/ipv4/netfilter/ipt_TCPMSS.c +16 -23
@@ -27,14 +27,6 @@ #else #define DEBUGP(format, args...)#endif -static u_int16_t -cheat_check (u_int32_t oldvalinv,u_int32_t newval,u_int16_t oldcheck) -{ -u_int32_t diffs[] = { oldvalinv, newval }; -return csum_fold (csum_partial ((char *)diffs,sizeof (diffs), - oldcheck^0xFFFF )); -} -static inline unsigned int optlen (const u_int8_t *opt,unsigned int offset) {
@@ -62,11 +54,6 @@ ipt_tcpmss_target(struct sk_buff **pskb,if (!skb_make_writable (pskb, (*pskb)->len))return NF_DROP ; -if (((*pskb)->ip_summed ==CHECKSUM_PARTIAL || - (*pskb)->ip_summed ==CHECKSUM_COMPLETE ) && -skb_checksum_help (*pskb)) -return NF_DROP ; - iph = (*pskb)->nh.iph; tcplen = (*pskb)->len - iph->ihl*4 ;
@@ -120,9 +107,10 @@ ipt_tcpmss_target(struct sk_buff **pskb, opt[i+2 ] = (newmss &0xff00 ) >>8 ; opt[i+3 ] = (newmss &0x00ff ); - tcph->check =cheat_check (htons (oldmss)^0xFFFF , -htons (newmss), - tcph->check); + tcph->check =nf_proto_csum_update (*pskb, +htons (oldmss)^0xFFFF , +htons (newmss), + tcph->check,0 );DEBUGP (KERN_INFO "ipt_tcpmss_target: %u.%u.%u.%u:%hu" "->%u.%u.%u.%u:%hu changed TCP MSS option"
@@ -162,8 +150,10 @@ ipt_tcpmss_target(struct sk_buff **pskb, opt = (u_int8_t *)tcph +sizeof (struct tcphdr );memmove (opt +TCPOLEN_MSS , opt, tcplen -sizeof (struct tcphdr )); - tcph->check =cheat_check (htons (tcplen) ^0xFFFF , -htons (tcplen +TCPOLEN_MSS ), tcph->check); + tcph->check =nf_proto_csum_update (*pskb, +htons (tcplen) ^0xFFFF , +htons (tcplen +TCPOLEN_MSS ), + tcph->check,1 ); tcplen +=TCPOLEN_MSS ; opt[0 ] =TCPOPT_MSS ;
@@ -171,16 +161,19 @@ ipt_tcpmss_target(struct sk_buff **pskb, opt[2 ] = (newmss &0xff00 ) >>8 ; opt[3 ] = (newmss &0x00ff ); - tcph->check =cheat_check (~0 , *((u_int32_t *)opt), tcph->check); + tcph->check =nf_proto_csum_update (*pskb, ~0 , *((u_int32_t *)opt), + tcph->check,0 ); oldval = ((u_int16_t *)tcph)[6 ]; tcph->doff +=TCPOLEN_MSS /4 ; - tcph->check =cheat_check (oldval ^0xFFFF , - ((u_int16_t *)tcph)[6 ], tcph->check); + tcph->check =nf_proto_csum_update (*pskb, + oldval ^0xFFFF , + ((u_int16_t *)tcph)[6 ], + tcph->check,0 ); newtotlen =htons (ntohs (iph->tot_len) +TCPOLEN_MSS ); - iph->check =cheat_check (iph->tot_len ^0xFFFF , - newtotlen, iph->check); + iph->check =nf_csum_update (iph->tot_len ^0xFFFF , + newtotlen, iph->check); iph->tot_len = newtotlen; DEBUGP(KERN_INFO "ipt_tcpmss_target: %u.%u.%u.%u:%hu"
net/netfilter/core.c +23 -0
@@ -222,6 +222,29 @@ copy_skb: }EXPORT_SYMBOL (skb_make_writable); +u_int16_t nf_csum_update (u_int32_t oldval,u_int32_t newval,u_int16_t csum) +{ +u_int32_t diff[] = { oldval, newval }; + +return csum_fold (csum_partial ((char *)diff,sizeof (diff), + csum ^0xFFFF )); +} +EXPORT_SYMBOL (nf_csum_update); + +u_int16_t nf_proto_csum_update (struct sk_buff *skb, +u_int32_t oldval,u_int32_t newval, +u_int16_t csum,int pseudohdr) +{ +if (skb->ip_summed !=CHECKSUM_PARTIAL ) { + csum =nf_csum_update (oldval, newval, csum); +if (skb->ip_summed ==CHECKSUM_COMPLETE && pseudohdr) + skb->csum =nf_csum_update (oldval, newval, skb->csum); + }else if (pseudohdr) + csum = ~nf_csum_update (oldval, newval, ~csum); + +return csum; +} +EXPORT_SYMBOL (nf_proto_csum_update);/* This does not belong here, but locally generated errors need it if connection tracking in use: without this, connection may not be in hash table, and hence
[NETFILTER]: nf_queue: handle GSO packets
Handle GSO packets in nf_queue by segmenting them before queueing to avoid breaking GSO in case they get mangled.
---
commit ab7d6d33680e994b1e4a559853b0447061c849ca
tree f86dd158fc30ffa300a45e6dd3418da065f00f93
parent 2d1b6c7500cd7b71a795976fe8eb3d2fd47cd39a
author Patrick McHardy <[email protected]> Mon, 31 Jul 2006 12:29:44 +0200 committer Patrick McHardy <[email protected]> Mon, 31 Jul 2006 12:29:44 +0200
net/netfilter/core.c | 2 + net/netfilter/nf_internals.h | 2 + net/netfilter/nf_queue.c | 76 ++++++++++++++++++++++++++++++++---------- 3 files changed, 60 insertions(+), 20 deletions(-)
net/netfilter/core.c +1 -1
@@ -182,7 +182,7 @@ next_hook: ret = -EPERM ; }else if ((verdict &NF_VERDICT_MASK ) ==NF_QUEUE ) {NFDEBUG ("nf_hook: Verdict = QUEUE.\n" ); -if (!nf_queue (pskb, elem, pf, hook, indev, outdev, okfn, +if (!nf_queue (*pskb, elem, pf, hook, indev, outdev, okfn, verdict >>NF_VERDICT_BITS )) goto next_hook; }
net/netfilter/nf_internals.h +1 -1
@@ -23,7 +23,7 @@ extern unsigned int nf_iterate(struct li int hook_thresh);/* nf_queue.c */ -extern int nf_queue(struct sk_buff **skb, +extern int nf_queue(struct sk_buff *skb, struct list_head *elem, int pf, unsigned int hook, struct net_device *indev,
net/netfilter/nf_queue.c +58 -18
129 lines not on this page · raw message
Herbert Xu
maintainerQuoted 6 lines · Patrick McHardy
These are the patches (some variantions tested, but not all) on top of Herbert's
CHECKSUM_PARTIALpatch. The first one fixes up theCHECKSUM_PARTIALpatch for 2.6.18-rc3, the second one fixes checksumming in all of netfilter besidesip_queue, the third one fixesip_queue.
Thank you very much for working on this Patrick!
Quoted 3 lines
Its actually not that much, if Herbert is fine with putting the
CHECKSUM_PARTIALpatch in 2.6.18 I'll do some more testing and then I think these can go in as well.
You guys know I'm a coward when it comes to pushing things into rc :)
So I'd rather see a patch to disable the warnings for 2.6.18 so that the proper fix can be tested more thoroughly. We should remember that the 2.6.18 minus the warning is still going to be heaps better in this regard compared to 2.6.17 where all TSO packets were essentially discarded due to the incorrect checksum (when the NAT module is loaded).
Quoted 3 lines
[NET]: Fix up
CHECKSUM_PARTIALpatch for 2.6.18-rc3Signed-off-by Patrick McHardy <[email protected]>
Please merge this with my earlier patch. I'm not that fussed about having my changeset go in :)
Quoted 5 lines
net/ipv4/netfilter/ip_nat_core.c +0
-0
net/ipv4/netfilter/ip_nat_core.c int ip_nat_icmp_reply_translation(struct · line 451
Quoted 10 lines
net/ipv4/netfilter/ip_nat_core.c +3
-1@@ -443,7 +443,9 @@ int ip_nat_icmp_reply_translation(struct/* We're actually going to mangle it beyond trivial checksum adjustment, so make sure the current checksum is correct. */ -if ((*pskb)->ip_summed !=CHECKSUM_UNNECESSARY ) { + +if ((*pskb)->ip_summed !=CHECKSUM_UNNECESSARY && + (*pskb)->ip_summed !=CHECKSUM_PARTIAL ) { hdrlen = (*pskb)->nh.iph->ihl *4 ;if ((u16 )csum_fold (skb_checksum (*pskb, hdrlen, (*pskb)->len - hdrlen,0 )))
Call me picky, but I'd prefer it to actually look like
switch ((*pskb)->ip_summed) {
case CHECKSUM_COMPLETE:
if (!(u16)csum_fold(skb->csum))
break;
/* fall through */
case CHECKSUM_NONE:
hdrlen = (*pskb)->nh.iph->ihl * 4;
if ((u16)csum_fold(skb_checksum(*pskb, hdrlen,
(*pskb)->len - hdrlen, 0)))
return 0;
}just because we probably won't revisit this code path for another million years to add this optimisation :)
Quoted 26 lines
net/ipv4/netfilter/ip_nat_helper.c +3
-4@@ -165,7 +165,7 @@ ip_nat_mangle_tcp_packet(struct sk_buff {struct iphdr *iph;struct tcphdr *tcph; -int datalen; +int oldlen, datalen;if (!skb_make_writable (pskb, (*pskb)->len))return 0 ;@@ -180,13 +180,22 @@ ip_nat_mangle_tcp_packet(struct sk_buff iph = (*pskb)->nh.iph; tcph = (void *)iph + iph->ihl*4 ; + oldlen = (*pskb)->len - iph->ihl*4 ;mangle_contents (*pskb, iph->ihl*4 + tcph->doff*4 , match_offset, match_len, rep_buffer, rep_len); datalen = (*pskb)->len - iph->ihl*4 ; - tcph->check =0 ; - tcph->check =tcp_v4_check (tcph, datalen, iph->saddr, iph->daddr, -csum_partial ((char *)tcph, datalen,0 )); +if ((*pskb)->ip_summed !=CHECKSUM_PARTIAL ) {
net/ipv4/netfilter/ip_nat_helper.c ip_nat_mangle_tcp_packet(struct sk_buff · line 198
Quoted 10 lines
net/ipv4/netfilter/ip_nat_helper.c +10
-0+ tcph->check =0 ; + tcph->check =tcp_v4_check (tcph, datalen, + iph->saddr, iph->daddr, +csum_partial ((char *)tcph, + datalen,0 )); + }else + tcph->check =nf_proto_csum_update (*pskb, +htons (oldlen) ^0xFFFF , +htons (datalen), + tcph->check,1 );
OK, this is so incredibly clever that I probably won't understand it until tomorrow :)
Quoted 9 lines
net/ipv4/netfilter/ip_nat_helper.c +2
-0@@ -238,22 +248,30 @@ ip_nat_mangle_udp_packet(struct sk_buff iph = (*pskb)->nh.iph; udph = (void *)iph + iph->ihl*4 ; + + oldlen = (*pskb)->len - iph->ihl*4 ;mangle_contents (*pskb, iph->ihl*4 +sizeof (*udph), match_offset, match_len, rep_buffer, rep_len);
net/ipv4/netfilter/ip_nat_helper.c ip_nat_mangle_udp_packet(struct sk_buff · line 262
Quoted 10 lines
net/ipv4/netfilter/ip_nat_helper.c +4
-3/* update the length of the UDP packet */ - udph->len =htons ((*pskb)->len - iph->ihl*4 ); + datalen = (*pskb)->len - iph->ihl*4 ; + udph->len =htons (datalen);/* fix udp checksum if udp checksum was previously calculated */ -if (udph->check) { -int datalen = (*pskb)->len - iph->ihl *4 ; +if (!udph->check) +return 1 ;
Just a quick thought, what if the partial checksum was zero?
I'm goint to review the rest of your patch tomorrow morning because I always fall sleep when looking at checksums :)
Cheers,
Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txtQuoted 7 lines · Herbert Xu
Quoted 3 lines · Patrick McHardy
Its actually not that much, if Herbert is fine with putting the
CHECKSUM_PARTIALpatch in 2.6.18 I'll do some more testing and then I think these can go in as well.
Quoted 7 lines
You guys know I'm a coward when it comes to pushing things into rc :)
So I'd rather see a patch to disable the warnings for 2.6.18 so that the proper fix can be tested more thoroughly. We should remember that the 2.6.18 minus the warning is still going to be heaps better in this regard compared to 2.6.17 where all TSO packets were essentially discarded due to the incorrect checksum (when the NAT module is loaded).
I'm fine either way.
Quoted 7 lines
Quoted 3 lines
[NET]: Fix up
CHECKSUM_PARTIALpatch for 2.6.18-rc3Signed-off-by Patrick McHardy <[email protected]>Please merge this with my earlier patch. I'm not that fussed about having my changeset go in :)
Done.
Quoted 31 lines
Quoted 5 lines
net/ipv4/netfilter/ip_nat_core.c +0
-0net/ipv4/netfilter/ip_nat_core.c int ip_nat_icmp_reply_translation(struct · line 451
Quoted 10 lines
net/ipv4/netfilter/ip_nat_core.c +3
-1@@ -443,7 +443,9 @@ int ip_nat_icmp_reply_translation(struct/* We're actually going to mangle it beyond trivial checksum adjustment, so make sure the current checksum is correct. */ -if ((*pskb)->ip_summed !=CHECKSUM_UNNECESSARY ) { + +if ((*pskb)->ip_summed !=CHECKSUM_UNNECESSARY && + (*pskb)->ip_summed !=CHECKSUM_PARTIAL ) { hdrlen = (*pskb)->nh.iph->ihl *4 ;if ((u16 )csum_fold (skb_checksum (*pskb, hdrlen, (*pskb)->len - hdrlen,0 )))Call me picky, but I'd prefer it to actually look like
switch ((*pskb)->ip_summed) { case CHECKSUM_COMPLETE: if (!(u16)csum_fold(skb->csum)) break; /* fall through */ case CHECKSUM_NONE: hdrlen = (*pskb)->nh.iph->ihl * 4; if ((u16)csum_fold(skb_checksum(*pskb, hdrlen, (*pskb)->len - hdrlen, 0))) return 0; }
Quoted 2 lines
just because we probably won't revisit this code path for another million years to add this optimisation :)
I've changed it to just use nf_ip_checksum instead (something I wanted to do in a follow-up patch to keep this one as small as possible). I'm also going to get rid of the remaining ip_nat_cheat_check copies (there are quite a few of them).
Quoted 18 lines
OK, this is so incredibly clever that I probably won't understand it until tomorrow :)
Quoted 14 lines
net/ipv4/netfilter/ip_nat_core.c +4
-1@@ -238,22 +248,30 @@ ip_nat_mangle_udp_packet(struct sk_buff iph = (*pskb)->nh.iph; udph = (void *)iph + iph->ihl*4 ; + + oldlen = (*pskb)->len - iph->ihl*4 ;mangle_contents (*pskb, iph->ihl*4 +sizeof (*udph), match_offset, match_len, rep_buffer, rep_len);/* update the length of the UDP packet */ - udph->len =htons ((*pskb)->len - iph->ihl*4 ); + datalen = (*pskb)->len - iph->ihl*4 ; + udph->len =htons (datalen);
Quoted 8 lines
net/ipv4/netfilter/ip_nat_core.c ip_nat_mangle_udp_packet(struct sk_buff · line 262
Quoted 5 lines
net/ipv4/netfilter/ip_nat_core.c +2
-2/* fix udp checksum if udp checksum was previously calculated */ -if (udph->check) { -int datalen = (*pskb)->len - iph->ihl *4 ; +if (!udph->check) +return 1 ;Just a quick thought, what if the partial checksum was zero?
Good point. I've fixed it to check for != CHECKSUM_PARTIAL here and in the UDP NAT helper and also changed it to use -1 when the newly calculated checksum is 0 so we don't accidentally turn off UDP checksumming.
Quoted 2 lines
I'm goint to review the rest of your patch tomorrow morning because I always fall sleep when looking at checksums :)
Same here, just woke up again :) New patches attached, with one additional fix: the ip_queue patch tried to free the wrong packet when queueing a generated segment failed.
I'm going to do some more testing now ..
[NET]: Replace CHECKSUM_HW by CHECKSUM_PARTIAL/CHECKSUM_COMPLETE
Replace CHECKSUM_HW by CHECKSUM_PARTIAL (for outgoing packets, whose checksum still needs to be completed) and CHECKSUM_COMPLETE (for incoming packets, device supplied full checksum).
Patch originally from Herbert Xu, updated by myself for 2.6.18-rc3.
---
commit 9e8ee86180aab5a225832c9772b2ad0e8a5c6006
tree 479e926c12606667a91d483223b4416da56227d5
parent b6ff50833ad43a8ebd9b16bf53c334f7aaf33c41
author Patrick McHardy <[email protected]> Mon, 31 Jul 2006 20:16:10 +0200 committer Patrick McHardy <[email protected]> Mon, 31 Jul 2006 20:16:10 +0200
drivers/atm/he.c | 2 +- drivers/net/3c59x.c | 2 +- drivers/net/8139cp.c | 6 +++--- drivers/net/acenic.c | 8 ++++---- drivers/net/bnx2.c | 2 +- drivers/net/cassini.c | 4 ++-- drivers/net/chelsio/sge.c | 10 +++++----- drivers/net/dl2k.c | 2 +- drivers/net/e1000/e1000_main.c | 8 ++++---- drivers/net/forcedeth.c | 3 ++- drivers/net/gianfar.c | 2 +- drivers/net/hamachi.c | 2 +- drivers/net/ibm_emac/ibm_emac_core.c | 2 +- drivers/net/ioc3-eth.c | 2 +- drivers/net/ixgb/ixgb_main.c | 2 +- drivers/net/mv643xx_eth.c | 2 +- drivers/net/myri10ge/myri10ge.c | 8 ++++---- drivers/net/ns83820.c | 2 +- drivers/net/r8169.c | 2 +- drivers/net/s2io.c | 2 +- drivers/net/sk98lin/skge.c | 6 +++--- drivers/net/skge.c | 4 ++-- drivers/net/sky2.c | 6 +++--- drivers/net/starfire.c | 6 +++--- drivers/net/sungem.c | 4 ++-- drivers/net/sunhme.c | 6 +++--- drivers/net/tg3.c | 6 +++--- drivers/net/typhoon.c | 2 +- drivers/net/via-rhine.c | 2 +- drivers/net/via-velocity.c | 2 +- include/linux/netdevice.h | 4 ++-- include/linux/skbuff.h | 17 +++++++++-------- net/core/datagram.c | 4 ++-- net/core/dev.c | 12 ++++++------ net/core/netpoll.c | 2 +- net/core/skbuff.c | 14 +++++++------- net/ipv4/icmp.c | 2 +- net/ipv4/igmp.c | 2 +- net/ipv4/ip_fragment.c | 2 +- net/ipv4/ip_gre.c | 4 ++-- net/ipv4/ip_output.c | 6 +++--- net/ipv4/ipvs/ip_vs_proto_tcp.c | 8 ++++---- net/ipv4/ipvs/ip_vs_proto_udp.c | 8 ++++---- net/ipv4/netfilter.c | 2 +- net/ipv4/netfilter/ip_conntrack_proto_tcp.c | 3 +-- net/ipv4/netfilter/ip_conntrack_proto_udp.c | 3 +-- net/ipv4/netfilter/ip_nat_standalone.c | 5 +++-- net/ipv4/netfilter/ip_queue.c | 6 +++--- net/ipv4/netfilter/ipt_ECN.c | 9 +++++---- net/ipv4/netfilter/ipt_TCPMSS.c | 5 +++-- net/ipv4/tcp.c | 8 ++++---- net/ipv4/tcp_ipv4.c | 6 +++--- net/ipv4/tcp_output.c | 18 ++++++++---------- net/ipv4/udp.c | 6 +++--- net/ipv4/xfrm4_output.c | 4 ++-- net/ipv6/exthdrs.c | 2 +- net/ipv6/icmp.c | 2 +- net/ipv6/ip6_output.c | 2 +- net/ipv6/netfilter.c | 2 +- net/ipv6/netfilter/ip6_queue.c | 6 +++--- net/ipv6/netfilter/nf_conntrack_reasm.c | 6 +++--- net/ipv6/raw.c | 2 +- net/ipv6/reassembly.c | 6 +++--- net/ipv6/tcp_ipv6.c | 6 +++--- net/ipv6/udp.c | 2 +- net/ipv6/xfrm6_output.c | 4 ++-- net/netfilter/nf_conntrack_proto_tcp.c | 3 +-- net/netfilter/nf_conntrack_proto_udp.c | 3 +-- net/netfilter/nfnetlink_queue.c | 6 +++--- net/packet/af_packet.c | 2 +- net/sched/sch_netem.c | 4 ++-- net/sunrpc/socklib.c | 2 +- 72 files changed, 168 insertions(+), 169 deletions(-)
drivers/atm/he.c +1 -1
@@ -1912,7 +1912,7 @@ #endif skb->tail = skb->data + skb->len;#ifdef USE_CHECKSUM_HW if (vcc->vpi ==0 && vcc->vci >=ATM_NOT_RSV_VCI ) { - skb->ip_summed =CHECKSUM_HW ; + skb->ip_summed =CHECKSUM_COMPLETE ; skb->csum =TCP_CKSUM (skb->data, he_vcc->pdu_len); }
drivers/net/3c59x.c +1 -1
@@ -2077,7 +2077,7 @@ boomerang_start_xmit(struct sk_buff *skb vp->tx_ring[entry].next =0 ;#if DO_ZEROCOPY -if (skb->ip_summed !=CHECKSUM_HW ) +if (skb->ip_summed !=CHECKSUM_PARTIAL ) vp->tx_ring[entry].status =cpu_to_le32 (skb->len | TxIntrUploaded);else vp->tx_ring[entry].status =cpu_to_le32 (skb->len | TxIntrUploaded | AddTCPChksum | AddUDPChksum);
drivers/net/8139cp.c +3 -3
@@ -813,7 +813,7 @@ #endifif (mss) flags |= LargeSend | ((mss & MSSMask) << MSSShift); -else if (skb->ip_summed ==CHECKSUM_HW ) { +else if (skb->ip_summed ==CHECKSUM_PARTIAL ) {const struct iphdr *ip = skb->nh.iph;if (ip->protocol ==IPPROTO_TCP ) flags |=IPCS |TCPCS ;
@@ -867,7 +867,7 @@ #endifif (mss) ctrl |= LargeSend | ((mss & MSSMask) << MSSShift); -else if (skb->ip_summed ==CHECKSUM_HW ) { +else if (skb->ip_summed ==CHECKSUM_PARTIAL ) {if (ip->protocol ==IPPROTO_TCP ) ctrl |=IPCS |TCPCS ;else if (ip->protocol ==IPPROTO_UDP )
@@ -898,7 +898,7 @@ #endif txd->addr =cpu_to_le64 (first_mapping);wmb (); -if (skb->ip_summed ==CHECKSUM_HW ) { +if (skb->ip_summed ==CHECKSUM_PARTIAL ) {if (ip->protocol ==IPPROTO_TCP ) txd->opts1 = cpu_to_le32(first_eor | first_len | FirstFrag | DescOwn |
drivers/net/acenic.c +4 -4
@@ -2040,7 +2040,7 @@ static void ace_rx_int(struct net_device*/ if (bd_flags &BD_FLG_TCP_UDP_SUM ) { skb->csum =htons (csum); - skb->ip_summed =CHECKSUM_HW ; + skb->ip_summed =CHECKSUM_COMPLETE ; }else { skb->ip_summed =CHECKSUM_NONE ; }
@@ -2511,7 +2511,7 @@ restart: mapping =ace_map_tx_skb (ap, skb, skb, idx); flagsize = (skb->len <<16 ) | (BD_FLG_END ); -if (skb->ip_summed ==CHECKSUM_HW ) +if (skb->ip_summed ==CHECKSUM_PARTIAL ) flagsize |=BD_FLG_TCP_UDP_SUM ;#if ACENIC_DO_VLAN if (vlan_tx_tag_present (skb)) {
@@ -2534,7 +2534,7 @@ #endif mapping =ace_map_tx_skb (ap, skb,NULL , idx); flagsize = (skb_headlen (skb) <<16 ); -if (skb->ip_summed ==CHECKSUM_HW ) +if (skb->ip_summed ==CHECKSUM_PARTIAL ) flagsize |=BD_FLG_TCP_UDP_SUM ;#if ACENIC_DO_VLAN if (vlan_tx_tag_present (skb)) {
@@ -2560,7 +2560,7 @@ #endif PCI_DMA_TODEVICE); flagsize = (frag->size <<16 ); -if (skb->ip_summed ==CHECKSUM_HW ) +if (skb->ip_summed ==CHECKSUM_PARTIAL ) flagsize |=BD_FLG_TCP_UDP_SUM ; idx = (idx +1 ) %ACE_TX_RING_ENTRIES (ap);
drivers/net/bnx2.c +1 -1
@@ -4418,7 +4418,7 @@ bnx2_start_xmit(struct sk_buff *skb, str ring_prod =TX_RING_IDX (prod); vlan_tag_flags =0 ; -if (skb->ip_summed ==CHECKSUM_HW ) { +if (skb->ip_summed ==CHECKSUM_PARTIAL ) { vlan_tag_flags |=TX_BD_FLAGS_TCP_UDP_CKSUM ; }
drivers/net/cassini.c +2 -2
@@ -2167,7 +2167,7 @@ end_copy_pkt:cas_page_unmap (addr); } skb->csum =ntohs (i ^0xffff ); - skb->ip_summed =CHECKSUM_HW ; + skb->ip_summed =CHECKSUM_COMPLETE ; skb->protocol =eth_type_trans (skb, cp->dev);return len; }
@@ -2821,7 +2821,7 @@ static inline int cas_xmit_tx_ringN(stru } ctrl =0 ; -if (skb->ip_summed ==CHECKSUM_HW ) { +if (skb->ip_summed ==CHECKSUM_PARTIAL ) {u64 csum_start_off, csum_stuff_off; csum_start_off = (u64) (skb->h.raw - skb->data);
drivers/net/chelsio/sge.c +5 -5
@@ -1470,9 +1470,9 @@ #endif }if (!(adapter->flags &UDP_CSUM_CAPABLE ) && - skb->ip_summed ==CHECKSUM_HW && + skb->ip_summed ==CHECKSUM_PARTIAL && skb->nh.iph->protocol ==IPPROTO_UDP ) -if (unlikely (skb_checksum_help (skb,0 ))) { +if (unlikely (skb_checksum_help (skb))) {dev_kfree_skb_any (skb);return NETDEV_TX_OK ; }
@@ -1495,11 +1495,11 @@ #endif cpl = (struct cpl_tx_pkt *)__skb_push (skb,sizeof (*cpl)); cpl->opcode =CPL_TX_PKT ; cpl->ip_csum_dis =1 ;/* SW calculates IP csum */ - cpl->l4_csum_dis = skb->ip_summed ==CHECKSUM_HW ?0 :1 ; + cpl->l4_csum_dis = skb->ip_summed ==CHECKSUM_PARTIAL ?0 :1 ;/* the length field isn't used so don't bother setting it */ - st->tx_cso += (skb->ip_summed ==CHECKSUM_HW ); - sge->stats.tx_do_cksum += (skb->ip_summed ==CHECKSUM_HW ); + st->tx_cso += (skb->ip_summed ==CHECKSUM_PARTIAL ); + sge->stats.tx_do_cksum += (skb->ip_summed ==CHECKSUM_PARTIAL ); sge->stats.tx_reg_pkts++; } cpl->iff = dev->if_port;
drivers/net/dl2k.c +1 -1
@@ -611,7 +611,7 @@ start_xmit (struct sk_buff *skb, struct txdesc = &np->tx_ring[entry];#if 0 -if (skb->ip_summed ==CHECKSUM_HW ) { +if (skb->ip_summed ==CHECKSUM_PARTIAL ) { txdesc->status |=cpu_to_le64 (TCPChecksumEnable | UDPChecksumEnable | IPChecksumEnable);
drivers/net/e1000/e1000_main.c +4 -4
@@ -2600,7 +2600,7 @@ e1000_tx_csum(struct e1000_adapter *adapunsigned int i;uint8_t css; -if (likely (skb->ip_summed ==CHECKSUM_HW )) { +if (likely (skb->ip_summed ==CHECKSUM_PARTIAL )) { css = skb->h.raw - skb->data; i = tx_ring->next_to_use;
@@ -2927,11 +2927,11 @@ #ifdef NETIF_F_TSO }/* reserve a descriptor for the offload context */ -if ((mss) || (skb->ip_summed ==CHECKSUM_HW )) +if ((mss) || (skb->ip_summed ==CHECKSUM_PARTIAL )) count++; count++;#else -if (skb->ip_summed ==CHECKSUM_HW ) +if (skb->ip_summed ==CHECKSUM_PARTIAL ) count++;#endif
@@ -3608,7 +3608,7 @@ e1000_rx_checksum(struct e1000_adapter **/ csum =ntohl (csum ^0xFFFF ); skb->csum = csum; - skb->ip_summed =CHECKSUM_HW ; + skb->ip_summed =CHECKSUM_COMPLETE ; } adapter->hw_csum_good++; }
drivers/net/forcedeth.c +2 -1
@@ -1503,7 +1503,8 @@ #ifdef NETIF_F_TSO tx_flags_extra =NV_TX2_TSO | (skb_shinfo (skb)->gso_size <<NV_TX2_TSO_SHIFT ); else#endif - tx_flags_extra = (skb->ip_summed ==CHECKSUM_HW ? (NV_TX2_CHECKSUM_L3 |NV_TX2_CHECKSUM_L4 ) :0 ); + tx_flags_extra = skb->ip_summed ==CHECKSUM_PARTIAL ? +NV_TX2_CHECKSUM_L3 |NV_TX2_CHECKSUM_L4 :0 ;/* vlan tag */ if (np->vlangrp &&vlan_tx_tag_present (skb)) {
drivers/net/gianfar.c +1 -1
@@ -947,7 +947,7 @@ static int gfar_start_xmit(struct sk_buf/* Set up checksumming */ if (likely ((dev->features &NETIF_F_IP_CSUM ) - && (CHECKSUM_HW == skb->ip_summed))) { + && (CHECKSUM_PARTIAL == skb->ip_summed))) { fcb =gfar_add_fcb (skb, txbdp); status |=TXBD_TOE ;gfar_tx_checksum (skb, fcb);
drivers/net/hamachi.c +1 -1
@@ -1648,7 +1648,7 @@ #ifdef RX_CHECKSUM* could do the pseudo myself and return * CHECKSUM_UNNECESSARY */ - skb->ip_summed =CHECKSUM_HW ; + skb->ip_summed =CHECKSUM_COMPLETE ; } } }
drivers/net/ibm_emac/ibm_emac_core.c +1 -1
@@ -1036,7 +1036,7 @@ static inline u16 emac_tx_csum(struct oc struct sk_buff *skb) {#if defined(CONFIG_IBM_EMAC_TAH ) -if (skb->ip_summed ==CHECKSUM_HW ) { +if (skb->ip_summed ==CHECKSUM_PARTIAL ) { ++dev->stats.tx_packets_csum;return EMAC_TX_CTRL_TAH_CSUM ; }
drivers/net/ioc3-eth.c +1 -1
@@ -1387,7 +1387,7 @@ #ifdef CONFIG_SGI_IOC3_ETH_HW_TX_CSUM* MAC header which should not be summed and the TCP/UDP pseudo headers * manually. */ -if (skb->ip_summed ==CHECKSUM_HW ) { +if (skb->ip_summed ==CHECKSUM_PARTIAL ) {int proto =ntohs (skb->nh.iph->protocol);unsigned int csoff;struct iphdr *ih = skb->nh.iph;
drivers/net/ixgb/ixgb_main.c +1 -1
@@ -1232,7 +1232,7 @@ ixgb_tx_csum(struct ixgb_adapter *adapteunsigned int i;uint8_t css, cso; -if (likely (skb->ip_summed ==CHECKSUM_HW )) { +if (likely (skb->ip_summed ==CHECKSUM_PARTIAL )) { css = skb->h.raw - skb->data; cso = (skb->h.raw + skb->csum) - skb->data;
drivers/net/mv643xx_eth.c +1 -1
@@ -1145,7 +1145,7 @@ static void eth_tx_submit_descs_for_skb( desc->byte_cnt = length; desc->buf_ptr =dma_map_single (NULL , skb->data, length,DMA_TO_DEVICE ); -if (skb->ip_summed ==CHECKSUM_HW ) { +if (skb->ip_summed ==CHECKSUM_PARTIAL ) {BUG_ON (skb->protocol !=ETH_P_IP ); cmd_sts |= ETH_GEN_TCP_UDP_CHECKSUM |
drivers/net/myri10ge/myri10ge.c +4 -4
@@ -934,7 +934,7 @@ static inline void myri10ge_vlan_ip_csum (vh->h_vlan_encapsulated_proto == htons(ETH_P_IP) || vh->h_vlan_encapsulated_proto == htons(ETH_P_IPV6))) { skb->csum = hw_csum; - skb->ip_summed =CHECKSUM_HW ; + skb->ip_summed =CHECKSUM_COMPLETE ; } }
@@ -977,7 +977,7 @@ myri10ge_rx_done(struct myri10ge_priv *mif ((skb->protocol ==ntohs (ETH_P_IP )) || (skb->protocol ==ntohs (ETH_P_IPV6 ))) { skb->csum =ntohs ((u16 ) csum); - skb->ip_summed =CHECKSUM_HW ; + skb->ip_summed =CHECKSUM_COMPLETE ; }else myri10ge_vlan_ip_csum (skb,ntohs ((u16 ) csum)); }
@@ -1901,13 +1901,13 @@ #endif /*NETIF_F_TSO */ pseudo_hdr_offset =0 ; odd_flag =0 ; flags = (MXGEFW_FLAGS_NO_TSO |MXGEFW_FLAGS_FIRST ); -if (likely (skb->ip_summed ==CHECKSUM_HW )) { +if (likely (skb->ip_summed ==CHECKSUM_PARTIAL )) { cksum_offset = (skb->h.raw - skb->data); pseudo_hdr_offset = (skb->h.raw + skb->csum) - skb->data;/* If the headers are excessively large, then we must * fall back to a software checksum */ if (unlikely (cksum_offset >255 || pseudo_hdr_offset >127 )) { -if (skb_checksum_help (skb,0 )) +if (skb_checksum_help (skb)) goto drop; cksum_offset =0 ; pseudo_hdr_offset =0 ;
drivers/net/ns83820.c +1 -1
@@ -1153,7 +1153,7 @@ again:if (!nr_frags) frag =NULL ; extsts =0 ; -if (skb->ip_summed ==CHECKSUM_HW ) { +if (skb->ip_summed ==CHECKSUM_PARTIAL ) { extsts |=EXTSTS_IPPKT ;if (IPPROTO_TCP == skb->nh.iph->protocol) extsts |=EXTSTS_TCPPKT ;
drivers/net/r8169.c +1 -1
@@ -2169,7 +2169,7 @@ static inline u32 rtl8169_tso_csum(strucif (mss)return LargeSend | ((mss & MSSMask) << MSSShift); } -if (skb->ip_summed ==CHECKSUM_HW ) { +if (skb->ip_summed ==CHECKSUM_PARTIAL ) {const struct iphdr *ip = skb->nh.iph;if (ip->protocol ==IPPROTO_TCP )
drivers/net/s2io.c +1 -1
@@ -3871,7 +3871,7 @@ #ifdef NETIF_F_TSO txdp->Control_1 |= TXD_TCP_LSO_MSS(mss); }#endif -if (skb->ip_summed ==CHECKSUM_HW ) { +if (skb->ip_summed ==CHECKSUM_PARTIAL ) { txdp->Control_2 |= (TXD_TX_CKO_IPV4_EN |TXD_TX_CKO_TCP_EN |TXD_TX_CKO_UDP_EN );
drivers/net/sk98lin/skge.c +3 -3
@@ -1559,7 +1559,7 @@ #endif pTxd->VDataHigh = (SK_U32 ) (PhysAddr >>32 ); pTxd->pMBuf = pMessage; -if (pMessage->ip_summed ==CHECKSUM_HW ) { +if (pMessage->ip_summed ==CHECKSUM_PARTIAL ) {u16 hdrlen = pMessage->h.raw - pMessage->data;u16 offset = hdrlen + pMessage->csum;
@@ -1678,7 +1678,7 @@ #endif/* ** Does the HW need to evaluate checksum for TCP or UDP packets? */ -if (pMessage->ip_summed ==CHECKSUM_HW ) { +if (pMessage->ip_summed ==CHECKSUM_PARTIAL ) {u16 hdrlen = pMessage->h.raw - pMessage->data;u16 offset = hdrlen + pMessage->csum;
@@ -2158,7 +2158,7 @@ #endif#ifdef USE_SK_RX_CHECKSUM pMsg->csum = pRxd->TcpSums &0xffff ; - pMsg->ip_summed =CHECKSUM_HW ; + pMsg->ip_summed =CHECKSUM_COMPLETE ;#else pMsg->ip_summed =CHECKSUM_NONE ;#endif
drivers/net/skge.c +2 -2
@@ -2336,7 +2336,7 @@ static int skge_xmit_frame(struct sk_buf td->dma_lo = map; td->dma_hi = map >>32 ; -if (skb->ip_summed ==CHECKSUM_HW ) { +if (skb->ip_summed ==CHECKSUM_PARTIAL ) {int offset = skb->h.raw - skb->data;/* This seems backwards, but it is what the sk98lin
@@ -2640,7 +2640,7 @@ static inline struct sk_buff *skge_rx_ge skb->dev = skge->netdev;if (skge->rx_csum) { skb->csum = csum; - skb->ip_summed =CHECKSUM_HW ; + skb->ip_summed =CHECKSUM_COMPLETE ; } skb->protocol =eth_type_trans (skb, skge->netdev);
drivers/net/sky2.c +3 -3
@@ -1164,7 +1164,7 @@ static unsigned tx_le_req(const struct sif (skb_is_gso (skb)) ++count; -if (skb->ip_summed ==CHECKSUM_HW ) +if (skb->ip_summed ==CHECKSUM_PARTIAL ) ++count;return count;
@@ -1273,7 +1273,7 @@ #ifdef SKY2_VLAN_TAG_USED#endif /* Handle TCP checksum offload */ -if (skb->ip_summed ==CHECKSUM_HW ) { +if (skb->ip_summed ==CHECKSUM_PARTIAL ) {u16 hdr = skb->h.raw - skb->data;u16 offset = hdr + skb->csum;
@@ -2001,7 +2001,7 @@ #ifdef SKY2_VLAN_TAG_USED#endif case OP_RXCHKS : skb = sky2->rx_ring[sky2->rx_next].skb; - skb->ip_summed =CHECKSUM_HW ; + skb->ip_summed =CHECKSUM_COMPLETE ; skb->csum =le16_to_cpu (status);break ;
drivers/net/starfire.c +3 -3
@@ -1230,7 +1230,7 @@ static int start_tx(struct sk_buff *skb, }#if defined(ZEROCOPY ) && defined(HAS_BROKEN_FIRMWARE ) -if (skb->ip_summed ==CHECKSUM_HW ) { +if (skb->ip_summed ==CHECKSUM_PARTIAL ) {if (skb_padto (skb, (skb->len +PADDING_MASK ) & ~PADDING_MASK ))return NETDEV_TX_OK ; }
@@ -1252,7 +1252,7 @@ #endif /* ZEROCOPY && HAS_BROKEN_FIRMWAR status |= TxDescIntr; np->reap_tx =0 ; } -if (skb->ip_summed ==CHECKSUM_HW ) { +if (skb->ip_summed ==CHECKSUM_PARTIAL ) { status |= TxCalTCP; np->stats.tx_compressed++; }
@@ -1499,7 +1499,7 @@ #endif* Until then, the printk stays. :-) -Ion */ else if (le16_to_cpu(desc->status2) & 0x0040) { - skb->ip_summed =CHECKSUM_HW ; + skb->ip_summed =CHECKSUM_COMPLETE ; skb->csum =le16_to_cpu (desc->csum);printk (KERN_DEBUG "%s: checksum_hw, status2 = %#x\n" , dev->name,le16_to_cpu (desc->status2)); }
drivers/net/sungem.c +2 -2
@@ -855,7 +855,7 @@ static int gem_rx(struct gem *gp, int wo } skb->csum =ntohs ((status &RXDCTRL_TCPCSUM ) ^0xffff ); - skb->ip_summed =CHECKSUM_HW ; + skb->ip_summed =CHECKSUM_COMPLETE ; skb->protocol =eth_type_trans (skb, gp->dev);netif_receive_skb (skb);
@@ -1026,7 +1026,7 @@ static int gem_start_xmit(struct sk_buffunsigned long flags; ctrl =0 ; -if (skb->ip_summed ==CHECKSUM_HW ) { +if (skb->ip_summed ==CHECKSUM_PARTIAL ) {u64 csum_start_off, csum_stuff_off; csum_start_off = (u64) (skb->h.raw - skb->data);
drivers/net/sunhme.c +3 -3
@@ -1207,7 +1207,7 @@ static void happy_meal_transceiver_check* flags, thus: * * skb->csum = rxd->rx_flags & 0xffff; -* skb->ip_summed = CHECKSUM_HW; +* skb->ip_summed = CHECKSUM_COMPLETE; * * before sending off the skb to the protocols, and we are good as gold. */
@@ -2074,7 +2074,7 @@ static void happy_meal_rx(struct happy_m/* This card is _fucking_ hot... */ skb->csum =ntohs (csum ^0xffff ); - skb->ip_summed =CHECKSUM_HW ; + skb->ip_summed =CHECKSUM_COMPLETE ;RXD (("len=%d csum=%4x]" , len, csum)); skb->protocol =eth_type_trans (skb, dev);
@@ -2268,7 +2268,7 @@ static int happy_meal_start_xmit(structu32 tx_flags; tx_flags =TXFLAG_OWN ; -if (skb->ip_summed ==CHECKSUM_HW ) { +if (skb->ip_summed ==CHECKSUM_PARTIAL ) {u32 csum_start_off, csum_stuff_off; csum_start_off = (u32) (skb->h.raw - skb->data);
drivers/net/tg3.c +3 -3
@@ -3841,11 +3841,11 @@ #if TG3_TSO_SUPPORT != 0 skb->h.th->check = 0; } -else if (skb->ip_summed ==CHECKSUM_HW ) +else if (skb->ip_summed ==CHECKSUM_PARTIAL ) base_flags |=TXD_FLAG_TCPUDP_CSUM ;#else mss =0 ; -if (skb->ip_summed ==CHECKSUM_HW ) +if (skb->ip_summed ==CHECKSUM_PARTIAL ) base_flags |=TXD_FLAG_TCPUDP_CSUM ;#endif #if TG3_VLAN_TAG_USED
@@ -3973,7 +3973,7 @@ static int tg3_start_xmit_dma_bug(struct entry = tp->tx_prod; base_flags =0 ; -if (skb->ip_summed ==CHECKSUM_HW ) +if (skb->ip_summed ==CHECKSUM_PARTIAL ) base_flags |=TXD_FLAG_TCPUDP_CSUM ;#if TG3_TSO_SUPPORT !=0 mss =0 ;
drivers/net/typhoon.c +1 -1
@@ -830,7 +830,7 @@ typhoon_start_tx(struct sk_buff *skb, st first_txd->addrHi = (u64)((unsigned long ) skb) >>32 ; first_txd->processFlags =0 ; -if (skb->ip_summed ==CHECKSUM_HW ) { +if (skb->ip_summed ==CHECKSUM_PARTIAL ) {/* The 3XP will figure out if this is UDP/TCP */ first_txd->processFlags |=TYPHOON_TX_PF_TCP_CHKSUM ; first_txd->processFlags |=TYPHOON_TX_PF_UDP_CHKSUM ;
drivers/net/via-rhine.c +1 -1
@@ -1185,7 +1185,7 @@ static int rhine_start_tx(struct sk_buff rp->tx_skbuff[entry] = skb;if ((rp->quirks & rqRhineI) && - (((unsigned long )skb->data &3 ) ||skb_shinfo (skb)->nr_frags !=0 || skb->ip_summed ==CHECKSUM_HW )) { + (((unsigned long )skb->data &3 ) ||skb_shinfo (skb)->nr_frags !=0 || skb->ip_summed ==CHECKSUM_PARTIAL )) {/* Must use alignment buffer. */ if (skb->len >PKT_BUF_SZ ) {/* packet too long, drop it */
drivers/net/via-velocity.c +1 -1
@@ -2002,7 +2002,7 @@ #endif* Handle hardware checksum */ if ((vptr->flags &VELOCITY_FLAGS_TX_CSUM ) - && (skb->ip_summed ==CHECKSUM_HW )) { + && (skb->ip_summed ==CHECKSUM_PARTIAL )) {struct iphdr *ip = skb->nh.iph;if (ip->protocol ==IPPROTO_TCP ) td_ptr->tdesc1.TCR |=TCR0_TCPCK ;
include/linux/netdevice.h +2 -2
@@ -973,7 +973,7 @@ extern void dev_mcast_init(void);extern int netdev_max_backlog;extern int weight_p;extern int netdev_set_master (struct net_device *dev,struct net_device *master); -extern int skb_checksum_help (struct sk_buff *skb,int inward); +extern int skb_checksum_help (struct sk_buff *skb);extern struct sk_buff *skb_gso_segment (struct sk_buff *skb,int features);#ifdef CONFIG_BUG extern void netdev_rx_csum_fault (struct net_device *dev);
@@ -1009,7 +1009,7 @@ static inline int netif_needs_gso(struct {return skb_is_gso (skb) && (!skb_gso_ok (skb, dev->features) || -unlikely (skb->ip_summed !=CHECKSUM_HW )); +unlikely (skb->ip_summed !=CHECKSUM_PARTIAL )); }#endif /* __KERNEL__ */
include/linux/skbuff.h +9 -8
@@ -34,8 +34,9 @@ #define HAVE_ALLOC_SKB /* For the drive#define HAVE_ALIGNABLE_SKB /* Ditto 8) */ #define CHECKSUM_NONE 0 -#define CHECKSUM_HW 1 +#define CHECKSUM_PARTIAL 1#define CHECKSUM_UNNECESSARY 2 +#define CHECKSUM_COMPLETE 3#define SKB_DATA_ALIGN (X ) (((X) + (SMP_CACHE_BYTES - 1)) & \ ~(SMP_CACHE_BYTES - 1))
@@ -56,17 +57,17 @@ #define SKB_MAX_ALLOC (SKB_MAX_ORDER(0,* Apparently with secret goal to sell you new device, when you * will add new protocol to your host. F.e. IPv6. 8) * -* HW: the most generic way. Device supplied checksum of _all_ +* COMPLETE: the most generic way. Device supplied checksum of _all_ * the packet as seen by netif_rx in skb->csum. * NOTE: Even if device supports only some protocols, but -* is able to produce some skb->csum, it MUST use HW, +* is able to produce some skb->csum, it MUST use COMPLETE, * not UNNECESSARY. * * B. Checksumming on output. * * NONE: skb is checksummed by protocol or csum is not required. * -* HW: device is required to csum packet as seen by hard_start_xmit +* PARTIAL: device is required to csum packet as seen by hard_start_xmit * from skb->h.raw to the end and to record the checksum * at skb->h.raw+skb->csum. *
@@ -1219,14 +1220,14 @@ static inline int skb_linearize_cow(stru* @len: length of data pulled * * After doing a pull on a received packet, you need to call this to -* update the CHECKSUM_HW checksum, or set ip_summed to CHECKSUM_NONE -* so that it can be recomputed from scratch. +* update the CHECKSUM_COMPLETE checksum, or set ip_summed to +* CHECKSUM_NONE so that it can be recomputed from scratch. */ static inline void skb_postpull_rcsum (struct sk_buff *skb,const void *start,unsigned int len) { -if (skb->ip_summed ==CHECKSUM_HW ) +if (skb->ip_summed ==CHECKSUM_COMPLETE ) skb->csum =csum_sub (skb->csum,csum_partial (start, len,0 )); }
@@ -1245,7 +1246,7 @@ static inline int pskb_trim_rcsum(struct {if (likely (len >= skb->len))return 0 ; -if (skb->ip_summed ==CHECKSUM_HW ) +if (skb->ip_summed ==CHECKSUM_COMPLETE ) skb->ip_summed =CHECKSUM_NONE ;return __pskb_trim (skb, len); }
net/core/datagram.c +2 -2
@@ -417,7 +417,7 @@ unsigned int __skb_checksum_complete(str sum = (u16 )csum_fold (skb_checksum (skb,0 , skb->len, skb->csum));if (likely (!sum)) { -if (unlikely (skb->ip_summed ==CHECKSUM_HW )) +if (unlikely (skb->ip_summed ==CHECKSUM_COMPLETE ))netdev_rx_csum_fault (skb->dev); skb->ip_summed =CHECKSUM_UNNECESSARY ; }
@@ -462,7 +462,7 @@ int skb_copy_and_csum_datagram_iovec(str goto fault;if ((unsigned short )csum_fold (csum)) goto csum_error; -if (unlikely (skb->ip_summed ==CHECKSUM_HW )) +if (unlikely (skb->ip_summed ==CHECKSUM_COMPLETE ))netdev_rx_csum_fault (skb->dev); iov->iov_len -= chunk; iov->iov_base += chunk;
net/core/dev.c +6 -6
@@ -1157,12 +1157,12 @@ EXPORT_SYMBOL(netif_device_attach);* Invalidate hardware checksum when packet is to be mangled, and * complete checksum manually on outgoing path. */ -int skb_checksum_help (struct sk_buff *skb,int inward) +int skb_checksum_help (struct sk_buff *skb) {unsigned int csum;int ret =0 , offset = skb->h.raw - skb->data; -if (inward) +if (skb->ip_summed ==CHECKSUM_COMPLETE ) goto out_set_summed;if (unlikely (skb_shinfo (skb)->gso_size)) {
@@ -1219,7 +1219,7 @@ struct sk_buff *skb_gso_segment(struct s skb->mac_len = skb->nh.raw - skb->data;__skb_pull (skb, skb->mac_len); -if (unlikely (skb->ip_summed !=CHECKSUM_HW )) { +if (unlikely (skb->ip_summed !=CHECKSUM_PARTIAL )) {static int warned;WARN_ON (!warned);
@@ -1233,7 +1233,7 @@ struct sk_buff *skb_gso_segment(struct srcu_read_lock ();list_for_each_entry_rcu (ptype, &ptype_base[ntohs (type) &15 ], list) {if (ptype->type == type && !ptype->dev && ptype->gso_segment) { -if (unlikely (skb->ip_summed !=CHECKSUM_HW )) { +if (unlikely (skb->ip_summed !=CHECKSUM_PARTIAL )) { err = ptype->gso_send_check (skb); segs =ERR_PTR (err);if (err ||skb_gso_ok (skb, features))
@@ -1445,11 +1445,11 @@ int dev_queue_xmit(struct sk_buff *skb)/* If packet is not checksummed and device does not support * checksumming for this protocol, complete checksumming here. */ -if (skb->ip_summed ==CHECKSUM_HW && +if (skb->ip_summed ==CHECKSUM_PARTIAL && (!(dev->features &NETIF_F_GEN_CSUM ) && (!(dev->features &NETIF_F_IP_CSUM ) || skb->protocol !=htons (ETH_P_IP )))) -if (skb_checksum_help (skb,0 )) +if (skb_checksum_help (skb)) goto out_kfree_skb; gso:
net/core/netpoll.c +1 -1
@@ -110,7 +110,7 @@ static int checksum_udp(struct sk_buff * psum =csum_tcpudp_nofold (saddr, daddr, ulen,IPPROTO_UDP ,0 ); -if (skb->ip_summed ==CHECKSUM_HW && +if (skb->ip_summed ==CHECKSUM_COMPLETE && !(u16 )csum_fold (csum_add (psum, skb->csum)))return 0 ;
net/core/skbuff.c +7 -7
@@ -1373,7 +1373,7 @@ void skb_copy_and_csum_dev(const structunsigned int csum;long csstart; -if (skb->ip_summed ==CHECKSUM_HW ) +if (skb->ip_summed ==CHECKSUM_PARTIAL ) csstart = skb->h.raw - skb->data;else csstart =skb_headlen (skb);
@@ -1387,7 +1387,7 @@ void skb_copy_and_csum_dev(const struct csum =skb_copy_and_csum_bits (skb, csstart, to + csstart, skb->len - csstart,0 ); -if (skb->ip_summed ==CHECKSUM_HW ) { +if (skb->ip_summed ==CHECKSUM_PARTIAL ) {long csstuff = csstart + skb->csum; *((unsigned short *)(to + csstuff)) =csum_fold (csum);
@@ -1874,10 +1874,10 @@ int skb_append_datato_frags(struct sock* @len: length of data pulled * * This function performs an skb_pull on the packet and updates -* update the CHECKSUM_HW checksum. It should be used on receive -* path processing instead of skb_pull unless you know that the -* checksum difference is zero (e.g., a valid IP header) or you -* are setting ip_summed to CHECKSUM_NONE. +* update the CHECKSUM_COMPLETE checksum. It should be used on +* receive path processing instead of skb_pull unless you know +* that the checksum difference is zero (e.g., a valid IP header) +* or you are setting ip_summed to CHECKSUM_NONE. */ unsigned char *skb_pull_rcsum (struct sk_buff *skb,unsigned int len) {
@@ -1970,7 +1970,7 @@ struct sk_buff *skb_segment(struct sk_bu frag =skb_shinfo (nskb)->frags; k =0 ; - nskb->ip_summed =CHECKSUM_HW ; + nskb->ip_summed =CHECKSUM_PARTIAL ; nskb->csum = skb->csum;memcpy (skb_put (nskb, hsize), skb->data + offset, hsize);
net/ipv4/icmp.c +1 -1
@@ -928,7 +928,7 @@ int icmp_rcv(struct sk_buff *skb)ICMP_INC_STATS_BH (ICMP_MIB_INMSGS );switch (skb->ip_summed) { -case CHECKSUM_HW : +case CHECKSUM_COMPLETE :if (!(u16 )csum_fold (skb->csum))break ;/* fall through */
net/ipv4/igmp.c +1 -1
@@ -931,7 +931,7 @@ int igmp_rcv(struct sk_buff *skb) goto drop;switch (skb->ip_summed) { -case CHECKSUM_HW : +case CHECKSUM_COMPLETE :if (!(u16 )csum_fold (skb->csum))break ;/* fall through */
net/ipv4/ip_fragment.c +1 -1
@@ -665,7 +665,7 @@ static struct sk_buff *ip_frag_reasm(str head->len += fp->len;if (head->ip_summed != fp->ip_summed) head->ip_summed =CHECKSUM_NONE ; -else if (head->ip_summed ==CHECKSUM_HW ) +else if (head->ip_summed ==CHECKSUM_COMPLETE ) head->csum =csum_add (head->csum, fp->csum); head->truesize += fp->truesize;atomic_sub (fp->truesize, &ip_frag_mem);
net/ipv4/ip_gre.c +2 -2
@@ -576,7 +576,7 @@ static int ipgre_rcv(struct sk_buff *skbif (flags&GRE_CSUM ) {switch (skb->ip_summed) { -case CHECKSUM_HW : +case CHECKSUM_COMPLETE : csum = (u16 )csum_fold (skb->csum);if (!csum)break ;
@@ -584,7 +584,7 @@ static int ipgre_rcv(struct sk_buff *skbcase CHECKSUM_NONE : skb->csum =0 ; csum =__skb_checksum_complete (skb); - skb->ip_summed =CHECKSUM_HW ; + skb->ip_summed =CHECKSUM_COMPLETE ; } offset +=4 ; }
net/ipv4/ip_output.c +3 -3
@@ -677,7 +677,7 @@ ip_generic_getfrag(void *from, char *to, {struct iovec *iov = from; -if (skb->ip_summed ==CHECKSUM_HW ) { +if (skb->ip_summed ==CHECKSUM_PARTIAL ) {if (memcpy_fromiovecend (to, iov, offset, len) <0 )return -EFAULT ; }else {
@@ -733,7 +733,7 @@ static inline int ip_ufo_append_data(str/* initialize protocol header pointer */ skb->h.raw = skb->data + fragheaderlen; - skb->ip_summed =CHECKSUM_HW ; + skb->ip_summed =CHECKSUM_PARTIAL ; skb->csum =0 ; sk->sk_sndmsg_off =0 ; }
@@ -841,7 +841,7 @@ int ip_append_data(struct sock *sk, length + fragheaderlen <= mtu && rt->u.dst.dev->features & NETIF_F_ALL_CSUM && !exthdrlen) - csummode =CHECKSUM_HW ; + csummode =CHECKSUM_PARTIAL ; inet->cork.length += length; if (((length > mtu) && (sk->sk_protocol == IPPROTO_UDP)) &&
net/ipv4/ipvs/ip_vs_proto_tcp.c +4 -4
@@ -151,7 +151,7 @@ tcp_snat_handler(struct sk_buff **pskb,/* Only port and addr are changed, do fast csum update */ tcp_fast_csum_update (tcph, cp->daddr, cp->vaddr, cp->dport, cp->vport); -if ((*pskb)->ip_summed ==CHECKSUM_HW ) +if ((*pskb)->ip_summed ==CHECKSUM_COMPLETE ) (*pskb)->ip_summed =CHECKSUM_NONE ; }else {/* full checksum calculation */
@@ -204,7 +204,7 @@ tcp_dnat_handler(struct sk_buff **pskb,/* Only port and addr are changed, do fast csum update */ tcp_fast_csum_update (tcph, cp->vaddr, cp->daddr, cp->vport, cp->dport); -if ((*pskb)->ip_summed ==CHECKSUM_HW ) +if ((*pskb)->ip_summed ==CHECKSUM_COMPLETE ) (*pskb)->ip_summed =CHECKSUM_NONE ; }else {/* full checksum calculation */
@@ -229,7 +229,7 @@ tcp_csum_check(struct sk_buff *skb, struswitch (skb->ip_summed) {case CHECKSUM_NONE : skb->csum =skb_checksum (skb, tcphoff, skb->len - tcphoff,0 ); -case CHECKSUM_HW : +case CHECKSUM_COMPLETE :if (csum_tcpudp_magic (skb->nh.iph->saddr, skb->nh.iph->daddr, skb->len - tcphoff, skb->nh.iph->protocol, skb->csum)) {
@@ -239,7 +239,7 @@ tcp_csum_check(struct sk_buff *skb, stru }break ;default : -/* CHECKSUM_UNNECESSARY */ +/* No need to checksum. */ break ; }
net/ipv4/ipvs/ip_vs_proto_udp.c +4 -4
@@ -161,7 +161,7 @@ udp_snat_handler(struct sk_buff **pskb,/* Only port and addr are changed, do fast csum update */ udp_fast_csum_update (udph, cp->daddr, cp->vaddr, cp->dport, cp->vport); -if ((*pskb)->ip_summed ==CHECKSUM_HW ) +if ((*pskb)->ip_summed ==CHECKSUM_COMPLETE ) (*pskb)->ip_summed =CHECKSUM_NONE ; }else {/* full checksum calculation */
@@ -216,7 +216,7 @@ udp_dnat_handler(struct sk_buff **pskb,/* Only port and addr are changed, do fast csum update */ udp_fast_csum_update (udph, cp->vaddr, cp->daddr, cp->vport, cp->dport); -if ((*pskb)->ip_summed ==CHECKSUM_HW ) +if ((*pskb)->ip_summed ==CHECKSUM_COMPLETE ) (*pskb)->ip_summed =CHECKSUM_NONE ; }else {/* full checksum calculation */
@@ -250,7 +250,7 @@ udp_csum_check(struct sk_buff *skb, strucase CHECKSUM_NONE : skb->csum =skb_checksum (skb, udphoff, skb->len - udphoff,0 ); -case CHECKSUM_HW : +case CHECKSUM_COMPLETE : if (csum_tcpudp_magic(skb->nh.iph->saddr, skb->nh.iph->daddr, skb->len - udphoff,
@@ -262,7 +262,7 @@ udp_csum_check(struct sk_buff *skb, stru }break ;default : -/* CHECKSUM_UNNECESSARY */ +/* No need to checksum. */ break ; } }
net/ipv4/netfilter.c +1 -1
@@ -168,7 +168,7 @@ unsigned int nf_ip_checksum(struct sk_buunsigned int csum =0 ;switch (skb->ip_summed) { -case CHECKSUM_HW : +case CHECKSUM_COMPLETE :if (hook !=NF_IP_PRE_ROUTING && hook !=NF_IP_LOCAL_IN )break ; if ((protocol == 0 && !(u16)csum_fold(skb->csum)) ||
net/ipv4/netfilter/ip_conntrack_proto_tcp.c +1 -2
@@ -865,8 +865,7 @@ static int tcp_error(struct sk_buff *skb/* Checksum invalid? Ignore. * We skip checking packets on the outgoing path -* because the semantic of CHECKSUM_HW is different there -* and moreover root might send raw packets. +* because it is assumed to be correct. */ /* FIXME: Source route IP option packets --RR */ if (ip_conntrack_checksum && hooknum == NF_IP_PRE_ROUTING &&
net/ipv4/netfilter/ip_conntrack_proto_udp.c +1 -2
@@ -117,8 +117,7 @@ static int udp_error(struct sk_buff *skb/* Checksum invalid? Ignore. * We skip checking packets on the outgoing path -* because the semantic of CHECKSUM_HW is different there -* and moreover root might send raw packets. +* because the checksum is assumed to be correct. * FIXME: Source route IP option packets --RR */ if (ip_conntrack_checksum && hooknum ==NF_IP_PRE_ROUTING &&nf_ip_checksum (skb, hooknum, iph->ihl *4 ,IPPROTO_UDP )) {
net/ipv4/netfilter/ip_nat_standalone.c +3 -2
@@ -111,8 +111,9 @@ ip_nat_fn(unsigned int hooknum, & htons(IP_MF|IP_OFFSET)));/* If we had a hardware checksum before, it's now invalid */ -if ((*pskb)->ip_summed ==CHECKSUM_HW ) -if (skb_checksum_help (*pskb, (out ==NULL ))) +if ((*pskb)->ip_summed ==CHECKSUM_PARTIAL || + (*pskb)->ip_summed ==CHECKSUM_COMPLETE ) +if (skb_checksum_help (*pskb))return NF_DROP ; ct =ip_conntrack_get (*pskb, &ctinfo);
net/ipv4/netfilter/ip_queue.c +3 -3
@@ -208,9 +208,9 @@ ipq_build_packet_message(struct ipq_queubreak ;case IPQ_COPY_PACKET : -if (entry->skb->ip_summed ==CHECKSUM_HW && - (*errp =skb_checksum_help (entry->skb, - entry->info->outdev ==NULL ))) { +if ((entry->skb->ip_summed ==CHECKSUM_PARTIAL || + entry->skb->ip_summed ==CHECKSUM_COMPLETE ) && + (*errp =skb_checksum_help (entry->skb))) {read_unlock_bh (&queue_lock);return NULL ; }
net/ipv4/netfilter/ipt_ECN.c +5 -4
@@ -49,7 +49,7 @@ set_ect_ip(struct sk_buff **pskb, const/* Return 0 if there was an error. */ static inline int -set_ect_tcp (struct sk_buff **pskb,const struct ipt_ECN_info *einfo,int inward) +set_ect_tcp (struct sk_buff **pskb,const struct ipt_ECN_info *einfo) {struct tcphdr _tcph, *tcph;u_int16_t diffs[2 ];
@@ -70,8 +70,9 @@ set_ect_tcp(struct sk_buff **pskb, constreturn 0 ; tcph = (void *)(*pskb)->nh.iph + (*pskb)->nh.iph->ihl*4 ; -if ((*pskb)->ip_summed ==CHECKSUM_HW && -skb_checksum_help (*pskb, inward)) +if (((*pskb)->ip_summed ==CHECKSUM_PARTIAL || + (*pskb)->ip_summed ==CHECKSUM_COMPLETE ) && +skb_checksum_help (*pskb))return 0 ; diffs[0 ] = ((u_int16_t *)tcph)[6 ];
@@ -106,7 +107,7 @@ target(struct sk_buff **pskb,if (einfo->operation & (IPT_ECN_OP_SET_ECE |IPT_ECN_OP_SET_CWR ) && (*pskb)->nh.iph->protocol ==IPPROTO_TCP ) -if (!set_ect_tcp (pskb, einfo, (out ==NULL ))) +if (!set_ect_tcp (pskb, einfo))return NF_DROP ;return IPT_CONTINUE ;
net/ipv4/netfilter/ipt_TCPMSS.c +3 -2
@@ -62,8 +62,9 @@ ipt_tcpmss_target(struct sk_buff **pskb,if (!skb_make_writable (pskb, (*pskb)->len))return NF_DROP ; -if ((*pskb)->ip_summed ==CHECKSUM_HW && -skb_checksum_help (*pskb, out ==NULL )) +if (((*pskb)->ip_summed ==CHECKSUM_PARTIAL || + (*pskb)->ip_summed ==CHECKSUM_COMPLETE ) && +skb_checksum_help (*pskb))return NF_DROP ; iph = (*pskb)->nh.iph;
net/ipv4/tcp.c +4 -4
@@ -568,7 +568,7 @@ new_segment: skb->truesize += copy; sk->sk_wmem_queued += copy; sk->sk_forward_alloc -= copy; - skb->ip_summed =CHECKSUM_HW ; + skb->ip_summed =CHECKSUM_PARTIAL ; tp->write_seq += copy;TCP_SKB_CB (skb)->end_seq += copy;skb_shinfo (skb)->gso_segs =0 ;
@@ -723,7 +723,7 @@ new_segment:* Check whether we can use HW checksum. */ if (sk->sk_route_caps &NETIF_F_ALL_CSUM ) - skb->ip_summed =CHECKSUM_HW ; + skb->ip_summed =CHECKSUM_PARTIAL ;skb_entail (sk, tp, skb); copy = size_goal;
@@ -2204,7 +2204,7 @@ struct sk_buff *tcp_tso_segment(struct s th->fin = th->psh =0 ; th->check = ~csum_fold (th->check + delta); -if (skb->ip_summed !=CHECKSUM_HW ) +if (skb->ip_summed !=CHECKSUM_PARTIAL ) th->check =csum_fold (csum_partial (skb->h.raw, thlen, skb->csum));
@@ -2218,7 +2218,7 @@ struct sk_buff *tcp_tso_segment(struct s delta =htonl (oldlen + (skb->tail - skb->h.raw) + skb->data_len); th->check = ~csum_fold (th->check + delta); -if (skb->ip_summed !=CHECKSUM_HW ) +if (skb->ip_summed !=CHECKSUM_PARTIAL ) th->check =csum_fold (csum_partial (skb->h.raw, thlen, skb->csum));
net/ipv4/tcp_ipv4.c +3 -3
@@ -485,7 +485,7 @@ void tcp_v4_send_check(struct sock *sk,struct inet_sock *inet =inet_sk (sk);struct tcphdr *th = skb->h.th; -if (skb->ip_summed ==CHECKSUM_HW ) { +if (skb->ip_summed ==CHECKSUM_PARTIAL ) { th->check = ~tcp_v4_check (th, len, inet->saddr, inet->daddr,0 ); skb->csum = offsetof(struct tcphdr , check); }else {
@@ -510,7 +510,7 @@ int tcp_v4_gso_send_check(struct sk_buff th->check =0 ; th->check = ~tcp_v4_check (th, skb->len, iph->saddr, iph->daddr,0 ); skb->csum = offsetof(struct tcphdr , check); - skb->ip_summed =CHECKSUM_HW ; + skb->ip_summed =CHECKSUM_PARTIAL ;return 0 ; }
@@ -972,7 +972,7 @@ #endifstatic int tcp_v4_checksum_init (struct sk_buff *skb) { -if (skb->ip_summed ==CHECKSUM_HW ) { +if (skb->ip_summed ==CHECKSUM_COMPLETE ) {if (!tcp_v4_check (skb->h.th, skb->len, skb->nh.iph->saddr, skb->nh.iph->daddr, skb->csum)) { skb->ip_summed =CHECKSUM_UNNECESSARY ;
net/ipv4/tcp_output.c +8 -10
@@ -575,7 +575,7 @@ int tcp_fragment(struct sock *sk, structTCP_SKB_CB (buff)->sacked =TCP_SKB_CB (skb)->sacked;TCP_SKB_CB (skb)->sacked &= ~TCPCB_AT_TAIL ; -if (!skb_shinfo (skb)->nr_frags && skb->ip_summed !=CHECKSUM_HW ) { +if (!skb_shinfo (skb)->nr_frags && skb->ip_summed !=CHECKSUM_PARTIAL ) {/* Copy and checksum data tail into the new buffer. */ buff->csum =csum_partial_copy_nocheck (skb->data + len,skb_put (buff, nsize), nsize,0 );
@@ -584,7 +584,7 @@ int tcp_fragment(struct sock *sk, struct skb->csum =csum_block_sub (skb->csum, buff->csum, len); }else { - skb->ip_summed =CHECKSUM_HW ; + skb->ip_summed =CHECKSUM_PARTIAL ;skb_split (skb, buff, len); }
@@ -687,7 +687,7 @@ int tcp_trim_head(struct sock *sk, struc__pskb_trim_head (skb, len -skb_headlen (skb));TCP_SKB_CB (skb)->seq += len; - skb->ip_summed =CHECKSUM_HW ; + skb->ip_summed =CHECKSUM_PARTIAL ; skb->truesize -= len; sk->sk_wmem_queued -= len;
@@ -1060,7 +1060,7 @@ static int tso_fragment(struct sock *sk,/* This packet was never sent out yet, so no SACK bits. */ TCP_SKB_CB (buff)->sacked =0 ; - buff->ip_summed = skb->ip_summed =CHECKSUM_HW ; + buff->ip_summed = skb->ip_summed =CHECKSUM_PARTIAL ;skb_split (skb, buff, len);/* Fix up tso_factor for both original and new SKB. */
@@ -1204,8 +1204,7 @@ static int tcp_mtu_probe(struct sock *skTCP_SKB_CB (nskb)->flags =TCPCB_FLAG_ACK ;TCP_SKB_CB (nskb)->sacked =0 ; nskb->csum =0 ; -if (skb->ip_summed ==CHECKSUM_HW ) - nskb->ip_summed =CHECKSUM_HW ; + nskb->ip_summed = skb->ip_summed; len =0 ;while (len < probe_size) {
@@ -1229,7 +1228,7 @@ static int tcp_mtu_probe(struct sock *sk ~(TCPCB_FLAG_FIN |TCPCB_FLAG_PSH );if (!skb_shinfo (skb)->nr_frags) {skb_pull (skb, copy); -if (skb->ip_summed !=CHECKSUM_HW ) +if (skb->ip_summed !=CHECKSUM_PARTIAL ) skb->csum =csum_partial (skb->data, skb->len,0 ); }else {__pskb_trim_head (skb, copy);
@@ -1570,10 +1569,9 @@ static void tcp_retrans_try_collapse(strmemcpy (skb_put (skb, next_skb_size), next_skb->data, next_skb_size); -if (next_skb->ip_summed ==CHECKSUM_HW ) - skb->ip_summed =CHECKSUM_HW ; + skb->ip_summed = next_skb->ip_summed; -if (skb->ip_summed !=CHECKSUM_HW ) +if (skb->ip_summed !=CHECKSUM_PARTIAL ) skb->csum =csum_block_add (skb->csum, next_skb->csum, skb_size);/* Update sequence range on original skb. */
net/ipv4/udp.c +3 -3
@@ -429,7 +429,7 @@ static int udp_push_pending_frames(struc/* * Only one fragment on the socket. */ -if (skb->ip_summed ==CHECKSUM_HW ) { +if (skb->ip_summed ==CHECKSUM_PARTIAL ) { skb->csum = offsetof(struct udphdr , check); uh->check = ~csum_tcpudp_magic (fl->fl4_src, fl->fl4_dst, up->len,IPPROTO_UDP ,0 );
@@ -448,7 +448,7 @@ static int udp_push_pending_frames(struc* fragments on the socket so that all csums of sk_buffs * should be together. */ -if (skb->ip_summed ==CHECKSUM_HW ) { +if (skb->ip_summed ==CHECKSUM_PARTIAL ) {int offset = (unsigned char *)uh - skb->data; skb->csum =skb_checksum (skb, offset, skb->len - offset,0 );
@@ -1087,7 +1087,7 @@ static void udp_checksum_init(struct sk_ {if (uh->check ==0 ) { skb->ip_summed =CHECKSUM_UNNECESSARY ; - }else if (skb->ip_summed ==CHECKSUM_HW ) { + }else if (skb->ip_summed ==CHECKSUM_COMPLETE ) {if (!udp_check (uh, ulen, saddr, daddr, skb->csum)) skb->ip_summed =CHECKSUM_UNNECESSARY ; }
net/ipv4/xfrm4_output.c +2 -2
@@ -48,8 +48,8 @@ static int xfrm4_output_one(struct sk_bustruct xfrm_state *x = dst->xfrm;int err; -if (skb->ip_summed ==CHECKSUM_HW ) { - err =skb_checksum_help (skb,0 ); +if (skb->ip_summed ==CHECKSUM_PARTIAL ) { + err =skb_checksum_help (skb);if (err) goto error_nolock; }
net/ipv6/exthdrs.c +1 -1
@@ -294,7 +294,7 @@ looped_back: hdr = (struct ipv6_rt_hdr *) skb2->h.raw; } -if (skb->ip_summed ==CHECKSUM_HW ) +if (skb->ip_summed ==CHECKSUM_COMPLETE ) skb->ip_summed =CHECKSUM_NONE ; i = n - --hdr->segments_left;
net/ipv6/icmp.c +1 -1
@@ -604,7 +604,7 @@ static int icmpv6_rcv(struct sk_buff **p/* Perform checksum. */ switch (skb->ip_summed) { -case CHECKSUM_HW : +case CHECKSUM_COMPLETE :if (!csum_ipv6_magic (saddr, daddr, skb->len,IPPROTO_ICMPV6 , skb->csum))break ;
net/ipv6/ip6_output.c +1 -1
@@ -821,7 +821,7 @@ static inline int ip6_ufo_append_data(st/* initialize protocol header pointer */ skb->h.raw = skb->data + fragheaderlen; - skb->ip_summed =CHECKSUM_HW ; + skb->ip_summed =CHECKSUM_PARTIAL ; skb->csum =0 ; sk->sk_sndmsg_off =0 ; }
net/ipv6/netfilter.c +1 -1
@@ -87,7 +87,7 @@ unsigned int nf_ip6_checksum(struct sk_bunsigned int csum =0 ; switch (skb->ip_summed) { - case CHECKSUM_HW: + case CHECKSUM_COMPLETE: if (hook != NF_IP6_PRE_ROUTING && hook != NF_IP6_LOCAL_IN) break; if (!csum_ipv6_magic(&ip6h->saddr, &ip6h->daddr,
net/ipv6/netfilter/ip6_queue.c +3 -3
@@ -206,9 +206,9 @@ ipq_build_packet_message(struct ipq_queubreak ;case IPQ_COPY_PACKET : -if (entry->skb->ip_summed ==CHECKSUM_HW && - (*errp =skb_checksum_help (entry->skb, - entry->info->outdev ==NULL ))) { +if ((entry->skb->ip_summed ==CHECKSUM_PARTIAL || + entry->skb->ip_summed ==CHECKSUM_COMPLETE ) && + (*errp =skb_checksum_help (entry->skb))) {read_unlock_bh (&queue_lock);return NULL ; }
net/ipv6/netfilter/nf_conntrack_reasm.c +3 -3
@@ -408,7 +408,7 @@ static int nf_ct_frag6_queue(struct nf_creturn -1 ; } -if (skb->ip_summed ==CHECKSUM_HW ) +if (skb->ip_summed ==CHECKSUM_COMPLETE ) skb->csum = csum_sub(skb->csum, csum_partial(skb->nh.raw, (u8*)(fhdr + 1) - skb->nh.raw,
@@ -640,7 +640,7 @@ nf_ct_frag6_reasm(struct nf_ct_frag6_que head->len += fp->len;if (head->ip_summed != fp->ip_summed) head->ip_summed =CHECKSUM_NONE ; -else if (head->ip_summed ==CHECKSUM_HW ) +else if (head->ip_summed ==CHECKSUM_COMPLETE ) head->csum =csum_add (head->csum, fp->csum); head->truesize += fp->truesize;atomic_sub (fp->truesize, &nf_ct_frag6_mem);
@@ -652,7 +652,7 @@ nf_ct_frag6_reasm(struct nf_ct_frag6_que head->nh.ipv6h->payload_len =htons (payload_len);/* Yes, and fold redundant checksum back. 8) */ -if (head->ip_summed ==CHECKSUM_HW ) +if (head->ip_summed ==CHECKSUM_COMPLETE ) head->csum =csum_partial (head->nh.raw, head->h.raw-head->nh.raw, head->csum); fq->fragments =NULL ;
net/ipv6/raw.c +1 -1
@@ -334,7 +334,7 @@ int rawv6_rcv(struct sock *sk, struct skif (!rp->checksum) skb->ip_summed =CHECKSUM_UNNECESSARY ; - if (skb->ip_summed == CHECKSUM_HW) { + if (skb->ip_summed == CHECKSUM_COMPLETE) { skb_postpull_rcsum(skb, skb->nh.raw, skb->h.raw - skb->nh.raw); if (!csum_ipv6_magic(&skb->nh.ipv6h->saddr,
net/ipv6/reassembly.c +3 -3
@@ -433,7 +433,7 @@ static void ip6_frag_queue(struct frag_qreturn ; } -if (skb->ip_summed ==CHECKSUM_HW ) +if (skb->ip_summed ==CHECKSUM_COMPLETE ) skb->csum =csum_sub (skb->csum,csum_partial (skb->nh.raw, (u8 *)(fhdr+1 )-skb->nh.raw,0 ));
@@ -647,7 +647,7 @@ static int ip6_frag_reasm(struct frag_qu head->len += fp->len;if (head->ip_summed != fp->ip_summed) head->ip_summed =CHECKSUM_NONE ; -else if (head->ip_summed ==CHECKSUM_HW ) +else if (head->ip_summed ==CHECKSUM_COMPLETE ) head->csum =csum_add (head->csum, fp->csum); head->truesize += fp->truesize;atomic_sub (fp->truesize, &ip6_frag_mem);
@@ -662,7 +662,7 @@ static int ip6_frag_reasm(struct frag_qu *skb_in = head;/* Yes, and fold redundant checksum back. 8) */ -if (head->ip_summed ==CHECKSUM_HW ) +if (head->ip_summed ==CHECKSUM_COMPLETE ) head->csum =csum_partial (head->nh.raw, head->h.raw-head->nh.raw, head->csum);IP6_INC_STATS_BH (IPSTATS_MIB_REASMOKS );
net/ipv6/tcp_ipv6.c +3 -3
@@ -542,7 +542,7 @@ static void tcp_v6_send_check(struct socstruct ipv6_pinfo *np =inet6_sk (sk);struct tcphdr *th = skb->h.th; -if (skb->ip_summed ==CHECKSUM_HW ) { +if (skb->ip_summed ==CHECKSUM_PARTIAL ) { th->check = ~csum_ipv6_magic (&np->saddr, &np->daddr, len,IPPROTO_TCP ,0 ); skb->csum = offsetof(struct tcphdr , check); }else {
@@ -567,7 +567,7 @@ static int tcp_v6_gso_send_check(struct th->check = ~csum_ipv6_magic (&ipv6h->saddr, &ipv6h->daddr, skb->len,IPPROTO_TCP ,0 ); skb->csum = offsetof(struct tcphdr , check); - skb->ip_summed =CHECKSUM_HW ; + skb->ip_summed =CHECKSUM_PARTIAL ;return 0 ; }
@@ -1026,7 +1026,7 @@ out:static int tcp_v6_checksum_init (struct sk_buff *skb) { -if (skb->ip_summed ==CHECKSUM_HW ) { +if (skb->ip_summed ==CHECKSUM_COMPLETE ) {if (!tcp_v6_check (skb->h.th,skb->len,&skb->nh.ipv6h->saddr, &skb->nh.ipv6h->daddr,skb->csum)) { skb->ip_summed =CHECKSUM_UNNECESSARY ;
net/ipv6/udp.c +1 -1
@@ -475,7 +475,7 @@ static int udpv6_rcv(struct sk_buff **ps uh = skb->h.uh; } -if (skb->ip_summed ==CHECKSUM_HW && +if (skb->ip_summed ==CHECKSUM_COMPLETE && !csum_ipv6_magic (saddr, daddr, ulen,IPPROTO_UDP , skb->csum)) skb->ip_summed =CHECKSUM_UNNECESSARY ;
net/ipv6/xfrm6_output.c +2 -2
@@ -41,8 +41,8 @@ static int xfrm6_output_one(struct sk_bustruct xfrm_state *x = dst->xfrm;int err; -if (skb->ip_summed ==CHECKSUM_HW ) { - err =skb_checksum_help (skb,0 ); +if (skb->ip_summed ==CHECKSUM_PARTIAL ) { + err =skb_checksum_help (skb);if (err) goto error_nolock; }
net/netfilter/nf_conntrack_proto_tcp.c +1 -2
@@ -823,8 +823,7 @@ static int tcp_error(struct sk_buff *skb/* Checksum invalid? Ignore. * We skip checking packets on the outgoing path -* because the semantic of CHECKSUM_HW is different there -* and moreover root might send raw packets. +* because the checksum is assumed to be correct. */ /* FIXME: Source route IP option packets --RR */ if (nf_conntrack_checksum &&
net/netfilter/nf_conntrack_proto_udp.c +1 -2
@@ -131,8 +131,7 @@ static int udp_error(struct sk_buff *skb/* Checksum invalid? Ignore. * We skip checking packets on the outgoing path -* because the semantic of CHECKSUM_HW is different there -* and moreover root might send raw packets. +* because the checksum is assumed to be correct. * FIXME: Source route IP option packets --RR */ if (nf_conntrack_checksum && ((pf == PF_INET && hooknum == NF_IP_PRE_ROUTING) ||
net/netfilter/nfnetlink_queue.c +3 -3
@@ -377,9 +377,9 @@ #endifbreak ;case NFQNL_COPY_PACKET : -if (entskb->ip_summed ==CHECKSUM_HW && - (*errp =skb_checksum_help (entskb, - outdev ==NULL ))) { +if ((entskb->ip_summed ==CHECKSUM_PARTIAL || + entskb->ip_summed ==CHECKSUM_COMPLETE ) && + (*errp =skb_checksum_help (entskb))) {spin_unlock_bh (&queue->lock);return NULL ; }
net/packet/af_packet.c +1 -1
@@ -586,7 +586,7 @@ static int tpacket_rcv(struct sk_buff *selse if (skb->pkt_type ==PACKET_OUTGOING ) {/* Special case: outgoing packets have ll header at head */ skb_pull (skb, skb->nh.raw - skb->data); -if (skb->ip_summed ==CHECKSUM_HW ) +if (skb->ip_summed ==CHECKSUM_PARTIAL ) status |=TP_STATUS_CSUMNOTREADY ; } }
net/sched/sch_netem.c +2 -2
@@ -192,8 +192,8 @@ static int netem_enqueue(struct sk_buff*/ if (q->corrupt && q->corrupt >=get_crandom (&q->corrupt_cor)) {if (!(skb =skb_unshare (skb,GFP_ATOMIC )) - || (skb->ip_summed ==CHECKSUM_HW - &&skb_checksum_help (skb,0 ))) { + || (skb->ip_summed ==CHECKSUM_PARTIAL + &&skb_checksum_help (skb))) { sch->qstats.drops++;return NET_XMIT_DROP ; }
net/sunrpc/socklib.c +1 -1
@@ -168,7 +168,7 @@ int csum_partial_copy_to_xdr(struct xdr_return -1 ;if ((unsigned short )csum_fold (desc.csum))return -1 ; -if (unlikely (skb->ip_summed ==CHECKSUM_HW )) +if (unlikely (skb->ip_summed ==CHECKSUM_COMPLETE ))netdev_rx_csum_fault (skb->dev);return 0 ; no_checksum:
[NETFILTER]: Get rid of HW checksum invalidation
---
commit cb08da5c018d0b982bfc59572e3cf5f4c64c99db
tree 06fb5ddac5b638b19f1c1a98311ac93c98996089
parent 9e8ee86180aab5a225832c9772b2ad0e8a5c6006
author Patrick McHardy <[email protected]> Mon, 31 Jul 2006 20:30:58 +0200 committer Patrick McHardy <[email protected]> Mon, 31 Jul 2006 20:30:58 +0200
include/linux/netfilter.h | 6 +++ include/linux/netfilter_ipv4/ip_nat_core.h | 8 ++-- net/ipv4/netfilter/ip_nat_core.c | 32 ++++++++------- net/ipv4/netfilter/ip_nat_helper.c | 59 +++++++++++++++++++--------- net/ipv4/netfilter/ip_nat_proto_gre.c | 5 +- net/ipv4/netfilter/ip_nat_proto_icmp.c | 8 ++-- net/ipv4/netfilter/ip_nat_proto_tcp.c | 7 +-- net/ipv4/netfilter/ip_nat_proto_udp.c | 15 +++++-- net/ipv4/netfilter/ip_nat_standalone.c | 10 +---- net/ipv4/netfilter/ipt_ECN.c | 19 +++------ net/ipv4/netfilter/ipt_REJECT.c | 1 net/ipv4/netfilter/ipt_TCPMSS.c | 39 ++++++++----------- net/netfilter/core.c | 23 +++++++++++ 13 files changed, 135 insertions(+), 97 deletions(-)
include/linux/netfilter.h +6 -0
@@ -282,6 +282,12 @@ extern void nf_invalidate_cache(int pf);Returns true or false. */ extern int skb_make_writable (struct sk_buff **pskb,unsigned int writable_len); +extern u_int16_t nf_csum_update (u_int32_t oldval,u_int32_t newval, +u_int16_t csum); +extern u_int16_t nf_proto_csum_update (struct sk_buff *skb, +u_int32_t oldval,u_int32_t newval, +u_int16_t csum,int pseudohdr); +struct nf_afinfo {unsigned short family; unsigned int (*checksum)(struct sk_buff *skb, unsigned int hook,
include/linux/netfilter_ipv4/ip_nat_core.h +4 -4
@@ -11,8 +11,8 @@ extern unsigned int ip_nat_packet(structunsigned int hooknum, struct sk_buff **pskb); -extern int ip_nat_icmp_reply_translation (struct sk_buff **pskb, -struct ip_conntrack *ct, -enum ip_nat_manip_type manip, -enum ip_conntrack_dir dir); +extern int ip_nat_icmp_reply_translation (struct ip_conntrack *ct, +enum ip_conntrack_info ctinfo, +unsigned int hooknum, +struct sk_buff **pskb);#endif /* _IP_NAT_CORE_H */
net/ipv4/netfilter/ip_nat_core.c +16 -16
@@ -423,10 +423,10 @@ unsigned int ip_nat_packet(struct ip_conEXPORT_SYMBOL_GPL (ip_nat_packet);/* Dir is direction ICMP is coming from (opposite to packet it contains) */ -int ip_nat_icmp_reply_translation (struct sk_buff **pskb, -struct ip_conntrack *ct, -enum ip_nat_manip_type manip, -enum ip_conntrack_dir dir) +int ip_nat_icmp_reply_translation (struct ip_conntrack *ct, +enum ip_conntrack_info ctinfo, +unsigned int hooknum, +struct sk_buff **pskb) {struct {struct icmphdr icmp;
@@ -434,7 +434,9 @@ int ip_nat_icmp_reply_translation(struct } *inside;struct ip_conntrack_tuple inner, target;int hdrlen = (*pskb)->nh.iph->ihl *4 ; +enum ip_conntrack_dir dir =CTINFO2DIR (ctinfo);unsigned long statusbit; +enum ip_nat_manip_type manip =HOOK2MANIP (hooknum);if (!skb_make_writable (pskb, hdrlen +sizeof (*inside)))return 0 ;
@@ -443,12 +445,8 @@ int ip_nat_icmp_reply_translation(struct/* We're actually going to mangle it beyond trivial checksum adjustment, so make sure the current checksum is correct. */ -if ((*pskb)->ip_summed !=CHECKSUM_UNNECESSARY ) { - hdrlen = (*pskb)->nh.iph->ihl *4 ; -if ((u16 )csum_fold (skb_checksum (*pskb, hdrlen, - (*pskb)->len - hdrlen,0 ))) -return 0 ; - } +if (nf_ip_checksum (*pskb, hooknum, hdrlen,0 )) +return 0 ;/* Must be RELATED */ IP_NF_ASSERT((*pskb)->nfctinfo == IP_CT_RELATED ||
@@ -487,12 +485,14 @@ int ip_nat_icmp_reply_translation(struct !manip))return 0 ; -/* Reloading "inside" here since manip_pkt inner. */ - inside = (void *)(*pskb)->data + (*pskb)->nh.iph->ihl*4 ; - inside->icmp.checksum =0 ; - inside->icmp.checksum =csum_fold (skb_checksum (*pskb, hdrlen, - (*pskb)->len - hdrlen, -0 )); +if ((*pskb)->ip_summed !=CHECKSUM_PARTIAL ) { +/* Reloading "inside" here since manip_pkt inner. */ + inside = (void *)(*pskb)->data + (*pskb)->nh.iph->ihl*4 ; + inside->icmp.checksum =0 ; + inside->icmp.checksum =csum_fold (skb_checksum (*pskb, hdrlen, + (*pskb)->len - hdrlen, +0 )); + }/* Change outer to look the reply to an incoming packet * (proto 0 means don't invert per-proto part). */
net/ipv4/netfilter/ip_nat_helper.c +41 -18
110 lines not on this page · raw message
net/ipv4/netfilter/ip_nat_proto_gre.c +3 -2
@@ -130,9 +130,10 @@ gre_manip_pkt(struct sk_buff **pskb,if (greh->csum) {/* FIXME: Never tested this code... */ *(gre_csum (greh)) = -ip_nat_cheat_check (~*(gre_key (greh)), +nf_proto_csum_update (*pskb, + ~*(gre_key (greh)), tuple->dst.u.gre.key, - *(gre_csum (greh))); + *(gre_csum (greh)),0 ); } *(gre_key (greh)) = tuple->dst.u.gre.key;break ;
net/ipv4/netfilter/ip_nat_proto_icmp.c +4 -4
@@ -66,10 +66,10 @@ icmp_manip_pkt(struct sk_buff **pskb,return 0 ; hdr = (struct icmphdr *)((*pskb)->data + hdroff); - - hdr->checksum =ip_nat_cheat_check (hdr->un.echo.id ^0xFFFF , - tuple->src.u.icmp.id, - hdr->checksum); + hdr->checksum =nf_proto_csum_update (*pskb, + hdr->un.echo.id ^0xFFFF , + tuple->src.u.icmp.id, + hdr->checksum,0 ); hdr->un.echo.id = tuple->src.u.icmp.id;return 1 ; }
net/ipv4/netfilter/ip_nat_proto_tcp.c +3 -4
@@ -129,10 +129,9 @@ tcp_manip_pkt(struct sk_buff **pskb,if (hdrsize <sizeof (*hdr))return 1 ; - hdr->check =ip_nat_cheat_check (~oldip, newip, -ip_nat_cheat_check (oldport ^0xFFFF , - newport, - hdr->check)); + hdr->check =nf_proto_csum_update (*pskb, ~oldip, newip, hdr->check,1 ); + hdr->check =nf_proto_csum_update (*pskb, oldport ^0xFFFF , newport, + hdr->check,0 );return 1 ; }
net/ipv4/netfilter/ip_nat_proto_udp.c +10 -5
@@ -113,11 +113,16 @@ udp_manip_pkt(struct sk_buff **pskb, newport = tuple->dst.u.udp.port; portptr = &hdr->dest; } -if (hdr->check)/* 0 is a special case meaning no checksum */ - hdr->check =ip_nat_cheat_check (~oldip, newip, -ip_nat_cheat_check (*portptr ^0xFFFF , - newport, - hdr->check)); + +if (hdr->check || (*pskb)->ip_summed ==CHECKSUM_PARTIAL ) { + hdr->check =nf_proto_csum_update (*pskb, ~oldip, newip, + hdr->check,1 ); + hdr->check =nf_proto_csum_update (*pskb, + *portptr ^0xFFFF , newport, + hdr->check,0 ); +if (!hdr->check) + hdr->check =-1 ; + } *portptr = newport;return 1 ; }
net/ipv4/netfilter/ip_nat_standalone.c +2 -8
@@ -110,12 +110,6 @@ ip_nat_fn(unsigned int hooknum,IP_NF_ASSERT (!((*pskb)->nh.iph->frag_off &htons (IP_MF |IP_OFFSET ))); -/* If we had a hardware checksum before, it's now invalid */ -if ((*pskb)->ip_summed ==CHECKSUM_PARTIAL || - (*pskb)->ip_summed ==CHECKSUM_COMPLETE ) -if (skb_checksum_help (*pskb)) -return NF_DROP ; - ct =ip_conntrack_get (*pskb, &ctinfo);/* Can't track? It's not due to stress, or conntrack would have dropped it. Hence it's the user's responsibilty to
@@ -146,8 +140,8 @@ ip_nat_fn(unsigned int hooknum,case IP_CT_RELATED :case IP_CT_RELATED +IP_CT_IS_REPLY :if ((*pskb)->nh.iph->protocol ==IPPROTO_ICMP ) { -if (!ip_nat_icmp_reply_translation (pskb, ct, maniptype, -CTINFO2DIR (ctinfo))) +if (!ip_nat_icmp_reply_translation (ct, ctinfo, + hooknum, pskb))return NF_DROP ;else return NF_ACCEPT ;
net/ipv4/netfilter/ipt_ECN.c +6 -13
@@ -52,7 +52,7 @@ static inline int set_ect_tcp(struct sk_buff **pskb, const struct ipt_ECN_info *einfo) { struct tcphdr _tcph, *tcph; -u_int16_t diffs[2 ]; +u_int16_t oldval;/* Not enought header? */ tcph = skb_header_pointer(*pskb, (*pskb)->nh.iph->ihl*4,
@@ -70,23 +70,16 @@ set_ect_tcp(struct sk_buff **pskb, constreturn 0 ; tcph = (void *)(*pskb)->nh.iph + (*pskb)->nh.iph->ihl*4 ; -if (((*pskb)->ip_summed ==CHECKSUM_PARTIAL || - (*pskb)->ip_summed ==CHECKSUM_COMPLETE ) && -skb_checksum_help (*pskb)) -return 0 ; - - diffs[0 ] = ((u_int16_t *)tcph)[6 ]; + oldval = ((u_int16_t *)tcph)[6 ];if (einfo->operation &IPT_ECN_OP_SET_ECE ) tcph->ece = einfo->proto.tcp.ece;if (einfo->operation &IPT_ECN_OP_SET_CWR ) tcph->cwr = einfo->proto.tcp.cwr; - diffs[1 ] = ((u_int16_t *)tcph)[6 ]; - diffs[0 ] = diffs[0 ] ^0xFFFF ; -if ((*pskb)->ip_summed !=CHECKSUM_UNNECESSARY ) - tcph->check =csum_fold (csum_partial ((char *)diffs, -sizeof (diffs), - tcph->check^0xFFFF )); + tcph->check =nf_proto_csum_update ((*pskb), + oldval ^0xFFFF , + ((u_int16_t *)tcph)[6 ], + tcph->check,0 );return 1 ; }
net/ipv4/netfilter/ipt_REJECT.c +1 -0
@@ -184,6 +184,7 @@ static void send_reset(struct sk_buff *o tcph->urg_ptr =0 ;/* Adjust TCP checksum */ + nskb->ip_summed =CHECKSUM_NONE ; tcph->check =0 ; tcph->check = tcp_v4_check(tcph, sizeof(struct tcphdr), nskb->nh.iph->saddr,
net/ipv4/netfilter/ipt_TCPMSS.c +16 -23
@@ -27,14 +27,6 @@ #else #define DEBUGP(format, args...)#endif -static u_int16_t -cheat_check (u_int32_t oldvalinv,u_int32_t newval,u_int16_t oldcheck) -{ -u_int32_t diffs[] = { oldvalinv, newval }; -return csum_fold (csum_partial ((char *)diffs,sizeof (diffs), - oldcheck^0xFFFF )); -} -static inline unsigned int optlen (const u_int8_t *opt,unsigned int offset) {
@@ -62,11 +54,6 @@ ipt_tcpmss_target(struct sk_buff **pskb,if (!skb_make_writable (pskb, (*pskb)->len))return NF_DROP ; -if (((*pskb)->ip_summed ==CHECKSUM_PARTIAL || - (*pskb)->ip_summed ==CHECKSUM_COMPLETE ) && -skb_checksum_help (*pskb)) -return NF_DROP ; - iph = (*pskb)->nh.iph; tcplen = (*pskb)->len - iph->ihl*4 ;
@@ -120,9 +107,10 @@ ipt_tcpmss_target(struct sk_buff **pskb, opt[i+2 ] = (newmss &0xff00 ) >>8 ; opt[i+3 ] = (newmss &0x00ff ); - tcph->check =cheat_check (htons (oldmss)^0xFFFF , -htons (newmss), - tcph->check); + tcph->check =nf_proto_csum_update (*pskb, +htons (oldmss)^0xFFFF , +htons (newmss), + tcph->check,0 );DEBUGP (KERN_INFO "ipt_tcpmss_target: %u.%u.%u.%u:%hu" "->%u.%u.%u.%u:%hu changed TCP MSS option"
@@ -162,8 +150,10 @@ ipt_tcpmss_target(struct sk_buff **pskb, opt = (u_int8_t *)tcph +sizeof (struct tcphdr );memmove (opt +TCPOLEN_MSS , opt, tcplen -sizeof (struct tcphdr )); - tcph->check =cheat_check (htons (tcplen) ^0xFFFF , -htons (tcplen +TCPOLEN_MSS ), tcph->check); + tcph->check =nf_proto_csum_update (*pskb, +htons (tcplen) ^0xFFFF , +htons (tcplen +TCPOLEN_MSS ), + tcph->check,1 ); tcplen +=TCPOLEN_MSS ; opt[0 ] =TCPOPT_MSS ;
@@ -171,16 +161,19 @@ ipt_tcpmss_target(struct sk_buff **pskb, opt[2 ] = (newmss &0xff00 ) >>8 ; opt[3 ] = (newmss &0x00ff ); - tcph->check =cheat_check (~0 , *((u_int32_t *)opt), tcph->check); + tcph->check =nf_proto_csum_update (*pskb, ~0 , *((u_int32_t *)opt), + tcph->check,0 ); oldval = ((u_int16_t *)tcph)[6 ]; tcph->doff +=TCPOLEN_MSS /4 ; - tcph->check =cheat_check (oldval ^0xFFFF , - ((u_int16_t *)tcph)[6 ], tcph->check); + tcph->check =nf_proto_csum_update (*pskb, + oldval ^0xFFFF , + ((u_int16_t *)tcph)[6 ], + tcph->check,0 ); newtotlen =htons (ntohs (iph->tot_len) +TCPOLEN_MSS ); - iph->check =cheat_check (iph->tot_len ^0xFFFF , - newtotlen, iph->check); + iph->check =nf_csum_update (iph->tot_len ^0xFFFF , + newtotlen, iph->check); iph->tot_len = newtotlen; DEBUGP(KERN_INFO "ipt_tcpmss_target: %u.%u.%u.%u:%hu"
net/netfilter/core.c +23 -0
@@ -222,6 +222,29 @@ copy_skb: }EXPORT_SYMBOL (skb_make_writable); +u_int16_t nf_csum_update (u_int32_t oldval,u_int32_t newval,u_int16_t csum) +{ +u_int32_t diff[] = { oldval, newval }; + +return csum_fold (csum_partial ((char *)diff,sizeof (diff), + csum ^0xFFFF )); +} +EXPORT_SYMBOL (nf_csum_update); + +u_int16_t nf_proto_csum_update (struct sk_buff *skb, +u_int32_t oldval,u_int32_t newval, +u_int16_t csum,int pseudohdr) +{ +if (skb->ip_summed !=CHECKSUM_PARTIAL ) { + csum =nf_csum_update (oldval, newval, csum); +if (skb->ip_summed ==CHECKSUM_COMPLETE && pseudohdr) + skb->csum =nf_csum_update (oldval, newval, skb->csum); + }else if (pseudohdr) + csum = ~nf_csum_update (oldval, newval, ~csum); + +return csum; +} +EXPORT_SYMBOL (nf_proto_csum_update);/* This does not belong here, but locally generated errors need it if connection tracking in use: without this, connection may not be in hash table, and hence
[NETFILTER]: nf_queue: handle GSO packets
Handle GSO packets in nf_queue by segmenting them before queueing to avoid breaking GSO in case they get mangled.
---
commit e4288dc06646aee0f112fd4aa7a9cca4f3a96e82
tree efc1e2e9d79a45488f2227933294430ea204644a
parent cb08da5c018d0b982bfc59572e3cf5f4c64c99db
author Patrick McHardy <[email protected]> Mon, 31 Jul 2006 20:31:29 +0200 committer Patrick McHardy <[email protected]> Mon, 31 Jul 2006 20:31:29 +0200
net/netfilter/core.c | 2 + net/netfilter/nf_internals.h | 2 + net/netfilter/nf_queue.c | 76 ++++++++++++++++++++++++++++++++---------- 3 files changed, 60 insertions(+), 20 deletions(-)
net/netfilter/core.c +1 -1
@@ -182,7 +182,7 @@ next_hook: ret = -EPERM ; }else if ((verdict &NF_VERDICT_MASK ) ==NF_QUEUE ) {NFDEBUG ("nf_hook: Verdict = QUEUE.\n" ); -if (!nf_queue (pskb, elem, pf, hook, indev, outdev, okfn, +if (!nf_queue (*pskb, elem, pf, hook, indev, outdev, okfn, verdict >>NF_VERDICT_BITS )) goto next_hook; }
net/netfilter/nf_internals.h +1 -1
@@ -23,7 +23,7 @@ extern unsigned int nf_iterate(struct li int hook_thresh);/* nf_queue.c */ -extern int nf_queue(struct sk_buff **skb, +extern int nf_queue(struct sk_buff *skb, struct list_head *elem, int pf, unsigned int hook, struct net_device *indev,
net/netfilter/nf_queue.c +58 -18
129 lines not on this page · raw message
David Miller
maintainerFrom: Patrick McHardy <[email protected]>
Date: Mon, 31 Jul 2006 20:36:58 +0200
Quoted 1 line
I'm going to do some more testing now ..
Thanks for all of this work Patrick.
I noticed a subtle semantic change for nf_queue(). Previously, if we can't grab the module reference for the matching entry, we'd not free the skb, return 0, and the caller tries to iterate to the next hook.
That behavior is preserved for singleton frames, but that's not what happens for GSO frames. Instead, the GSO frame is split up and we always return "1" even if some of the subsegments cause __nf_queue() to return 0 due to the case described in the previous paragraph.
It is, however, mindful to free up the kfree_skb so it doesn't cause a leak or anything like that.
Does this matter?
Quoted 8 lines · David Miller
I noticed a subtle semantic change for
nf_queue(). Previously, if we can't grab the module reference for the matching entry, we'd not free the skb, return 0, and the caller tries to iterate to the next hook.That behavior is preserved for singleton frames, but that's not what happens for GSO frames. Instead, the GSO frame is split up and we always return "1" even if some of the subsegments cause
__nf_queue()to return 0 due to the case described in the previous paragraph.
I couldn't think of a better way to handle this except to just deliver everything we can and drop the rest, since the caller doesn't know anything about the individual segments we can't simply deliver the remaining ones to the next hook.
Quoted 4 lines
It is, however, mindful to free up the
kfree_skbso it doesn't cause a leak or anything like that.Does this matter?
I don't think it does. Its a huge corner case (unloading of the module which issued the QUEUE verdict while queueing the packet), and worst case is that we drop some segments or the entire packet.
David Miller
maintainerFrom: Patrick McHardy <[email protected]>
Date: Mon, 31 Jul 2006 23:36:29 +0200
Quoted 6 lines
Quoted 1 line · David Miller
Does this matter?
I don't think it does. Its a huge corner case (unloading of the module which issued the QUEUE verdict while queueing the packet), and worst case is that we drop some segments or the entire packet.
Ok, that's what I thought.
David Miller
maintainerFrom: Patrick McHardy <[email protected]>
Date: Mon, 31 Jul 2006 20:36:58 +0200
Quoted 8 lines
Quoted 5 lines · Herbert Xu
So I'd rather see a patch to disable the warnings for 2.6.18 so that the proper fix can be tested more thoroughly. We should remember that the 2.6.18 minus the warning is still going to be heaps better in this regard compared to 2.6.17 where all TSO packets were essentially discarded due to the incorrect checksum (when the NAT module is loaded).
I'm fine either way.
I'm going to kill the warning for 2.6.18, using the patch below. We can queue up Patrick's changes for 2.6.19, just give me the word and I'll apply it to net-2.6.19
commit 9133d3d0619e637f2e05bf574af4b7a16319e3ca
Author: David S. Miller <[email protected]> Date: Tue Aug 1 00:00:12 2006 -0700
[NET]: Kill the WARN_ON() calls for checksum fixups.
We have a more complete solution in the works, involving the seperation of CHECKSUM_HW on input vs. output, and having netfilter properly do incremental checksums.
But that is a very involved patch and is thus 2.6.19 material.
What we have now is infinitely better than the past, wherein all TSO packets were dropped due to corrupt checksums as soon at the NAT module was loaded. At least now, the checksums do get fixed up, it just isn't the cleanest nor most optimal solution.
net/core/dev.c +0 -10
@@ -1166,11 +1166,6 @@ int skb_checksum_help(struct sk_buff *sk goto out_set_summed;if (unlikely (skb_shinfo (skb)->gso_size)) { -static int warned; - -WARN_ON (!warned); - warned =1 ; -/* Let GSO fix up the checksum. */ goto out_set_summed; }
@@ -1220,11 +1215,6 @@ struct sk_buff *skb_gso_segment(struct s__skb_pull (skb, skb->mac_len);if (unlikely (skb->ip_summed !=CHECKSUM_HW )) { -static int warned; - -WARN_ON (!warned); - warned =1 ; -if (skb_header_cloned (skb) && (err =pskb_expand_head (skb,0 ,0 ,GFP_ATOMIC )))return ERR_PTR (err);
Herbert Xu
maintainerQuoted 4 lines · David Miller
I'm going to kill the warning for 2.6.18, using the patch below. We can queue up Patrick's changes for 2.6.19, just give me the word and I'll apply it to net-2.6.19
Thanks Dave. This should give us plenty of time to produce a complete solution to the problem.
Cheers,
Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txtPatrick McHardy wrote:---------------
Quoted 4 lines
[NETFILTER]:
nf_queue: handle GSO packetsHandle GSO packets in
nf_queueby segmenting them before queueing to avoid breaking GSO in case they get mangled.
While testing this patch I noticed that some meta-data is lost when segmenting packets. With the attached patch it works fine. Some of the fields may not appear necessary, so here's my reasoning:
- nfct/nfctinfo/nfct_reasm: the xfrm output path does an immediate nf_reset, so they were not necessary until now. Queueing can happen on any hook, so we need to preserve them.
- nf_bridge: needed for GSO on a bridge device until the deferred hooks are removed
- tc_verd/tc_index/input_dev: when directing a packet from a device supporting GSO to a device not supporting GSO using tc actions, these fields may be set.
Herbert, does this look sane to you?
net/core/skbuff.c +22 -0
@@ -1948,6 +1948,31 @@ struct sk_buff *skb_segment(struct sk_bu nskb->dev = skb->dev; nskb->priority = skb->priority; +#ifdef CONFIG_NETFILTER + nskb->nfmark = skb->nfmark; + nskb->nfct = skb->nfct; +nf_conntrack_get (skb->nfct); + nskb->nfctinfo = skb->nfctinfo; +#if defined(CONFIG_NF_CONNTRACK ) || defined(CONFIG_NF_CONNTRACK_MODULE ) + nskb->nfct_reasm = skb->nfct_reasm; +nf_conntrack_get_reasm (skb->nfct_reasm); +#endif +#ifdef CONFIG_BRIDGE_NETFILTER + nskb->nf_bridge = skb->nf_bridge; +nf_bridge_get (skb->nf_bridge); +#endif +#endif +#ifdef CONFIG_NET_SCHED +#ifdef CONFIG_NET_CLS_ACT + nskb->input_dev = skb->input_dev; + nskb->tc_verd = skb->tc_verd; +#endif + nskb->tc_index = skb->tc_index; +#endif +skb_copy_secmark (nskb, skb); nskb->protocol = skb->protocol; nskb->dst =dst_clone (skb->dst);memcpy (nskb->cb, skb->cb,sizeof (skb->cb));
Quoted 3 lines · David Miller
I'm going to kill the warning for 2.6.18, using the patch below. We can queue up Patrick's changes for 2.6.19, just give me the word and I'll apply it to net-2.6.19
Besides the problem I mentioned in the mail I just wrote everything looks good so far. I'll probably send you the final version sometimes today.
Herbert Xu
maintainerHi Patrick:
Quoted 7 lines · Patrick McHardy
- nfct/nfctinfo/nfct_reasm: the xfrm output path does an immediate
nf_reset, so they were not necessary until now. Queueing can happen on any hook, so we need to preserve them.-
nf_bridge: needed for GSO on a bridge device until the deferred hooks are removed
I need to think a bit more about these two cases.
Quoted 3 lines
- tc_verd/tc_index/input_dev: when directing a packet from a device supporting GSO to a device not supporting GSO using tc actions, these fields may be set.
This doesn't look right though. GSO should occur just before hard_start_xmit (after all tc actions have taken place) so we shouldn't have any more tc actions to perform.
Cheers,
Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txtDavid Miller
maintainerFrom: Herbert Xu <[email protected]>
Date: Tue, 1 Aug 2006 17:23:58 +1000
Quoted 7 lines
Quoted 3 lines
- tc_verd/tc_index/input_dev: when directing a packet from a device supporting GSO to a device not supporting GSO using tc actions, these fields may be set.
This doesn't look right though. GSO should occur just before
hard_start_xmit(after all tc actions have taken place) so we shouldn't have any more tc actions to perform.
Hmmm, what about loopback? Yeah yeah, LOOPBACK_TSO is not defined :) but what I'm really referring to is that loopback preserves the traffic classifier bits of the skb.
Quoted 8 lines · Herbert Xu
Quoted 3 lines
- tc_verd/tc_index/input_dev: when directing a packet from a device supporting GSO to a device not supporting GSO using tc actions, these fields may be set.
This doesn't look right though. GSO should occur just before
hard_start_xmit(after all tc actions have taken place) so we shouldn't have any more tc actions to perform.
You're right, this part shouldn't be necessary. It might be possible to construct some case with loopback, but I doubt it would be very realistic.
Herbert Xu
maintainerQuoted 5 lines · David Miller
Quoted 5 lines
Quoted 4 lines
- tc_verd/tc_index/input_dev: when directing a packet from a device supporting GSO to a device not supporting GSO using tc actions, these fields may be set.
Quoted 7 lines
Quoted 3 lines
This doesn't look right though. GSO should occur just before
hard_start_xmit(after all tc actions have taken place) so we shouldn't have any more tc actions to perform.Hmmm, what about loopback? Yeah yeah,
LOOPBACK_TSOis not defined :) but what I'm really referring to is that loopback preserves the traffic classifier bits of the skb.
I don't know. Jamal, is there a scenario where these three attributes are needed for loopback packets?
Cheers,
Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txtHerbert Xu
maintainerQuoted 4 lines · Patrick McHardy
- nfct/nfctinfo/nfct_reasm: the xfrm output path does an immediate
nf_reset, so they were not necessary until now. Queueing can happen on any hook, so we need to preserve them.
This looks OK to me. However, we should do this in a wrapper around skb_gso_segment rather than in skb_segment.
The idea with skb_gso_segment is that it's the most generic (or basic) level of service which is needed by everyone. If you need anything more specific, you can do it around skb_gso_segment.
For exmample, dev_gso_segment is the version that's tailored for device transmission.
So I'd imagine something like
nf_gso_segment(skb)
{
segs = skb_gso_segment(skb, 0);
if (IS_ERR(segs))
goto out;
nskb = segs;
do {
copy_nf_attributes(nskb, skb);
} while ((nskb = nskb->next));out:
kfree_skb(skb); return segs; }
Quoted 2 lines
-
nf_bridge: needed for GSO on a bridge device until the deferred hooks are removed
I presume this is only needed for netfilter queueing as well?
Cheers,
Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txtQuoted 10 lines · Herbert Xu
Quoted 9 lines · David Miller
Quoted 8 lines
Quoted 4 lines
- tc_verd/tc_index/input_dev: when directing a packet from a device supporting GSO to a device not supporting GSO using tc actions, these fields may be set.
This doesn't look right though. GSO should occur just before
hard_start_xmit(after all tc actions have taken place) so we shouldn't have any more tc actions to perform.
Quoted 6 lines
Quoted 3 lines
Hmmm, what about loopback? Yeah yeah,
LOOPBACK_TSOis not defined :) but what I'm really referring to is that loopback preserves the traffic classifier bits of the skb.I don't know. Jamal, is there a scenario where these three attributes are needed for loopback packets?
I didnt fully understand the scope of the discussion, but a little explanation may help answer the question:
If the only spot where the GSO kicks in is at or after qdisc_is_running level, then the redirect will happen way before that point at qdisc->enqueue time.
When we redirect or mirror, the packet is cloned and any metadata preserved at clone time needs to stay intact before dev_queue_xmit is hit for the destination device.
And of course we have no checks for whether we are redirecting from a device that is GSO capable to one that is not (or vice-versa). If thats important, we could add a check.
I am not sure if I answered the question ;->
cheers,
jamal
Herbert Xu
maintainerQuoted 4 lines · Patrick McHardy
[NETFILTER]: Get rid of HW checksum invalidation
Signed-off-by Patrick McHardy <[email protected]>
It all looks great except for the csum update function.
Quoted 14 lines
net/netfilter/core.c +6
-0@@ -222,6 +222,29 @@ copy_skb: }EXPORT_SYMBOL (skb_make_writable); +u_int16_t nf_csum_update (u_int32_t oldval,u_int32_t newval,u_int16_t csum) +{ +u_int32_t diff[] = { oldval, newval }; + +return csum_fold (csum_partial ((char *)diff,sizeof (diff), + csum ^0xFFFF ));
net/netfilter/core.c copy_skb: · line 240
Quoted 10 lines
net/netfilter/core.c +10
-0+} +EXPORT_SYMBOL (nf_csum_update); + +u_int16_t nf_proto_csum_update (struct sk_buff *skb, +u_int32_t oldval,u_int32_t newval, +u_int16_t csum,int pseudohdr) +{ +if (skb->ip_summed !=CHECKSUM_PARTIAL ) { + csum =nf_csum_update (oldval, newval, csum); +if (skb->ip_summed ==CHECKSUM_COMPLETE && pseudohdr)
Shouldn't that be !pseudohdr?
net/netfilter/core.c copy_skb: · line 241
Quoted 1 line
net/netfilter/core.c +1
-0+ skb->csum =nf_csum_update (oldval, newval, skb->csum);
^^^^^^^^^
This is a 32-bit quantity so nf_csum_update should eat a 32-bit quantity as well. Also, this checksum is not inverted so you need
skb->csum = ~nf_csum_update(oldval, newval, ~skb->csum);
Of course nf_csum_update will need ~csum instead of csum^0xffff.
Cheers,
Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txtHerbert Xu
maintainerQuoted 13 lines · Jamal Hadi Salim
Quoted 13 lines
Quoted 12 lines
Quoted 8 lines
Quoted 4 lines
- tc_verd/tc_index/input_dev: when directing a packet from a device supporting GSO to a device not supporting GSO using tc actions, these fields may be set.
This doesn't look right though. GSO should occur just before
hard_start_xmit(after all tc actions have taken place) so we shouldn't have any more tc actions to perform.Hmmm, what about loopback? Yeah yeah,
LOOPBACK_TSOis not defined :) but what I'm really referring to is that loopback preserves the traffic classifier bits of the skb.
Quoted 5 lines
Quoted 2 lines
I don't know. Jamal, is there a scenario where these three attributes are needed for loopback packets?
I didnt fully understand the scope of the discussion, but a little explanation may help answer the question:
My question isn't really about GSO as such.
What I'd like to know is do we really need to preserve
tc_verd/tc_index/input_dev
for a packet crossing loopback's xmit function?
The reason I'm asking is because currently they're preserved as a matter of course since loopback just shoves the same packet down the other end.
If we were to apply GSO to loopback (purely as a thought exercise since loopback can handle large frames just fine without segmenting it :) would we need to copy those attriutes?
Cheers,
Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txtQuoted 6 lines · Herbert Xu
What I'd like to know is do we really need to preserve
tc_verd/tc_index/input_dev
for a packet crossing loopback's xmit function?
My instinctive reaction is to say no. Heres a (slightly complex) example:
--> eth0(GSO ON) ---> lo --> eth1(GSO off) --> eth3(GSO ON)
When we get to lo in the above graph, input_dev=eth0 and when we leave that info will be overwritten to be input_dev=lo.
I just added the GSO markers (incase that info is useful) to show that we could move in the same topology between GSO and non-GSO devices.
I believe it would be fine for lo not to preserve. Not sure if it is ok as a general rule though.
cheers,
jamal
Quoted 3 lines · David Miller
What we have now is infinitely better than the past, wherein all TSO packets were dropped due to corrupt checksums as soon at the NAT module was loaded.
At what point did this problem begin? 2.6.18-rc or prior?
Phil
Herbert Xu
maintainernet/netfilter/nf_queue.c
Quoted 5 lines · Patrick McHardy
net/netfilter/nf_queue.c +0
-0
I presume we need similar patches for the old ipv4/ipv6 versions as well?
Cheers,
Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txtHerbert Xu
maintainerQuoted 6 lines · Phil Oester
Quoted 3 lines · David Miller
What we have now is infinitely better than the past, wherein all TSO packets were dropped due to corrupt checksums as soon at the NAT module was loaded.
At what point did this problem begin? 2.6.18-rc or prior?
Since we had TSO.
Cheers,
Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txtHerbert Xu
maintainerQuoted 7 lines · herbert
Quoted 7 lines
net/ipv4/netfilter/ip_nat_core.c +0
-0@@ -443,7 +443,9 @@ int ip_nat_icmp_reply_translation(struct
Quoted 9 lines
net/ipv4/netfilter/ip_nat_core.c int ip_nat_icmp_reply_translation(struct · line 451
Quoted 9 lines
net/ipv4/netfilter/ip_nat_core.c +3
-1/* We're actually going to mangle it beyond trivial checksum adjustment, so make sure the current checksum is correct. */ -if ((*pskb)->ip_summed !=CHECKSUM_UNNECESSARY ) { + +if ((*pskb)->ip_summed !=CHECKSUM_UNNECESSARY && + (*pskb)->ip_summed !=CHECKSUM_PARTIAL ) { hdrlen = (*pskb)->nh.iph->ihl *4 ;if ((u16 )csum_fold (skb_checksum (*pskb, hdrlen, (*pskb)->len - hdrlen,0 )))
Actually, we could drop this chunk of code altogether.
The reason is that if the packet comes in with the correct checksum, it'll go out of NAT with the correct checksum. If it came in with the wrong checksum, it'll go out with the wrong checksum.
We let TCP packets with incorrect checksums pass through NAT, so why not do the same here?
After all, we're here to do NAT, not verify checksums. We charge extra for that :)
Cheers,
Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txtQuoted 30 lines · Herbert Xu
Quoted 3 lines · Patrick McHardy
- nfct/nfctinfo/nfct_reasm: the xfrm output path does an immediate
nf_reset, so they were not necessary until now. Queueing can happen on any hook, so we need to preserve them.This looks OK to me. However, we should do this in a wrapper around
skb_gso_segmentrather than inskb_segment.The idea with
skb_gso_segmentis that it's the most generic (or basic) level of service which is needed by everyone. If you need anything more specific, you can do it aroundskb_gso_segment.For exmample,
dev_gso_segmentis the version that's tailored for device transmission.So I'd imagine something like
nf_gso_segment(skb){ segs = skb_gso_segment(skb, 0); if (IS_ERR(segs)) goto out; nskb = segs; do { copy_nf_attributes(nskb, skb); } while ((nskb = nskb->next));
Quoted 4 lines
out:
kfree_skb(skb); return segs; }
This looks OK. But we also need this for the redirect to loopback case, do you want me to put it in dev_gso_segment as well? nfmark and secmark should go in skb_segment I guess?
Quoted 5 lines
Quoted 2 lines
-
nf_bridge: needed for GSO on a bridge device until the deferred hooks are removedI presume this is only needed for netfilter queueing as well?
No, we also need this for XFRM until the deferred hooks are removed. It is allocated on the first invocation of the NF_IP_LOCAL_OUT hook and bridge netfilter expects it to be present later on.
Quoted 10 lines · Herbert Xu
net/netfilter/core.c copy_skb: · line 240
Quoted 7 lines
net/netfilter/core.c +7
-0+u_int16_t nf_proto_csum_update (struct sk_buff *skb, +u_int32_t oldval,u_int32_t newval, +u_int16_t csum,int pseudohdr) +{ +if (skb->ip_summed !=CHECKSUM_PARTIAL ) { + csum =nf_csum_update (oldval, newval, csum); +if (skb->ip_summed ==CHECKSUM_COMPLETE && pseudohdr)Shouldn't that be !pseudohdr?
No, if the changed data is part of the pseudo-hdr, we need to update skb->csum so the skb passes later checksum checks.
Quoted 8 lines
net/netfilter/core.c copy_skb: · line 241
Quoted 1 line
net/netfilter/core.c +1
-0+ skb->csum =nf_csum_update (oldval, newval, skb->csum);^^^^^^^^^This is a 32-bit quantity so
nf_csum_updateshould eat a 32-bit quantity as well. Also, this checksum is not inverted so you needskb->csum = ~nf_csum_update(oldval, newval, ~skb->csum);
I'll change it to 32-bit and try the inversion, but it works fine this way.
Herbert Xu
maintainerQuoted 4 lines · Patrick McHardy
This looks OK. But we also need this for the redirect to loopback case, do you want me to put it in
dev_gso_segmentas well? nfmark and secmark should go inskb_segmentI guess?
OK, you've convinced me. Let's put them all into skb_segment.
However, I'd like to have the code shared between skb_segment and copy_skb_header so we have only one place to add things to in future.
Cheers,
Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txtQuoted 9 lines · Herbert Xu
net/netfilter/nf_queue.c
Quoted 4 lines · Patrick McHardy
net/netfilter/nf_queue.c +0
-0I presume we need similar patches for the old ipv4/ipv6 versions as well?
This is code is used for all queueing mechanisms, so they are already covered by this.
Quoted 25 lines · Herbert Xu
Quoted 6 lines · herbert
Quoted 6 lines
net/ipv4/netfilter/ip_nat_core.c +0
-0@@ -443,7 +443,9 @@ int ip_nat_icmp_reply_translation(structQuoted 9 lines
net/ipv4/netfilter/ip_nat_core.c int ip_nat_icmp_reply_translation(struct · line 451
Quoted 9 lines
net/ipv4/netfilter/ip_nat_core.c +3
-1/* We're actually going to mangle it beyond trivial checksum adjustment, so make sure the current checksum is correct. */ -if ((*pskb)->ip_summed !=CHECKSUM_UNNECESSARY ) { + +if ((*pskb)->ip_summed !=CHECKSUM_UNNECESSARY && + (*pskb)->ip_summed !=CHECKSUM_PARTIAL ) { hdrlen = (*pskb)->nh.iph->ihl *4 ;if ((u16 )csum_fold (skb_checksum (*pskb, hdrlen, (*pskb)->len - hdrlen,0 )))Actually, we could drop this chunk of code altogether.
The reason is that if the packet comes in with the correct checksum, it'll go out of NAT with the correct checksum. If it came in with the wrong checksum, it'll go out with the wrong checksum.
Quoted 5 lines
We let TCP packets with incorrect checksums pass through NAT, so why not do the same here?
After all, we're here to do NAT, not verify checksums. We charge extra for that :)
The checksum is verified here because a full checksum update is done later in that function and we don't want to accidentally fix up broken checksums.
Herbert Xu
maintainerQuoted 11 lines · Patrick McHardy
Quoted 10 lines
net/netfilter/core.c copy_skb: · line 240
Quoted 7 lines
net/netfilter/core.c +7
-0+u_int16_t nf_proto_csum_update (struct sk_buff *skb, +u_int32_t oldval,u_int32_t newval, +u_int16_t csum,int pseudohdr) +{ +if (skb->ip_summed !=CHECKSUM_PARTIAL ) { + csum =nf_csum_update (oldval, newval, csum); +if (skb->ip_summed ==CHECKSUM_COMPLETE && pseudohdr)Shouldn't that be !pseudohdr?
Quoted 2 lines
No, if the changed data is part of the pseudo-hdr, we need to update
skb->csumso the skb passes later checksum checks.
Are you sure? If ip_summed is CHECKSUM_COMPLETE then skb->csum is the checksum of the payload *without* the pseudo header.
Quoted 7 lines
Quoted 4 lines
This is a 32-bit quantity so
nf_csum_updateshould eat a 32-bit quantity as well. Also, this checksum is not inverted so you needskb->csum = ~nf_csum_update(oldval, newval, ~skb->csum);I'll change it to 32-bit and try the inversion, but it works fine this way.
It'll break for e1000 at least since it puts the checksum into the high 16 bits of skb->csum (on i386).
Cheers,
Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txtQuoted 11 lines · Herbert Xu
Quoted 3 lines · Patrick McHardy
This looks OK. But we also need this for the redirect to loopback case, do you want me to put it in
dev_gso_segmentas well? nfmark and secmark should go inskb_segmentI guess?OK, you've convinced me. Let's put them all into
skb_segment.However, I'd like to have the code shared between
skb_segmentandcopy_skb_headerso we have only one place to add things to in future.
Yes, that would be good. I'll send a patch later today ..
Herbert Xu
maintainerQuoted 4 lines · Patrick McHardy
The checksum is verified here because a full checksum update is done later in that function and we don't want to accidentally fix up broken checksums.
Sorry, I missed that.
BTW, we should make sure that we clear CHECKSUM_COMPLETE since at the end of the function skb->csum no longer contains the payload checksum.
Cheers,
Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txtQuoted 13 lines · Herbert Xu
Quoted 11 lines · Patrick McHardy
Quoted 10 lines
net/netfilter/core.c copy_skb: · line 240
Quoted 7 lines
net/netfilter/core.c +7
-0+u_int16_t nf_proto_csum_update (struct sk_buff *skb, +u_int32_t oldval,u_int32_t newval, +u_int16_t csum,int pseudohdr) +{ +if (skb->ip_summed !=CHECKSUM_PARTIAL ) { + csum =nf_csum_update (oldval, newval, csum); +if (skb->ip_summed ==CHECKSUM_COMPLETE && pseudohdr)Shouldn't that be !pseudohdr?
Quoted 6 lines
Quoted 2 lines
No, if the changed data is part of the pseudo-hdr, we need to update
skb->csumso the skb passes later checksum checks.Are you sure? If
ip_summedisCHECKSUM_COMPLETEthenskb->csumis the checksum of the payload *without* the pseudo header.
The pseudohdr is included indirectly through the tcp/udp checksum.
Quoted 11 lines
Quoted 7 lines
Quoted 4 lines
This is a 32-bit quantity so
nf_csum_updateshould eat a 32-bit quantity as well. Also, this checksum is not inverted so you needskb->csum = ~nf_csum_update(oldval, newval, ~skb->csum);I'll change it to 32-bit and try the inversion, but it works fine this way.
It'll break for e1000 at least since it puts the checksum into the high 16 bits of
skb->csum(on i386).
Yes, the 32-bit thing is a bug, I meant it works fine without inverting the checksum.
Quoted 11 lines · Herbert Xu
Quoted 3 lines · Patrick McHardy
The checksum is verified here because a full checksum update is done later in that function and we don't want to accidentally fix up broken checksums.
Sorry, I missed that.
BTW, we should make sure that we clear
CHECKSUM_COMPLETEsince at the end of the functionskb->csumno longer contains the payload checksum.
nf_ip_checksum sets skb->ip_summed to CHECKSUM_UNNECESSARY in case the checksum was correct. If not the packet is dropped, so I think it should be fine.
Herbert Xu
maintainerQuoted 5 lines · Patrick McHardy
Quoted 3 lines
Are you sure? If
ip_summedisCHECKSUM_COMPLETEthenskb->csumis the checksum of the payload *without* the pseudo header.The pseudohdr is included indirectly through the tcp/udp checksum.
Yes of course, the payload gets balanced out by the header checksum, but not the pseudoheader. Now I get you :)
Quoted 2 lines
Yes, the 32-bit thing is a bug, I meant it works fine without inverting the checksum.
Right, I forgot about the checksum invariance under negation. In that case we can get rid of the tildes two lines down as well for consistency.
Cheers,
Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txtQuoted 8 lines · Herbert Xu
Quoted 2 lines · Patrick McHardy
Yes, the 32-bit thing is a bug, I meant it works fine without inverting the checksum.
Right, I forgot about the checksum invariance under negation. In that case we can get rid of the tildes two lines down as well for consistency.
I've made the other changes you suggested, but removing the tildes here didn't work, so I left them in. I'll send the new patches in a few minutes.
Hi Patrick:
Quoted 4 lines · Patrick McHardy
I've made the other changes you suggested, but removing the tildes here didn't work, so I left them in. I'll send the new patches in a few minutes.
You're right of course. I was simply confused. The partial checksum happens to be the negation of the complete checksum for the pseudo-header.
All of your patches look good to me. Thanks for fixing these bugs!
Cheers,
Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt