ipv6: Fix fragment id assignment on LE arches. [Linux 3.16.72]

This Linux kernel change "ipv6: Fix fragment id assignment on LE arches" is included in the Linux 3.16.72 release. This change is authored by Vlad Yasevich <vyasevich [at] gmail.com> on Mon Feb 9 09:38:20 2015 -0500. The commit for this change in Linux stable tree is 40abf10 (patch) which is from upstream commit 51f3077. The same Linux upstream change may have been applied to various maintained Linux releases and you can find all Linux releases containing changes from upstream 51f3077.

ipv6: Fix fragment id assignment on LE arches.

commit 51f30770e50eb787200f30a79105e2615b379334 upstream.

Recent commit:
Author: Vlad Yasevich <[email protected]>
Date:   Tue Feb 3 16:36:15 2015 -0500

    ipv6: Select fragment id during UFO segmentation if not set.

Introduced a bug on LE in how ipv6 fragment id is assigned.
This was cought by nightly sparce check:

Resolve the following sparce error:
 net/ipv6/output_core.c:57:38: sparse: incorrect type in assignment
 (different base types)
   net/ipv6/output_core.c:57:38:    expected restricted __be32
[usertype] ip6_frag_id
   net/ipv6/output_core.c:57:38:    got unsigned int [unsigned]
[assigned] [usertype] id

Fixes: 0508c07f5e0c9 (ipv6: Select fragment id during UFO segmentation if not set.)
Signed-off-by: Vladislav Yasevich <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Ben Hutchings <[email protected]>

There are 2 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 net/ipv6/output_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv6/output_core.c b/net/ipv6/output_core.c
index 6bacd3b..791e027 100644
--- a/net/ipv6/output_core.c
+++ b/net/ipv6/output_core.c
@@ -54,7 +54,7 @@ void ipv6_proxy_select_ident(struct sk_buff *skb)

    id = __ipv6_select_ident(ip6_proxy_idents_hashrnd,
                 &addrs[1], &addrs[0]);
-   skb_shinfo(skb)->ip6_frag_id = id;
+   skb_shinfo(skb)->ip6_frag_id = htonl(id);

Leave a Reply

Your email address will not be published. Required fields are marked *