Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d4b1e840629562953d81c9fe0a3a67473f3d993c
Commit:     d4b1e840629562953d81c9fe0a3a67473f3d993c
Parent:     04fef9893a1fa5d429522e09bc9591736408f2e8
Author:     Patrick McHardy <[EMAIL PROTECTED]>
AuthorDate: Thu Apr 5 15:59:41 2007 -0700
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Thu Apr 5 15:59:41 2007 -0700

    [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 <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 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 f8544b7..b94775a 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)
                if (!pskb_may_pull(skb, sizeof(*ph)))
                        goto out;
 
-               phlen = ph->hdrlen * 8;
-               optlen = phlen - ph->padlen - sizeof(*ph);
+               phlen = sizeof(*ph) + ph->padlen;
+               optlen = ph->hdrlen * 8 - phlen;
                if (optlen < 0 || optlen & 3 || optlen > 250)
                        goto out;
 
-               if (!pskb_may_pull(skb, phlen))
+               if (!pskb_may_pull(skb, phlen + optlen))
                        goto out;
 
                ph_nexthdr = ph->nexthdr;
        }
 
-       skb_push(skb, sizeof(*iph) - phlen + optlen);
-       memmove(skb->data, skb->nh.raw, sizeof(*iph));
-       skb->nh.raw = skb->data;
+       skb->nh.raw = skb->data + (phlen - sizeof(*iph));
+       memmove(skb->nh.raw, iph, sizeof(*iph));
+       skb->h.raw = skb->data + (phlen + optlen);
 
        iph = skb->nh.iph;
        iph->ihl = (sizeof(*iph) + optlen) / 4;
-       iph->tot_len = htons(skb->len);
+       iph->tot_len = htons(skb->len + iph->ihl * 4);
        iph->daddr = x->sel.daddr.a4;
        iph->saddr = x->sel.saddr.a4;
        if (ph_nexthdr)
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to