aboutsummaryrefslogtreecommitdiffstats
path: root/security/selinux/xfrm.c
diff options
context:
space:
mode:
authorVenkat Yekkirala <vyekkirala@TrustedCS.com>2006-08-05 02:12:42 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2006-09-22 17:53:27 -0400
commitbeb8d13bed80f8388f1a9a107d07ddd342e627e8 (patch)
tree19d5763b9b3b8ff3969997565e5ec0edd6e4bd33 /security/selinux/xfrm.c
parent4e2ba18eae7f370c7c3ed96eaca747cc9b39f917 (diff)
[MLSXFRM]: Add flow labeling
This labels the flows that could utilize IPSec xfrms at the points the flows are defined so that IPSec policy and SAs at the right label can be used. The following protos are currently not handled, but they should continue to be able to use single-labeled IPSec like they currently do. ipmr ip_gre ipip igmp sit sctp ip6_tunnel (IPv6 over IPv6 tunnel device) decnet Signed-off-by: Venkat Yekkirala <vyekkirala@TrustedCS.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'security/selinux/xfrm.c')
-rw-r--r--security/selinux/xfrm.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/security/selinux/xfrm.c b/security/selinux/xfrm.c
index a502b0540e3d..c750ef7af66f 100644
--- a/security/selinux/xfrm.c
+++ b/security/selinux/xfrm.c
@@ -158,11 +158,11 @@ int selinux_xfrm_flow_state_match(struct flowi *fl, struct xfrm_state *xfrm)
158 * LSM hook implementation that determines the sid for the session. 158 * LSM hook implementation that determines the sid for the session.
159 */ 159 */
160 160
161int selinux_xfrm_decode_session(struct sk_buff *skb, struct flowi *fl) 161int selinux_xfrm_decode_session(struct sk_buff *skb, u32 *sid, int ckall)
162{ 162{
163 struct sec_path *sp; 163 struct sec_path *sp;
164 164
165 fl->secid = SECSID_NULL; 165 *sid = SECSID_NULL;
166 166
167 if (skb == NULL) 167 if (skb == NULL)
168 return 0; 168 return 0;
@@ -177,10 +177,13 @@ int selinux_xfrm_decode_session(struct sk_buff *skb, struct flowi *fl)
177 struct xfrm_sec_ctx *ctx = x->security; 177 struct xfrm_sec_ctx *ctx = x->security;
178 178
179 if (!sid_set) { 179 if (!sid_set) {
180 fl->secid = ctx->ctx_sid; 180 *sid = ctx->ctx_sid;
181 sid_set = 1; 181 sid_set = 1;
182
183 if (!ckall)
184 break;
182 } 185 }
183 else if (fl->secid != ctx->ctx_sid) 186 else if (*sid != ctx->ctx_sid)
184 return -EINVAL; 187 return -EINVAL;
185 } 188 }
186 } 189 }