NetLabel: SELinux cleanups
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / security / selinux / include / selinux_netlabel.h
blob57943f4a8f90142ed1bf25feb54f721f08bb71f3
1 /*
2 * SELinux interface to the NetLabel subsystem
4 * Author : Paul Moore <paul.moore@hp.com>
6 */
8 /*
9 * (c) Copyright Hewlett-Packard Development Company, L.P., 2006
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.
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.
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
27 #ifndef _SELINUX_NETLABEL_H_
28 #define _SELINUX_NETLABEL_H_
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>
36 #include "avc.h"
37 #include "objsec.h"
39 #ifdef CONFIG_NETLABEL
40 void selinux_netlbl_cache_invalidate(void);
41 int selinux_netlbl_socket_post_create(struct socket *sock);
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);
49 void selinux_netlbl_sk_security_reset(struct sk_security_struct *ssec,
50 int family);
51 void selinux_netlbl_sk_security_init(struct sk_security_struct *ssec,
52 int family);
53 void selinux_netlbl_sk_security_clone(struct sk_security_struct *ssec,
54 struct sk_security_struct *newssec);
55 int selinux_netlbl_inode_permission(struct inode *inode, int mask);
56 int selinux_netlbl_socket_setsockopt(struct socket *sock,
57 int level,
58 int optname);
59 #else
60 static inline void selinux_netlbl_cache_invalidate(void)
62 return;
65 static inline int selinux_netlbl_socket_post_create(struct socket *sock)
67 return 0;
70 static inline void selinux_netlbl_sock_graft(struct sock *sk,
71 struct socket *sock)
73 return;
76 static inline u32 selinux_netlbl_inet_conn_request(struct sk_buff *skb,
77 u32 sock_sid)
79 return SECSID_NULL;
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)
86 return 0;
89 static inline u32 selinux_netlbl_socket_getpeersec_stream(struct socket *sock)
91 return SECSID_NULL;
94 static inline u32 selinux_netlbl_socket_getpeersec_dgram(struct sk_buff *skb)
96 return SECSID_NULL;
99 static inline void selinux_netlbl_sk_security_reset(
100 struct sk_security_struct *ssec,
101 int family)
103 return;
106 static inline void selinux_netlbl_sk_security_init(
107 struct sk_security_struct *ssec,
108 int family)
110 return;
113 static inline void selinux_netlbl_sk_security_clone(
114 struct sk_security_struct *ssec,
115 struct sk_security_struct *newssec)
117 return;
120 static inline int selinux_netlbl_inode_permission(struct inode *inode,
121 int mask)
123 return 0;
126 static inline int selinux_netlbl_socket_setsockopt(struct socket *sock,
127 int level,
128 int optname)
130 return 0;
132 #endif /* CONFIG_NETLABEL */
134 #endif