Commit | Line | Data |
---|---|---|
7420ed23 VY |
1 | /* |
2 | * SELinux interface to the NetLabel subsystem | |
3 | * | |
4 | * Author : Paul Moore <paul.moore@hp.com> | |
5 | * | |
6 | */ | |
7 | ||
8 | /* | |
9 | * (c) Copyright Hewlett-Packard Development Company, L.P., 2006 | |
10 | * | |
11 | * This program is free software; you can redistribute it and/or modify | |
12 | * it under the terms of the GNU General Public License as published by | |
13 | * the Free Software Foundation; either version 2 of the License, or | |
14 | * (at your option) any later version. | |
15 | * | |
16 | * This program is distributed in the hope that it will be useful, | |
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See | |
19 | * the GNU General Public License for more details. | |
20 | * | |
21 | * You should have received a copy of the GNU General Public License | |
22 | * along with this program; if not, write to the Free Software | |
23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
24 | * | |
25 | */ | |
26 | ||
27 | #ifndef _SELINUX_NETLABEL_H_ | |
28 | #define _SELINUX_NETLABEL_H_ | |
29 | ||
7a0e1d60 PM |
30 | #include <linux/types.h> |
31 | #include <linux/fs.h> | |
32 | #include <linux/net.h> | |
33 | #include <linux/skbuff.h> | |
34 | #include <net/sock.h> | |
35 | ||
36 | #include "avc.h" | |
37 | #include "objsec.h" | |
38 | ||
7420ed23 VY |
39 | #ifdef CONFIG_NETLABEL |
40 | void selinux_netlbl_cache_invalidate(void); | |
9f2ad665 | 41 | int selinux_netlbl_socket_post_create(struct socket *sock); |
7420ed23 VY |
42 | 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, | |
45 | struct sk_buff *skb, | |
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); | |
9f2ad665 PM |
49 | void selinux_netlbl_sk_security_reset(struct sk_security_struct *ssec, |
50 | int family); | |
99f59ed0 PM |
51 | void selinux_netlbl_sk_security_init(struct sk_security_struct *ssec, |
52 | int family); | |
9f2ad665 | 53 | void selinux_netlbl_sk_security_clone(struct sk_security_struct *ssec, |
99f59ed0 | 54 | struct sk_security_struct *newssec); |
e448e931 | 55 | int selinux_netlbl_inode_permission(struct inode *inode, int mask); |
f8687afe PM |
56 | int selinux_netlbl_socket_setsockopt(struct socket *sock, |
57 | int level, | |
58 | int optname); | |
7420ed23 VY |
59 | #else |
60 | static inline void selinux_netlbl_cache_invalidate(void) | |
61 | { | |
62 | return; | |
63 | } | |
64 | ||
9f2ad665 | 65 | static inline int selinux_netlbl_socket_post_create(struct socket *sock) |
7420ed23 VY |
66 | { |
67 | return 0; | |
68 | } | |
69 | ||
70 | static inline void selinux_netlbl_sock_graft(struct sock *sk, | |
71 | struct socket *sock) | |
72 | { | |
73 | return; | |
74 | } | |
75 | ||
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, | |
83 | struct sk_buff *skb, | |
84 | struct avc_audit_data *ad) | |
85 | { | |
86 | return 0; | |
87 | } | |
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 | ||
9f2ad665 PM |
99 | static inline void selinux_netlbl_sk_security_reset( |
100 | struct sk_security_struct *ssec, | |
101 | int family) | |
102 | { | |
103 | return; | |
104 | } | |
105 | ||
99f59ed0 PM |
106 | static inline void selinux_netlbl_sk_security_init( |
107 | struct sk_security_struct *ssec, | |
108 | int family) | |
109 | { | |
110 | return; | |
111 | } | |
112 | ||
9f2ad665 | 113 | static inline void selinux_netlbl_sk_security_clone( |
99f59ed0 PM |
114 | struct sk_security_struct *ssec, |
115 | struct sk_security_struct *newssec) | |
116 | { | |
117 | return; | |
118 | } | |
119 | ||
7420ed23 VY |
120 | static inline int selinux_netlbl_inode_permission(struct inode *inode, |
121 | int mask) | |
122 | { | |
123 | return 0; | |
124 | } | |
f8687afe PM |
125 | |
126 | static inline int selinux_netlbl_socket_setsockopt(struct socket *sock, | |
127 | int level, | |
128 | int optname) | |
129 | { | |
130 | return 0; | |
131 | } | |
7420ed23 VY |
132 | #endif /* CONFIG_NETLABEL */ |
133 | ||
134 | #endif |