diff options
author | Eric Dumazet <edumazet@google.com> | 2016-01-15 11:21:32 -0500 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2016-01-18 06:18:17 -0500 |
commit | d6b3347bf178266259af64b1f27b5cf54acf62c8 (patch) | |
tree | 73511ca46445418d5dba23d91ebfb4371b679593 /net/netfilter | |
parent | efaea94aaf0decd55b15aa7068d4d516a352e56e (diff) |
netfilter: xt_TCPMSS: handle CHECKSUM_COMPLETE in tcpmss_tg6()
In case MSS option is added in TCP options, skb length increases by 4.
IPv6 needs to update skb->csum if skb has CHECKSUM_COMPLETE,
otherwise kernel complains loudly in netdev_rx_csum_fault() with a
stack dump.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/netfilter')
-rw-r--r-- | net/netfilter/xt_TCPMSS.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/net/netfilter/xt_TCPMSS.c b/net/netfilter/xt_TCPMSS.c index b7c43def0dc6..e118397254af 100644 --- a/net/netfilter/xt_TCPMSS.c +++ b/net/netfilter/xt_TCPMSS.c | |||
@@ -228,7 +228,7 @@ tcpmss_tg6(struct sk_buff *skb, const struct xt_action_param *par) | |||
228 | { | 228 | { |
229 | struct ipv6hdr *ipv6h = ipv6_hdr(skb); | 229 | struct ipv6hdr *ipv6h = ipv6_hdr(skb); |
230 | u8 nexthdr; | 230 | u8 nexthdr; |
231 | __be16 frag_off; | 231 | __be16 frag_off, oldlen, newlen; |
232 | int tcphoff; | 232 | int tcphoff; |
233 | int ret; | 233 | int ret; |
234 | 234 | ||
@@ -244,7 +244,12 @@ tcpmss_tg6(struct sk_buff *skb, const struct xt_action_param *par) | |||
244 | return NF_DROP; | 244 | return NF_DROP; |
245 | if (ret > 0) { | 245 | if (ret > 0) { |
246 | ipv6h = ipv6_hdr(skb); | 246 | ipv6h = ipv6_hdr(skb); |
247 | ipv6h->payload_len = htons(ntohs(ipv6h->payload_len) + ret); | 247 | oldlen = ipv6h->payload_len; |
248 | newlen = htons(ntohs(oldlen) + ret); | ||
249 | if (skb->ip_summed == CHECKSUM_COMPLETE) | ||
250 | skb->csum = csum_add(csum_sub(skb->csum, oldlen), | ||
251 | newlen); | ||
252 | ipv6h->payload_len = newlen; | ||
248 | } | 253 | } |
249 | return XT_CONTINUE; | 254 | return XT_CONTINUE; |
250 | } | 255 | } |