aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain KUNTZ <r.kuntz@ipflavors.com>2013-01-16 07:47:40 -0500
committerDavid S. Miller <davem@davemloft.net>2013-01-17 03:37:13 -0500
commit7efdba5bd9a2f3e2059beeb45c9fa55eefe1bced (patch)
treeb6f0487a10e42cb0ef89f380c7a78c4ee871e585
parent3022551b6ae6d4750becc0a8e3391d4b79d5a038 (diff)
ipv6: fix header length calculation in ip6_append_data()
Commit 299b0767 (ipv6: Fix IPsec slowpath fragmentation problem) has introduced a error in the header length calculation that provokes corrupted packets when non-fragmentable extensions headers (Destination Option or Routing Header Type 2) are used. rt->rt6i_nfheader_len is the length of the non-fragmentable extension header, and it should be substracted to rt->dst.header_len, and not to exthdrlen, as it was done before commit 299b0767. This patch reverts to the original and correct behavior. It has been successfully tested with and without IPsec on packets that include non-fragmentable extensions headers. Signed-off-by: Romain Kuntz <r.kuntz@ipflavors.com> Acked-by: Steffen Klassert <steffen.klassert@secunet.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/ipv6/ip6_output.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 5552d13ae92f..0c7c03d50dc0 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -1213,10 +1213,10 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,
1213 if (dst_allfrag(rt->dst.path)) 1213 if (dst_allfrag(rt->dst.path))
1214 cork->flags |= IPCORK_ALLFRAG; 1214 cork->flags |= IPCORK_ALLFRAG;
1215 cork->length = 0; 1215 cork->length = 0;
1216 exthdrlen = (opt ? opt->opt_flen : 0) - rt->rt6i_nfheader_len; 1216 exthdrlen = (opt ? opt->opt_flen : 0);
1217 length += exthdrlen; 1217 length += exthdrlen;
1218 transhdrlen += exthdrlen; 1218 transhdrlen += exthdrlen;
1219 dst_exthdrlen = rt->dst.header_len; 1219 dst_exthdrlen = rt->dst.header_len - rt->rt6i_nfheader_len;
1220 } else { 1220 } else {
1221 rt = (struct rt6_info *)cork->dst; 1221 rt = (struct rt6_info *)cork->dst;
1222 fl6 = &inet->cork.fl.u.ip6; 1222 fl6 = &inet->cork.fl.u.ip6;