Skip to content

Commit e9cba69

Browse files
Yossi Kupermanklassert
authored andcommitted
xfrm6: Fix CHECKSUM_COMPLETE after IPv6 header push
xfrm6_transport_finish rebuilds the IPv6 header based on the original one and pushes it back without fixing skb->csum. Therefore, CHECKSUM_COMPLETE is no longer valid and the packet gets dropped. Fix skb->csum by calling skb_postpush_rcsum. Note: A valid IPv4 header has checksum 0, unlike IPv6. Thus, the change is not needed in the sibling xfrm4_transport_finish function. Signed-off-by: Yossi Kuperman <yossiku@mellanox.com> Signed-off-by: Ilan Tayari <ilant@mellanox.com> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
1 parent e51a647 commit e9cba69

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

net/ipv6/xfrm6_input.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ EXPORT_SYMBOL(xfrm6_rcv_spi);
3434
int xfrm6_transport_finish(struct sk_buff *skb, int async)
3535
{
3636
struct xfrm_offload *xo = xfrm_offload(skb);
37+
int nhlen = skb->data - skb_network_header(skb);
3738

3839
skb_network_header(skb)[IP6CB(skb)->nhoff] =
3940
XFRM_MODE_SKB_CB(skb)->protocol;
@@ -43,8 +44,9 @@ int xfrm6_transport_finish(struct sk_buff *skb, int async)
4344
return 1;
4445
#endif
4546

46-
__skb_push(skb, skb->data - skb_network_header(skb));
47+
__skb_push(skb, nhlen);
4748
ipv6_hdr(skb)->payload_len = htons(skb->len - sizeof(struct ipv6hdr));
49+
skb_postpush_rcsum(skb, skb_network_header(skb), nhlen);
4850

4951
if (xo && (xo->flags & XFRM_GRO)) {
5052
skb_mac_header_rebuild(skb);

0 commit comments

Comments
 (0)