net: move secpath_exist helper to sk_buff.h
authorFlorian Westphal <fw@strlen.de>
Tue, 18 Dec 2018 16:15:19 +0000 (17:15 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 19 Dec 2018 19:21:37 +0000 (11:21 -0800)
Future patch will remove skb->sp pointer.
To reduce noise in those patches, move existing helper to
sk_buff and use it in more places to ease skb->sp replacement later.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/skbuff.h
include/net/xfrm.h
net/netfilter/nft_meta.c

index 2f42d2e99f17fc32da6e4522a74780f9a476da40..70ac58240ec0eaeffa37f5b1d3e31e2c04ed0f2a 100644 (file)
@@ -4066,12 +4066,19 @@ static inline void skb_init_secmark(struct sk_buff *skb)
 { }
 #endif
 
+static inline int secpath_exists(const struct sk_buff *skb)
+{
+#ifdef CONFIG_XFRM
+       return skb->sp != NULL;
+#else
+       return 0;
+#endif
+}
+
 static inline bool skb_irq_freeable(const struct sk_buff *skb)
 {
        return !skb->destructor &&
-#if IS_ENABLED(CONFIG_XFRM)
-               !skb->sp &&
-#endif
+               !secpath_exists(skb) &&
                !skb_nfct(skb) &&
                !skb->_skb_refdst &&
                !skb_has_frag_list(skb);
index 62ca62177bc63c71ea28d6fc2f7717773a70cc80..9cb506d09b983bb14acbb881be1d32c03170e4d3 100644 (file)
@@ -1104,15 +1104,6 @@ struct sec_path {
        struct xfrm_offload     ovec[XFRM_MAX_OFFLOAD_DEPTH];
 };
 
-static inline int secpath_exists(struct sk_buff *skb)
-{
-#ifdef CONFIG_XFRM
-       return skb->sp != NULL;
-#else
-       return 0;
-#endif
-}
-
 static inline struct sec_path *
 secpath_get(struct sec_path *sp)
 {
index 6180626c3f80b9069e7af752f568a282e157cc3e..6df486c5ebd3bc04407e3ccb599769c439cecc2f 100644 (file)
@@ -229,7 +229,7 @@ void nft_meta_get_eval(const struct nft_expr *expr,
        }
 #ifdef CONFIG_XFRM
        case NFT_META_SECPATH:
-               nft_reg_store8(dest, !!skb->sp);
+               nft_reg_store8(dest, secpath_exists(skb));
                break;
 #endif
 #ifdef CONFIG_NF_TABLES_BRIDGE