interconnect: Add a common standard aggregate function
[linux/fpc-iii.git] / security / selinux / include / xfrm.h
bloba0b46531629228745b5229769a5e92f2eb056704
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * SELinux support for the XFRM LSM hooks
5 * Author : Trent Jaeger, <jaegert@us.ibm.com>
6 * Updated : Venkat Yekkirala, <vyekkirala@TrustedCS.com>
7 */
8 #ifndef _SELINUX_XFRM_H_
9 #define _SELINUX_XFRM_H_
11 #include <net/flow.h>
13 int selinux_xfrm_policy_alloc(struct xfrm_sec_ctx **ctxp,
14 struct xfrm_user_sec_ctx *uctx,
15 gfp_t gfp);
16 int selinux_xfrm_policy_clone(struct xfrm_sec_ctx *old_ctx,
17 struct xfrm_sec_ctx **new_ctxp);
18 void selinux_xfrm_policy_free(struct xfrm_sec_ctx *ctx);
19 int selinux_xfrm_policy_delete(struct xfrm_sec_ctx *ctx);
20 int selinux_xfrm_state_alloc(struct xfrm_state *x,
21 struct xfrm_user_sec_ctx *uctx);
22 int selinux_xfrm_state_alloc_acquire(struct xfrm_state *x,
23 struct xfrm_sec_ctx *polsec, u32 secid);
24 void selinux_xfrm_state_free(struct xfrm_state *x);
25 int selinux_xfrm_state_delete(struct xfrm_state *x);
26 int selinux_xfrm_policy_lookup(struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir);
27 int selinux_xfrm_state_pol_flow_match(struct xfrm_state *x,
28 struct xfrm_policy *xp,
29 const struct flowi *fl);
31 #ifdef CONFIG_SECURITY_NETWORK_XFRM
32 extern atomic_t selinux_xfrm_refcount;
34 static inline int selinux_xfrm_enabled(void)
36 return (atomic_read(&selinux_xfrm_refcount) > 0);
39 int selinux_xfrm_sock_rcv_skb(u32 sk_sid, struct sk_buff *skb,
40 struct common_audit_data *ad);
41 int selinux_xfrm_postroute_last(u32 sk_sid, struct sk_buff *skb,
42 struct common_audit_data *ad, u8 proto);
43 int selinux_xfrm_decode_session(struct sk_buff *skb, u32 *sid, int ckall);
44 int selinux_xfrm_skb_sid(struct sk_buff *skb, u32 *sid);
46 static inline void selinux_xfrm_notify_policyload(void)
48 struct net *net;
50 down_read(&net_rwsem);
51 for_each_net(net)
52 rt_genid_bump_all(net);
53 up_read(&net_rwsem);
55 #else
56 static inline int selinux_xfrm_enabled(void)
58 return 0;
61 static inline int selinux_xfrm_sock_rcv_skb(u32 sk_sid, struct sk_buff *skb,
62 struct common_audit_data *ad)
64 return 0;
67 static inline int selinux_xfrm_postroute_last(u32 sk_sid, struct sk_buff *skb,
68 struct common_audit_data *ad,
69 u8 proto)
71 return 0;
74 static inline int selinux_xfrm_decode_session(struct sk_buff *skb, u32 *sid,
75 int ckall)
77 *sid = SECSID_NULL;
78 return 0;
81 static inline void selinux_xfrm_notify_policyload(void)
85 static inline int selinux_xfrm_skb_sid(struct sk_buff *skb, u32 *sid)
87 *sid = SECSID_NULL;
88 return 0;
90 #endif
92 #endif /* _SELINUX_XFRM_H_ */