vserver 1.9.3
[linux-2.6.git] / net / ipv4 / ah4.c
index 9784f03..970fe58 100644 (file)
@@ -53,10 +53,10 @@ static int ip_clear_mutable_options(struct iphdr *iph, u32 *daddr)
        return 0;
 }
 
-static int ah_output(struct sk_buff **pskb)
+static int ah_output(struct sk_buff *skb)
 {
        int err;
-       struct dst_entry *dst = (*pskb)->dst;
+       struct dst_entry *dst = skb->dst;
        struct xfrm_state *x  = dst->xfrm;
        struct iphdr *iph, *top_iph;
        struct ip_auth_hdr *ah;
@@ -66,7 +66,7 @@ static int ah_output(struct sk_buff **pskb)
                char            buf[60];
        } tmp_iph;
 
-       top_iph = (*pskb)->nh.iph;
+       top_iph = skb->nh.iph;
        iph = &tmp_iph.iph;
 
        iph->tos = top_iph->tos;
@@ -85,7 +85,7 @@ static int ah_output(struct sk_buff **pskb)
        ah->nexthdr = top_iph->protocol;
 
        top_iph->tos = 0;
-       top_iph->tot_len = htons((*pskb)->len);
+       top_iph->tot_len = htons(skb->len);
        top_iph->frag_off = 0;
        top_iph->ttl = 0;
        top_iph->protocol = IPPROTO_AH;
@@ -98,7 +98,7 @@ static int ah_output(struct sk_buff **pskb)
        ah->reserved = 0;
        ah->spi = x->id.spi;
        ah->seq_no = htonl(++x->replay.oseq);
-       ahp->icv(ahp, *pskb, ah->auth_data);
+       ahp->icv(ahp, skb, ah->auth_data);
 
        top_iph->tos = iph->tos;
        top_iph->ttl = iph->ttl;
@@ -116,7 +116,7 @@ error:
        return err;
 }
 
-int ah_input(struct xfrm_state *x, struct xfrm_decap_state *decap, struct sk_buff *skb)
+static int ah_input(struct xfrm_state *x, struct xfrm_decap_state *decap, struct sk_buff *skb)
 {
        int ah_hlen;
        struct iphdr *iph;
@@ -184,7 +184,7 @@ out:
        return -EINVAL;
 }
 
-void ah4_err(struct sk_buff *skb, u32 info)
+static void ah4_err(struct sk_buff *skb, u32 info)
 {
        struct iphdr *iph = (struct iphdr*)skb->data;
        struct ip_auth_hdr *ah = (struct ip_auth_hdr*)(skb->data+(iph->ihl<<2));
@@ -214,6 +214,9 @@ static int ah_init_state(struct xfrm_state *x, void *args)
        if (x->aalg->alg_key_len > 512)
                goto error;
 
+       if (x->encap)
+               goto error;
+
        ahp = kmalloc(sizeof(*ahp), GFP_KERNEL);
        if (ahp == NULL)
                return -ENOMEM;