net: move secpath_exist helper to sk_buff.h
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>
This commit is contained in:
@@ -4097,12 +4097,19 @@ static inline void skb_init_secmark(struct sk_buff *skb)
|
|||||||
{ }
|
{ }
|
||||||
#endif
|
#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)
|
static inline bool skb_irq_freeable(const struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
return !skb->destructor &&
|
return !skb->destructor &&
|
||||||
#if IS_ENABLED(CONFIG_XFRM)
|
!secpath_exists(skb) &&
|
||||||
!skb->sp &&
|
|
||||||
#endif
|
|
||||||
!skb_nfct(skb) &&
|
!skb_nfct(skb) &&
|
||||||
!skb->_skb_refdst &&
|
!skb->_skb_refdst &&
|
||||||
!skb_has_frag_list(skb);
|
!skb_has_frag_list(skb);
|
||||||
|
|||||||
@@ -1107,15 +1107,6 @@ struct sec_path {
|
|||||||
struct xfrm_offload ovec[XFRM_MAX_OFFLOAD_DEPTH];
|
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 *
|
static inline struct sec_path *
|
||||||
secpath_get(struct sec_path *sp)
|
secpath_get(struct sec_path *sp)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ void nft_meta_get_eval(const struct nft_expr *expr,
|
|||||||
}
|
}
|
||||||
#ifdef CONFIG_XFRM
|
#ifdef CONFIG_XFRM
|
||||||
case NFT_META_SECPATH:
|
case NFT_META_SECPATH:
|
||||||
nft_reg_store8(dest, !!skb->sp);
|
nft_reg_store8(dest, secpath_exists(skb));
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_NF_TABLES_BRIDGE
|
#ifdef CONFIG_NF_TABLES_BRIDGE
|
||||||
|
|||||||
Reference in New Issue
Block a user