diff options
author | Paul Moore <paul.moore@hp.com> | 2006-11-17 17:38:54 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-03 00:24:14 -0500 |
commit | 3de4bab5b9f8848a0c16a4b1ffe0452f0d670237 (patch) | |
tree | f65c12b53bf2ad02645ea31522f67e7318019498 /security/selinux/include | |
parent | 9f2ad66509b182b399a5b03de487f45bde623524 (diff) |
SELinux: peer secid consolidation for external network labeling
Now that labeled IPsec makes use of the peer_sid field in the
sk_security_struct we can remove a lot of the special cases between labeled
IPsec and NetLabel. In addition, create a new function,
security_skb_extlbl_sid(), which we can use in several places to get the
security context of the packet's external label which allows us to further
simplify the code in a few places.
Signed-off-by: Paul Moore <paul.moore@hp.com>
Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'security/selinux/include')
-rw-r--r-- | security/selinux/include/security.h | 3 | ||||
-rw-r--r-- | security/selinux/include/selinux_netlabel.h | 28 | ||||
-rw-r--r-- | security/selinux/include/xfrm.h | 5 |
3 files changed, 12 insertions, 24 deletions
diff --git a/security/selinux/include/security.h b/security/selinux/include/security.h index 1ef79172cc8c..015f697e925f 100644 --- a/security/selinux/include/security.h +++ b/security/selinux/include/security.h | |||
@@ -8,6 +8,7 @@ | |||
8 | #ifndef _SELINUX_SECURITY_H_ | 8 | #ifndef _SELINUX_SECURITY_H_ |
9 | #define _SELINUX_SECURITY_H_ | 9 | #define _SELINUX_SECURITY_H_ |
10 | 10 | ||
11 | #include <linux/skbuff.h> | ||
11 | #include "flask.h" | 12 | #include "flask.h" |
12 | 13 | ||
13 | #define SECSID_NULL 0x00000000 /* unspecified SID */ | 14 | #define SECSID_NULL 0x00000000 /* unspecified SID */ |
@@ -80,6 +81,8 @@ int security_netif_sid(char *name, u32 *if_sid, | |||
80 | int security_node_sid(u16 domain, void *addr, u32 addrlen, | 81 | int security_node_sid(u16 domain, void *addr, u32 addrlen, |
81 | u32 *out_sid); | 82 | u32 *out_sid); |
82 | 83 | ||
84 | void security_skb_extlbl_sid(struct sk_buff *skb, u32 base_sid, u32 *sid); | ||
85 | |||
83 | int security_validate_transition(u32 oldsid, u32 newsid, u32 tasksid, | 86 | int security_validate_transition(u32 oldsid, u32 newsid, u32 tasksid, |
84 | u16 tclass); | 87 | u16 tclass); |
85 | 88 | ||
diff --git a/security/selinux/include/selinux_netlabel.h b/security/selinux/include/selinux_netlabel.h index 57943f4a8f90..2a732c9033e3 100644 --- a/security/selinux/include/selinux_netlabel.h +++ b/security/selinux/include/selinux_netlabel.h | |||
@@ -38,14 +38,12 @@ | |||
38 | 38 | ||
39 | #ifdef CONFIG_NETLABEL | 39 | #ifdef CONFIG_NETLABEL |
40 | void selinux_netlbl_cache_invalidate(void); | 40 | void selinux_netlbl_cache_invalidate(void); |
41 | int selinux_netlbl_skbuff_getsid(struct sk_buff *skb, u32 base_sid, u32 *sid); | ||
41 | int selinux_netlbl_socket_post_create(struct socket *sock); | 42 | int selinux_netlbl_socket_post_create(struct socket *sock); |
42 | void selinux_netlbl_sock_graft(struct sock *sk, struct socket *sock); | 43 | void selinux_netlbl_sock_graft(struct sock *sk, struct socket *sock); |
43 | u32 selinux_netlbl_inet_conn_request(struct sk_buff *skb, u32 sock_sid); | ||
44 | int selinux_netlbl_sock_rcv_skb(struct sk_security_struct *sksec, | 44 | int selinux_netlbl_sock_rcv_skb(struct sk_security_struct *sksec, |
45 | struct sk_buff *skb, | 45 | struct sk_buff *skb, |
46 | struct avc_audit_data *ad); | 46 | struct avc_audit_data *ad); |
47 | u32 selinux_netlbl_socket_getpeersec_stream(struct socket *sock); | ||
48 | u32 selinux_netlbl_socket_getpeersec_dgram(struct sk_buff *skb); | ||
49 | void selinux_netlbl_sk_security_reset(struct sk_security_struct *ssec, | 47 | void selinux_netlbl_sk_security_reset(struct sk_security_struct *ssec, |
50 | int family); | 48 | int family); |
51 | void selinux_netlbl_sk_security_init(struct sk_security_struct *ssec, | 49 | void selinux_netlbl_sk_security_init(struct sk_security_struct *ssec, |
@@ -62,6 +60,14 @@ static inline void selinux_netlbl_cache_invalidate(void) | |||
62 | return; | 60 | return; |
63 | } | 61 | } |
64 | 62 | ||
63 | static inline int selinux_netlbl_skbuff_getsid(struct sk_buff *skb, | ||
64 | u32 base_sid, | ||
65 | u32 *sid) | ||
66 | { | ||
67 | *sid = SECSID_NULL; | ||
68 | return 0; | ||
69 | } | ||
70 | |||
65 | static inline int selinux_netlbl_socket_post_create(struct socket *sock) | 71 | static inline int selinux_netlbl_socket_post_create(struct socket *sock) |
66 | { | 72 | { |
67 | return 0; | 73 | return 0; |
@@ -73,12 +79,6 @@ static inline void selinux_netlbl_sock_graft(struct sock *sk, | |||
73 | return; | 79 | return; |
74 | } | 80 | } |
75 | 81 | ||
76 | static inline u32 selinux_netlbl_inet_conn_request(struct sk_buff *skb, | ||
77 | u32 sock_sid) | ||
78 | { | ||
79 | return SECSID_NULL; | ||
80 | } | ||
81 | |||
82 | static inline int selinux_netlbl_sock_rcv_skb(struct sk_security_struct *sksec, | 82 | static inline int selinux_netlbl_sock_rcv_skb(struct sk_security_struct *sksec, |
83 | struct sk_buff *skb, | 83 | struct sk_buff *skb, |
84 | struct avc_audit_data *ad) | 84 | struct avc_audit_data *ad) |
@@ -86,16 +86,6 @@ static inline int selinux_netlbl_sock_rcv_skb(struct sk_security_struct *sksec, | |||
86 | return 0; | 86 | return 0; |
87 | } | 87 | } |
88 | 88 | ||
89 | static inline u32 selinux_netlbl_socket_getpeersec_stream(struct socket *sock) | ||
90 | { | ||
91 | return SECSID_NULL; | ||
92 | } | ||
93 | |||
94 | static inline u32 selinux_netlbl_socket_getpeersec_dgram(struct sk_buff *skb) | ||
95 | { | ||
96 | return SECSID_NULL; | ||
97 | } | ||
98 | |||
99 | static inline void selinux_netlbl_sk_security_reset( | 89 | static inline void selinux_netlbl_sk_security_reset( |
100 | struct sk_security_struct *ssec, | 90 | struct sk_security_struct *ssec, |
101 | int family) | 91 | int family) |
diff --git a/security/selinux/include/xfrm.h b/security/selinux/include/xfrm.h index ebd7246a4be5..161eb571c82d 100644 --- a/security/selinux/include/xfrm.h +++ b/security/selinux/include/xfrm.h | |||
@@ -36,7 +36,6 @@ int selinux_xfrm_sock_rcv_skb(u32 sid, struct sk_buff *skb, | |||
36 | struct avc_audit_data *ad); | 36 | struct avc_audit_data *ad); |
37 | int selinux_xfrm_postroute_last(u32 isec_sid, struct sk_buff *skb, | 37 | int selinux_xfrm_postroute_last(u32 isec_sid, struct sk_buff *skb, |
38 | struct avc_audit_data *ad, u8 proto); | 38 | struct avc_audit_data *ad, u8 proto); |
39 | u32 selinux_socket_getpeer_dgram(struct sk_buff *skb); | ||
40 | int selinux_xfrm_decode_session(struct sk_buff *skb, u32 *sid, int ckall); | 39 | int selinux_xfrm_decode_session(struct sk_buff *skb, u32 *sid, int ckall); |
41 | #else | 40 | #else |
42 | static inline int selinux_xfrm_sock_rcv_skb(u32 isec_sid, struct sk_buff *skb, | 41 | static inline int selinux_xfrm_sock_rcv_skb(u32 isec_sid, struct sk_buff *skb, |
@@ -51,10 +50,6 @@ static inline int selinux_xfrm_postroute_last(u32 isec_sid, struct sk_buff *skb, | |||
51 | return 0; | 50 | return 0; |
52 | } | 51 | } |
53 | 52 | ||
54 | static inline int selinux_socket_getpeer_dgram(struct sk_buff *skb) | ||
55 | { | ||
56 | return SECSID_NULL; | ||
57 | } | ||
58 | static inline int selinux_xfrm_decode_session(struct sk_buff *skb, u32 *sid, int ckall) | 53 | static inline int selinux_xfrm_decode_session(struct sk_buff *skb, u32 *sid, int ckall) |
59 | { | 54 | { |
60 | *sid = SECSID_NULL; | 55 | *sid = SECSID_NULL; |