]> err.no Git - linux-2.6/commitdiff
[IPSEC]: Kill unused decap state structure
authorHerbert Xu <herbert@gondor.apana.org.au>
Sat, 1 Apr 2006 08:54:16 +0000 (00:54 -0800)
committerDavid S. Miller <davem@davemloft.net>
Sat, 1 Apr 2006 08:54:16 +0000 (00:54 -0800)
This patch removes the *_decap_state structures which were previously
used to share state between input/post_input.  This is no longer
needed.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/xfrm.h
net/ipv4/xfrm4_input.c
net/ipv6/xfrm6_input.c
net/netfilter/xt_policy.c
net/xfrm/xfrm_input.c
net/xfrm/xfrm_policy.c

index c7612f4443ede6d9ebc111179e0ef75479d875c0..0d5529c382e8ce5d66fceac90f12c3dba7e51440 100644 (file)
@@ -242,7 +242,6 @@ extern int xfrm_state_unregister_afinfo(struct xfrm_state_afinfo *afinfo);
 
 extern void xfrm_state_delete_tunnel(struct xfrm_state *x);
 
-struct xfrm_decap_state;
 struct xfrm_type
 {
        char                    *description;
@@ -606,25 +605,11 @@ static inline void xfrm_dst_destroy(struct xfrm_dst *xdst)
 
 extern void xfrm_dst_ifdown(struct dst_entry *dst, struct net_device *dev);
 
-/* Decapsulation state, used by the input to store data during
- * decapsulation procedure, to be used later (during the policy
- * check
- */
-struct xfrm_decap_state {
-       char    decap_data[20];
-       __u16   decap_type;
-};   
-
-struct sec_decap_state {
-       struct xfrm_state       *xvec;
-       struct xfrm_decap_state decap;
-};
-
 struct sec_path
 {
        atomic_t                refcnt;
        int                     len;
-       struct sec_decap_state  x[XFRM_MAX_DEPTH];
+       struct xfrm_state       *xvec[XFRM_MAX_DEPTH];
 };
 
 static inline struct sec_path *
index 04ceb6e13b9d62e67c7ae05bbb27bc8408026921..e1b8f4b90d802bf430fb8ddaff53699882bba5b8 100644 (file)
@@ -68,7 +68,7 @@ int xfrm4_rcv_encap(struct sk_buff *skb, __u16 encap_type)
 {
        int err;
        u32 spi, seq;
-       struct sec_decap_state xfrm_vec[XFRM_MAX_DEPTH];
+       struct xfrm_state *xfrm_vec[XFRM_MAX_DEPTH];
        struct xfrm_state *x;
        int xfrm_nr = 0;
        int decaps = 0;
@@ -99,7 +99,6 @@ int xfrm4_rcv_encap(struct sk_buff *skb, __u16 encap_type)
                if (xfrm_state_check_expire(x))
                        goto drop_unlock;
 
-               xfrm_vec[xfrm_nr].decap.decap_type = encap_type;
                if (x->type->input(x, skb))
                        goto drop_unlock;
 
@@ -114,7 +113,7 @@ int xfrm4_rcv_encap(struct sk_buff *skb, __u16 encap_type)
 
                spin_unlock(&x->lock);
 
-               xfrm_vec[xfrm_nr++].xvec = x;
+               xfrm_vec[xfrm_nr++] = x;
 
                iph = skb->nh.iph;
 
@@ -156,7 +155,8 @@ int xfrm4_rcv_encap(struct sk_buff *skb, __u16 encap_type)
        if (xfrm_nr + skb->sp->len > XFRM_MAX_DEPTH)
                goto drop;
 
-       memcpy(skb->sp->x+skb->sp->len, xfrm_vec, xfrm_nr*sizeof(struct sec_decap_state));
+       memcpy(skb->sp->xvec + skb->sp->len, xfrm_vec,
+              xfrm_nr * sizeof(xfrm_vec[0]));
        skb->sp->len += xfrm_nr;
 
        nf_reset(skb);
@@ -187,7 +187,7 @@ drop_unlock:
        xfrm_state_put(x);
 drop:
        while (--xfrm_nr >= 0)
-               xfrm_state_put(xfrm_vec[xfrm_nr].xvec);
+               xfrm_state_put(xfrm_vec[xfrm_nr]);
 
        kfree_skb(skb);
        return 0;
index ec7a96e9fa644f63402a10d804e5b8fd383b23c5..00cfdee18dcac1e6fa5a95223c029426974a7f6c 100644 (file)
@@ -32,7 +32,7 @@ int xfrm6_rcv_spi(struct sk_buff *skb, u32 spi)
 {
        int err;
        u32 seq;
-       struct sec_decap_state xfrm_vec[XFRM_MAX_DEPTH];
+       struct xfrm_state *xfrm_vec[XFRM_MAX_DEPTH];
        struct xfrm_state *x;
        int xfrm_nr = 0;
        int decaps = 0;
@@ -79,7 +79,7 @@ int xfrm6_rcv_spi(struct sk_buff *skb, u32 spi)
 
                spin_unlock(&x->lock);
 
-               xfrm_vec[xfrm_nr++].xvec = x;
+               xfrm_vec[xfrm_nr++] = x;
 
                if (x->props.mode) { /* XXX */
                        if (nexthdr != IPPROTO_IPV6)
@@ -118,7 +118,8 @@ int xfrm6_rcv_spi(struct sk_buff *skb, u32 spi)
        if (xfrm_nr + skb->sp->len > XFRM_MAX_DEPTH)
                goto drop;
 
-       memcpy(skb->sp->x+skb->sp->len, xfrm_vec, xfrm_nr*sizeof(struct sec_decap_state));
+       memcpy(skb->sp->xvec + skb->sp->len, xfrm_vec,
+              xfrm_nr * sizeof(xfrm_vec[0]));
        skb->sp->len += xfrm_nr;
        skb->ip_summed = CHECKSUM_NONE;
 
@@ -149,7 +150,7 @@ drop_unlock:
        xfrm_state_put(x);
 drop:
        while (--xfrm_nr >= 0)
-               xfrm_state_put(xfrm_vec[xfrm_nr].xvec);
+               xfrm_state_put(xfrm_vec[xfrm_nr]);
        kfree_skb(skb);
        return -1;
 }
index 1099cb005fcc3c7dbf4a8ca4795862f2b093b1e0..a3aa62fbda6f1311b05d56ea16bd92050df49427 100644 (file)
@@ -71,7 +71,7 @@ match_policy_in(const struct sk_buff *skb, const struct xt_policy_info *info,
                        return 0;
                e = &info->pol[pos];
 
-               if (match_xfrm_state(sp->x[i].xvec, e, family)) {
+               if (match_xfrm_state(sp->xvec[i], e, family)) {
                        if (!strict)
                                return 1;
                } else if (strict)
index 2407a7072327f9156ea6e5771762bb6adc0f072b..b54971059f164136be5db7dbaea938548a4e4e15 100644 (file)
@@ -18,7 +18,7 @@ void __secpath_destroy(struct sec_path *sp)
 {
        int i;
        for (i = 0; i < sp->len; i++)
-               xfrm_state_put(sp->x[i].xvec);
+               xfrm_state_put(sp->xvec[i]);
        kmem_cache_free(secpath_cachep, sp);
 }
 EXPORT_SYMBOL(__secpath_destroy);
@@ -37,7 +37,7 @@ struct sec_path *secpath_dup(struct sec_path *src)
 
                memcpy(sp, src, sizeof(*sp));
                for (i = 0; i < sp->len; i++)
-                       xfrm_state_hold(sp->x[i].xvec);
+                       xfrm_state_hold(sp->xvec[i]);
        }
        atomic_set(&sp->refcnt, 1);
        return sp;
index f5eae9febd26acbfca587264794011ef420a87e5..c3725fe2a8fbae8057f5e772bd9582a795b4c7c7 100644 (file)
@@ -943,9 +943,9 @@ xfrm_policy_ok(struct xfrm_tmpl *tmpl, struct sec_path *sp, int start,
        } else
                start = -1;
        for (; idx < sp->len; idx++) {
-               if (xfrm_state_ok(tmpl, sp->x[idx].xvec, family))
+               if (xfrm_state_ok(tmpl, sp->xvec[idx], family))
                        return ++idx;
-               if (sp->x[idx].xvec->props.mode)
+               if (sp->xvec[idx]->props.mode)
                        break;
        }
        return start;
@@ -968,7 +968,7 @@ EXPORT_SYMBOL(xfrm_decode_session);
 static inline int secpath_has_tunnel(struct sec_path *sp, int k)
 {
        for (; k < sp->len; k++) {
-               if (sp->x[k].xvec->props.mode)
+               if (sp->xvec[k]->props.mode)
                        return 1;
        }
 
@@ -994,8 +994,8 @@ int __xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *skb,
                int i;
 
                for (i=skb->sp->len-1; i>=0; i--) {
-                       struct sec_decap_state *xvec = &(skb->sp->x[i]);
-                       if (!xfrm_selector_match(&xvec->xvec->sel, &fl, family))
+                       struct xfrm_state *x = skb->sp->xvec[i];
+                       if (!xfrm_selector_match(&x->sel, &fl, family))
                                return 0;
                }
        }