Commit c5027c9a authored by Patrick McHardy's avatar Patrick McHardy Committed by David S. Miller

[XFRM]: beet: fix IP option encapsulation

Beet mode calculates an incorrect value for the transport header location
when IP options are present, resulting in encapsulation errors.

The correct location is 4 or 8 bytes before the end of the original IP
header, depending on whether the pseudo header is padded.
Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4c4d51a7
...@@ -42,10 +42,9 @@ static int xfrm4_beet_output(struct xfrm_state *x, struct sk_buff *skb) ...@@ -42,10 +42,9 @@ static int xfrm4_beet_output(struct xfrm_state *x, struct sk_buff *skb)
skb->nh.raw = skb_push(skb, x->props.header_len + hdrlen); skb->nh.raw = skb_push(skb, x->props.header_len + hdrlen);
top_iph = skb->nh.iph; top_iph = skb->nh.iph;
hdrlen = iph->ihl * 4 - optlen; skb->h.raw += sizeof(*iph) - hdrlen;
skb->h.raw += hdrlen;
memmove(top_iph, iph, hdrlen); memmove(top_iph, iph, sizeof(*iph));
if (unlikely(optlen)) { if (unlikely(optlen)) {
struct ip_beet_phdr *ph; struct ip_beet_phdr *ph;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment