diff options
Diffstat (limited to 'include/linux/security.h')
-rw-r--r-- | include/linux/security.h | 56 |
1 files changed, 25 insertions, 31 deletions
diff --git a/include/linux/security.h b/include/linux/security.h index b200b9856f32..83cdefae9931 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
@@ -826,6 +826,8 @@ struct request_sock; | |||
826 | * Sets the openreq's sid to socket's sid with MLS portion taken from peer sid. | 826 | * Sets the openreq's sid to socket's sid with MLS portion taken from peer sid. |
827 | * @inet_csk_clone: | 827 | * @inet_csk_clone: |
828 | * Sets the new child socket's sid to the openreq sid. | 828 | * Sets the new child socket's sid to the openreq sid. |
829 | * @inet_conn_established: | ||
830 | * Sets the connection's peersid to the secmark on skb. | ||
829 | * @req_classify_flow: | 831 | * @req_classify_flow: |
830 | * Sets the flow's sid to the openreq sid. | 832 | * Sets the flow's sid to the openreq sid. |
831 | * | 833 | * |
@@ -836,10 +838,8 @@ struct request_sock; | |||
836 | * used by the XFRM system. | 838 | * used by the XFRM system. |
837 | * @sec_ctx contains the security context information being provided by | 839 | * @sec_ctx contains the security context information being provided by |
838 | * the user-level policy update program (e.g., setkey). | 840 | * the user-level policy update program (e.g., setkey). |
839 | * @sk refers to the sock from which to derive the security context. | ||
840 | * Allocate a security structure to the xp->security field; the security | 841 | * Allocate a security structure to the xp->security field; the security |
841 | * field is initialized to NULL when the xfrm_policy is allocated. Only | 842 | * field is initialized to NULL when the xfrm_policy is allocated. |
842 | * one of sec_ctx or sock can be specified. | ||
843 | * Return 0 if operation was successful (memory to allocate, legal context) | 843 | * Return 0 if operation was successful (memory to allocate, legal context) |
844 | * @xfrm_policy_clone_security: | 844 | * @xfrm_policy_clone_security: |
845 | * @old contains an existing xfrm_policy in the SPD. | 845 | * @old contains an existing xfrm_policy in the SPD. |
@@ -858,9 +858,6 @@ struct request_sock; | |||
858 | * Database by the XFRM system. | 858 | * Database by the XFRM system. |
859 | * @sec_ctx contains the security context information being provided by | 859 | * @sec_ctx contains the security context information being provided by |
860 | * the user-level SA generation program (e.g., setkey or racoon). | 860 | * the user-level SA generation program (e.g., setkey or racoon). |
861 | * @polsec contains the security context information associated with a xfrm | ||
862 | * policy rule from which to take the base context. polsec must be NULL | ||
863 | * when sec_ctx is specified. | ||
864 | * @secid contains the secid from which to take the mls portion of the context. | 861 | * @secid contains the secid from which to take the mls portion of the context. |
865 | * Allocate a security structure to the x->security field; the security | 862 | * Allocate a security structure to the x->security field; the security |
866 | * field is initialized to NULL when the xfrm_state is allocated. Set the | 863 | * field is initialized to NULL when the xfrm_state is allocated. Set the |
@@ -889,11 +886,6 @@ struct request_sock; | |||
889 | * @xp contains the policy to check for a match. | 886 | * @xp contains the policy to check for a match. |
890 | * @fl contains the flow to check for a match. | 887 | * @fl contains the flow to check for a match. |
891 | * Return 1 if there is a match. | 888 | * Return 1 if there is a match. |
892 | * @xfrm_flow_state_match: | ||
893 | * @fl contains the flow key to match. | ||
894 | * @xfrm points to the xfrm_state to match. | ||
895 | * @xp points to the xfrm_policy to match. | ||
896 | * Return 1 if there is a match. | ||
897 | * @xfrm_decode_session: | 889 | * @xfrm_decode_session: |
898 | * @skb points to skb to decode. | 890 | * @skb points to skb to decode. |
899 | * @secid points to the flow key secid to set. | 891 | * @secid points to the flow key secid to set. |
@@ -1373,25 +1365,24 @@ struct security_operations { | |||
1373 | int (*inet_conn_request)(struct sock *sk, struct sk_buff *skb, | 1365 | int (*inet_conn_request)(struct sock *sk, struct sk_buff *skb, |
1374 | struct request_sock *req); | 1366 | struct request_sock *req); |
1375 | void (*inet_csk_clone)(struct sock *newsk, const struct request_sock *req); | 1367 | void (*inet_csk_clone)(struct sock *newsk, const struct request_sock *req); |
1368 | void (*inet_conn_established)(struct sock *sk, struct sk_buff *skb); | ||
1376 | void (*req_classify_flow)(const struct request_sock *req, struct flowi *fl); | 1369 | void (*req_classify_flow)(const struct request_sock *req, struct flowi *fl); |
1377 | #endif /* CONFIG_SECURITY_NETWORK */ | 1370 | #endif /* CONFIG_SECURITY_NETWORK */ |
1378 | 1371 | ||
1379 | #ifdef CONFIG_SECURITY_NETWORK_XFRM | 1372 | #ifdef CONFIG_SECURITY_NETWORK_XFRM |
1380 | int (*xfrm_policy_alloc_security) (struct xfrm_policy *xp, | 1373 | int (*xfrm_policy_alloc_security) (struct xfrm_policy *xp, |
1381 | struct xfrm_user_sec_ctx *sec_ctx, struct sock *sk); | 1374 | struct xfrm_user_sec_ctx *sec_ctx); |
1382 | int (*xfrm_policy_clone_security) (struct xfrm_policy *old, struct xfrm_policy *new); | 1375 | int (*xfrm_policy_clone_security) (struct xfrm_policy *old, struct xfrm_policy *new); |
1383 | void (*xfrm_policy_free_security) (struct xfrm_policy *xp); | 1376 | void (*xfrm_policy_free_security) (struct xfrm_policy *xp); |
1384 | int (*xfrm_policy_delete_security) (struct xfrm_policy *xp); | 1377 | int (*xfrm_policy_delete_security) (struct xfrm_policy *xp); |
1385 | int (*xfrm_state_alloc_security) (struct xfrm_state *x, | 1378 | int (*xfrm_state_alloc_security) (struct xfrm_state *x, |
1386 | struct xfrm_user_sec_ctx *sec_ctx, struct xfrm_sec_ctx *polsec, | 1379 | struct xfrm_user_sec_ctx *sec_ctx, |
1387 | u32 secid); | 1380 | u32 secid); |
1388 | void (*xfrm_state_free_security) (struct xfrm_state *x); | 1381 | void (*xfrm_state_free_security) (struct xfrm_state *x); |
1389 | int (*xfrm_state_delete_security) (struct xfrm_state *x); | 1382 | int (*xfrm_state_delete_security) (struct xfrm_state *x); |
1390 | int (*xfrm_policy_lookup)(struct xfrm_policy *xp, u32 fl_secid, u8 dir); | 1383 | int (*xfrm_policy_lookup)(struct xfrm_policy *xp, u32 fl_secid, u8 dir); |
1391 | int (*xfrm_state_pol_flow_match)(struct xfrm_state *x, | 1384 | int (*xfrm_state_pol_flow_match)(struct xfrm_state *x, |
1392 | struct xfrm_policy *xp, struct flowi *fl); | 1385 | struct xfrm_policy *xp, struct flowi *fl); |
1393 | int (*xfrm_flow_state_match)(struct flowi *fl, struct xfrm_state *xfrm, | ||
1394 | struct xfrm_policy *xp); | ||
1395 | int (*xfrm_decode_session)(struct sk_buff *skb, u32 *secid, int ckall); | 1386 | int (*xfrm_decode_session)(struct sk_buff *skb, u32 *secid, int ckall); |
1396 | #endif /* CONFIG_SECURITY_NETWORK_XFRM */ | 1387 | #endif /* CONFIG_SECURITY_NETWORK_XFRM */ |
1397 | 1388 | ||
@@ -2966,9 +2957,15 @@ static inline void security_inet_csk_clone(struct sock *newsk, | |||
2966 | { | 2957 | { |
2967 | security_ops->inet_csk_clone(newsk, req); | 2958 | security_ops->inet_csk_clone(newsk, req); |
2968 | } | 2959 | } |
2960 | |||
2961 | static inline void security_inet_conn_established(struct sock *sk, | ||
2962 | struct sk_buff *skb) | ||
2963 | { | ||
2964 | security_ops->inet_conn_established(sk, skb); | ||
2965 | } | ||
2969 | #else /* CONFIG_SECURITY_NETWORK */ | 2966 | #else /* CONFIG_SECURITY_NETWORK */ |
2970 | static inline int security_unix_stream_connect(struct socket * sock, | 2967 | static inline int security_unix_stream_connect(struct socket * sock, |
2971 | struct socket * other, | 2968 | struct socket * other, |
2972 | struct sock * newsk) | 2969 | struct sock * newsk) |
2973 | { | 2970 | { |
2974 | return 0; | 2971 | return 0; |
@@ -3115,12 +3112,17 @@ static inline void security_inet_csk_clone(struct sock *newsk, | |||
3115 | const struct request_sock *req) | 3112 | const struct request_sock *req) |
3116 | { | 3113 | { |
3117 | } | 3114 | } |
3115 | |||
3116 | static inline void security_inet_conn_established(struct sock *sk, | ||
3117 | struct sk_buff *skb) | ||
3118 | { | ||
3119 | } | ||
3118 | #endif /* CONFIG_SECURITY_NETWORK */ | 3120 | #endif /* CONFIG_SECURITY_NETWORK */ |
3119 | 3121 | ||
3120 | #ifdef CONFIG_SECURITY_NETWORK_XFRM | 3122 | #ifdef CONFIG_SECURITY_NETWORK_XFRM |
3121 | static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx) | 3123 | static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx) |
3122 | { | 3124 | { |
3123 | return security_ops->xfrm_policy_alloc_security(xp, sec_ctx, NULL); | 3125 | return security_ops->xfrm_policy_alloc_security(xp, sec_ctx); |
3124 | } | 3126 | } |
3125 | 3127 | ||
3126 | static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new) | 3128 | static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new) |
@@ -3141,7 +3143,7 @@ static inline int security_xfrm_policy_delete(struct xfrm_policy *xp) | |||
3141 | static inline int security_xfrm_state_alloc(struct xfrm_state *x, | 3143 | static inline int security_xfrm_state_alloc(struct xfrm_state *x, |
3142 | struct xfrm_user_sec_ctx *sec_ctx) | 3144 | struct xfrm_user_sec_ctx *sec_ctx) |
3143 | { | 3145 | { |
3144 | return security_ops->xfrm_state_alloc_security(x, sec_ctx, NULL, 0); | 3146 | return security_ops->xfrm_state_alloc_security(x, sec_ctx, 0); |
3145 | } | 3147 | } |
3146 | 3148 | ||
3147 | static inline int security_xfrm_state_alloc_acquire(struct xfrm_state *x, | 3149 | static inline int security_xfrm_state_alloc_acquire(struct xfrm_state *x, |
@@ -3149,7 +3151,11 @@ static inline int security_xfrm_state_alloc_acquire(struct xfrm_state *x, | |||
3149 | { | 3151 | { |
3150 | if (!polsec) | 3152 | if (!polsec) |
3151 | return 0; | 3153 | return 0; |
3152 | return security_ops->xfrm_state_alloc_security(x, NULL, polsec, secid); | 3154 | /* |
3155 | * We want the context to be taken from secid which is usually | ||
3156 | * from the sock. | ||
3157 | */ | ||
3158 | return security_ops->xfrm_state_alloc_security(x, NULL, secid); | ||
3153 | } | 3159 | } |
3154 | 3160 | ||
3155 | static inline int security_xfrm_state_delete(struct xfrm_state *x) | 3161 | static inline int security_xfrm_state_delete(struct xfrm_state *x) |
@@ -3173,12 +3179,6 @@ static inline int security_xfrm_state_pol_flow_match(struct xfrm_state *x, | |||
3173 | return security_ops->xfrm_state_pol_flow_match(x, xp, fl); | 3179 | return security_ops->xfrm_state_pol_flow_match(x, xp, fl); |
3174 | } | 3180 | } |
3175 | 3181 | ||
3176 | static inline int security_xfrm_flow_state_match(struct flowi *fl, | ||
3177 | struct xfrm_state *xfrm, struct xfrm_policy *xp) | ||
3178 | { | ||
3179 | return security_ops->xfrm_flow_state_match(fl, xfrm, xp); | ||
3180 | } | ||
3181 | |||
3182 | static inline int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid) | 3182 | static inline int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid) |
3183 | { | 3183 | { |
3184 | return security_ops->xfrm_decode_session(skb, secid, 1); | 3184 | return security_ops->xfrm_decode_session(skb, secid, 1); |
@@ -3242,12 +3242,6 @@ static inline int security_xfrm_state_pol_flow_match(struct xfrm_state *x, | |||
3242 | return 1; | 3242 | return 1; |
3243 | } | 3243 | } |
3244 | 3244 | ||
3245 | static inline int security_xfrm_flow_state_match(struct flowi *fl, | ||
3246 | struct xfrm_state *xfrm, struct xfrm_policy *xp) | ||
3247 | { | ||
3248 | return 1; | ||
3249 | } | ||
3250 | |||
3251 | static inline int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid) | 3245 | static inline int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid) |
3252 | { | 3246 | { |
3253 | return 0; | 3247 | return 0; |