From: Stephen Hemminger <shemminger@vyatta.com>
To: Eric Dumazet <eric.dumazet@gmail.com>,
Pablo Neira Ayuso <pablo@netfilter.org>,
Patrick McHardy <kaber@trash.net>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
netdev@vger.kernel.org, davem@davemloft.net,
netfilter-devel@vger.kernel.org
Subject: [RFT] nf_contrack_udp: handle packets with padding and hwchecksum
Date: Fri, 17 Feb 2012 10:16:48 -0800 [thread overview]
Message-ID: <20120217101648.01f31fcd@nehalam.linuxnetplumber.net> (raw)
In-Reply-To: <1327944148.3303.1.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC>
If UDP packet with extra padding is received on a device that
does hardware checksumming (but not checking) is processed
by netfilter conntrack, it would generate a bogus warning
about the checksum being incorrect.
There were two possible solutions. The netfilter conntrack
code could trim the packet, discarding the extra padding
and adjusting the checksum. Or it can force regular
non-offloaded checksum. This patch implements the latter
on the principal that is better for firewall code to not
modify the packet.
Compile tested only; haven't been able to reproduce the
problem yet.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
---
Patch against -net tree, after review/test it should go
to stable as well.
--- a/net/netfilter/nf_conntrack_proto_udp.c 2012-01-10 10:57:00.407196614 -0800
+++ b/net/netfilter/nf_conntrack_proto_udp.c 2012-02-17 10:06:18.038472559 -0800
@@ -125,12 +125,17 @@ static int udp_error(struct net *net, st
* We skip checking packets on the outgoing path
* because the checksum is assumed to be correct.
* FIXME: Source route IP option packets --RR */
- if (net->ct.sysctl_checksum && hooknum == NF_INET_PRE_ROUTING &&
- nf_checksum(skb, hooknum, dataoff, IPPROTO_UDP, pf)) {
- if (LOG_INVALID(net, IPPROTO_UDP))
- nf_log_packet(pf, 0, skb, NULL, NULL, NULL,
- "nf_ct_udp: bad UDP checksum ");
- return -NF_ACCEPT;
+ if (net->ct.sysctl_checksum && hooknum == NF_INET_PRE_ROUTING) {
+ /* Special case for hardware checksum offload with padding */
+ if (skb->ip_summed == CHECKSUM_COMPLETE && udplen > ntohs(hdr->len))
+ skb->ip_summed = CHECKSUM_NONE;
+
+ if (nf_checksum(skb, hooknum, dataoff, IPPROTO_UDP, pf)) {
+ if (LOG_INVALID(net, IPPROTO_UDP))
+ nf_log_packet(pf, 0, skb, NULL, NULL, NULL,
+ "nf_ct_udp: bad UDP checksum ");
+ return -NF_ACCEPT;
+ }
}
return NF_ACCEPT;
next prev parent reply other threads:[~2012-02-17 18:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-30 15:58 Regression in skge that started around acb42a3 (so past v3.3-rc1) Konrad Rzeszutek Wilk
2012-01-30 16:38 ` Stephen Hemminger
2012-01-30 17:22 ` Eric Dumazet
2012-02-17 18:16 ` Stephen Hemminger [this message]
2012-02-21 12:19 ` [RFT] nf_contrack_udp: handle packets with padding and hwchecksum Pablo Neira Ayuso
2012-01-30 17:57 ` Regression in skge that started around acb42a3 (so past v3.3-rc1) Konrad Rzeszutek Wilk
2012-01-30 18:02 ` David Miller
2012-01-30 18:22 ` Konrad Rzeszutek Wilk
2012-02-17 14:10 ` Konrad Rzeszutek Wilk
2012-02-17 15:45 ` Stephen Hemminger
2012-02-17 15:53 ` Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120217101648.01f31fcd@nehalam.linuxnetplumber.net \
--to=shemminger@vyatta.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=kaber@trash.net \
--cc=konrad.wilk@oracle.com \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.