aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2007-04-05 18:59:41 -0400
committerDavid S. Miller <davem@davemloft.net>2007-04-05 18:59:41 -0400
commitd4b1e840629562953d81c9fe0a3a67473f3d993c (patch)
treed20d023cfcb113207a1bb0a3bb18e2e8a48133d7 /net
parent04fef9893a1fa5d429522e09bc9591736408f2e8 (diff)
[XFRM]: beet: fix beet mode decapsulation
Beet mode decapsulation fails to properly set up the skb pointers, which only works by accident in combination with CONFIG_NETFILTER, since in that case the skb is fixed up in xfrm4_input before passing it to the netfilter hooks. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/xfrm4_mode_beet.c14
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)