diff options
Diffstat (limited to 'net/ipv4/xfrm4_mode_beet.c')
-rw-r--r-- | net/ipv4/xfrm4_mode_beet.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/net/ipv4/xfrm4_mode_beet.c b/net/ipv4/xfrm4_mode_beet.c index f8544b7f02de..b94775a86863 100644 --- a/net/ipv4/xfrm4_mode_beet.c +++ b/net/ipv4/xfrm4_mode_beet.c | |||
@@ -83,24 +83,24 @@ static int xfrm4_beet_input(struct xfrm_state *x, struct sk_buff *skb) | |||
83 | if (!pskb_may_pull(skb, sizeof(*ph))) | 83 | if (!pskb_may_pull(skb, sizeof(*ph))) |
84 | goto out; | 84 | goto out; |
85 | 85 | ||
86 | phlen = ph->hdrlen * 8; | 86 | phlen = sizeof(*ph) + ph->padlen; |
87 | optlen = phlen - ph->padlen - sizeof(*ph); | 87 | optlen = ph->hdrlen * 8 - phlen; |
88 | if (optlen < 0 || optlen & 3 || optlen > 250) | 88 | if (optlen < 0 || optlen & 3 || optlen > 250) |
89 | goto out; | 89 | goto out; |
90 | 90 | ||
91 | if (!pskb_may_pull(skb, phlen)) | 91 | if (!pskb_may_pull(skb, phlen + optlen)) |
92 | goto out; | 92 | goto out; |
93 | 93 | ||
94 | ph_nexthdr = ph->nexthdr; | 94 | ph_nexthdr = ph->nexthdr; |
95 | } | 95 | } |
96 | 96 | ||
97 | skb_push(skb, sizeof(*iph) - phlen + optlen); | 97 | skb->nh.raw = skb->data + (phlen - sizeof(*iph)); |
98 | memmove(skb->data, skb->nh.raw, sizeof(*iph)); | 98 | memmove(skb->nh.raw, iph, sizeof(*iph)); |
99 | skb->nh.raw = skb->data; | 99 | skb->h.raw = skb->data + (phlen + optlen); |
100 | 100 | ||
101 | iph = skb->nh.iph; | 101 | iph = skb->nh.iph; |
102 | iph->ihl = (sizeof(*iph) + optlen) / 4; | 102 | iph->ihl = (sizeof(*iph) + optlen) / 4; |
103 | iph->tot_len = htons(skb->len); | 103 | iph->tot_len = htons(skb->len + iph->ihl * 4); |
104 | iph->daddr = x->sel.daddr.a4; | 104 | iph->daddr = x->sel.daddr.a4; |
105 | iph->saddr = x->sel.saddr.a4; | 105 | iph->saddr = x->sel.saddr.a4; |
106 | if (ph_nexthdr) | 106 | if (ph_nexthdr) |