There is a strange glitch about secpath_put() and secpath_get() calls.

secpath_put() is called from __kfree_skb() only if CONFIG_XFRM is defined.

secpath_get() is called from skb_clone() and copy_skb_header() if CONFIG_INET is defined (!!!)

I think the intention was to use CONFIG_XFRM everywhere ?

If yes, we can save a 'struct sec_path' pointer from 'struct sk_buff' if ! CONFIG_XFRM

Signed-off-by: Eric Dumazet <[EMAIL PROTECTED]>

--- a/include/linux/skbuff.h    2006-03-13 18:30:21.000000000 +0100
+++ b/include/linux/skbuff.h    2006-03-13 18:38:27.000000000 +0100
@@ -243,7 +243,9 @@
        } mac;
 
        struct  dst_entry       *dst;
+#ifdef CONFIG_XFRM
        struct  sec_path        *sp;
+#endif
 
        /*
         * This is the control buffer. It is free to use for every
--- a/net/core/skbuff.c 2006-03-13 18:31:03.000000000 +0100
+++ b/net/core/skbuff.c 2006-03-13 18:39:01.000000000 +0100
@@ -415,9 +415,8 @@
        C(mac);
        C(dst);
        dst_clone(skb->dst);
-       C(sp);
-#ifdef CONFIG_INET
-       secpath_get(skb->sp);
+#ifdef CONFIG_XFRM
+       n->sp = secpath_get(skb->sp);
 #endif
        memcpy(n->cb, skb->cb, sizeof(skb->cb));
        C(len);
@@ -483,7 +482,7 @@
        new->priority   = old->priority;
        new->protocol   = old->protocol;
        new->dst        = dst_clone(old->dst);
-#ifdef CONFIG_INET
+#ifdef CONFIG_XFRM
        new->sp         = secpath_get(old->sp);
 #endif
        new->h.raw      = old->h.raw + offset;

Reply via email to