diff options
-rw-r--r-- | net/ipv4/esp4.c | 2 | ||||
-rw-r--r-- | net/ipv4/xfrm4_mode_beet.c | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c index 4e73e5708e70..21515d4c49eb 100644 --- a/net/ipv4/esp4.c +++ b/net/ipv4/esp4.c | |||
@@ -575,7 +575,7 @@ static int esp_init_state(struct xfrm_state *x) | |||
575 | crypto_aead_ivsize(aead); | 575 | crypto_aead_ivsize(aead); |
576 | if (x->props.mode == XFRM_MODE_TUNNEL) | 576 | if (x->props.mode == XFRM_MODE_TUNNEL) |
577 | x->props.header_len += sizeof(struct iphdr); | 577 | x->props.header_len += sizeof(struct iphdr); |
578 | else if (x->props.mode == XFRM_MODE_BEET) | 578 | else if (x->props.mode == XFRM_MODE_BEET && x->sel.family != AF_INET6) |
579 | x->props.header_len += IPV4_BEET_PHMAXLEN; | 579 | x->props.header_len += IPV4_BEET_PHMAXLEN; |
580 | if (x->encap) { | 580 | if (x->encap) { |
581 | struct xfrm_encap_tmpl *encap = x->encap; | 581 | struct xfrm_encap_tmpl *encap = x->encap; |
diff --git a/net/ipv4/xfrm4_mode_beet.c b/net/ipv4/xfrm4_mode_beet.c index 9c798abce736..63418185f524 100644 --- a/net/ipv4/xfrm4_mode_beet.c +++ b/net/ipv4/xfrm4_mode_beet.c | |||
@@ -47,8 +47,10 @@ static int xfrm4_beet_output(struct xfrm_state *x, struct sk_buff *skb) | |||
47 | if (unlikely(optlen)) | 47 | if (unlikely(optlen)) |
48 | hdrlen += IPV4_BEET_PHMAXLEN - (optlen & 4); | 48 | hdrlen += IPV4_BEET_PHMAXLEN - (optlen & 4); |
49 | 49 | ||
50 | skb_set_network_header(skb, IPV4_BEET_PHMAXLEN - x->props.header_len - | 50 | skb_set_network_header(skb, -x->props.header_len - |
51 | hdrlen); | 51 | hdrlen + (XFRM_MODE_SKB_CB(skb)->ihl - sizeof(*top_iph))); |
52 | if (x->sel.family != AF_INET6) | ||
53 | skb->network_header += IPV4_BEET_PHMAXLEN; | ||
52 | skb->mac_header = skb->network_header + | 54 | skb->mac_header = skb->network_header + |
53 | offsetof(struct iphdr, protocol); | 55 | offsetof(struct iphdr, protocol); |
54 | skb->transport_header = skb->network_header + sizeof(*top_iph); | 56 | skb->transport_header = skb->network_header + sizeof(*top_iph); |