1 /* SPDX-License-Identifier: GPL-2.0-or-later * << 2 /* 1 /* 3 * SELinux interface to the NetLabel subsystem 2 * SELinux interface to the NetLabel subsystem 4 * 3 * 5 * Author: Paul Moore <paul@paul-moore.com> 4 * Author: Paul Moore <paul@paul-moore.com> >> 5 * 6 */ 6 */ 7 7 8 /* 8 /* 9 * (c) Copyright Hewlett-Packard Development C 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 * 10 */ 25 */ 11 26 12 #ifndef _SELINUX_NETLABEL_H_ 27 #ifndef _SELINUX_NETLABEL_H_ 13 #define _SELINUX_NETLABEL_H_ 28 #define _SELINUX_NETLABEL_H_ 14 29 15 #include <linux/types.h> 30 #include <linux/types.h> 16 #include <linux/fs.h> 31 #include <linux/fs.h> 17 #include <linux/net.h> 32 #include <linux/net.h> 18 #include <linux/skbuff.h> 33 #include <linux/skbuff.h> 19 #include <net/sock.h> 34 #include <net/sock.h> 20 #include <net/request_sock.h> 35 #include <net/request_sock.h> 21 #include <net/sctp/structs.h> << 22 36 23 #include "avc.h" 37 #include "avc.h" 24 #include "objsec.h" 38 #include "objsec.h" 25 39 26 #ifdef CONFIG_NETLABEL 40 #ifdef CONFIG_NETLABEL 27 void selinux_netlbl_cache_invalidate(void); 41 void selinux_netlbl_cache_invalidate(void); 28 42 29 void selinux_netlbl_err(struct sk_buff *skb, u 43 void selinux_netlbl_err(struct sk_buff *skb, u16 family, int error, 30 int gateway); 44 int gateway); 31 45 32 void selinux_netlbl_sk_security_free(struct sk 46 void selinux_netlbl_sk_security_free(struct sk_security_struct *sksec); 33 void selinux_netlbl_sk_security_reset(struct s 47 void selinux_netlbl_sk_security_reset(struct sk_security_struct *sksec); 34 48 35 int selinux_netlbl_skbuff_getsid(struct sk_buf !! 49 int selinux_netlbl_skbuff_getsid(struct sk_buff *skb, >> 50 u16 family, >> 51 u32 *type, 36 u32 *sid); 52 u32 *sid); 37 int selinux_netlbl_skbuff_setsid(struct sk_buf !! 53 int selinux_netlbl_skbuff_setsid(struct sk_buff *skb, 38 int selinux_netlbl_sctp_assoc_request(struct s !! 54 u16 family, 39 struct s !! 55 u32 sid); >> 56 40 int selinux_netlbl_inet_conn_request(struct re 57 int selinux_netlbl_inet_conn_request(struct request_sock *req, u16 family); 41 void selinux_netlbl_inet_csk_clone(struct sock 58 void selinux_netlbl_inet_csk_clone(struct sock *sk, u16 family); 42 void selinux_netlbl_sctp_sk_clone(struct sock << 43 int selinux_netlbl_socket_post_create(struct s 59 int selinux_netlbl_socket_post_create(struct sock *sk, u16 family); 44 int selinux_netlbl_sock_rcv_skb(struct sk_secu 60 int selinux_netlbl_sock_rcv_skb(struct sk_security_struct *sksec, 45 struct sk_buff !! 61 struct sk_buff *skb, >> 62 u16 family, 46 struct common_ 63 struct common_audit_data *ad); 47 int selinux_netlbl_socket_setsockopt(struct so !! 64 int selinux_netlbl_socket_setsockopt(struct socket *sock, >> 65 int level, 48 int optna 66 int optname); 49 int selinux_netlbl_socket_connect(struct sock 67 int selinux_netlbl_socket_connect(struct sock *sk, struct sockaddr *addr); 50 int selinux_netlbl_socket_connect_locked(struc << 51 struc << 52 68 53 #else 69 #else 54 static inline void selinux_netlbl_cache_invali 70 static inline void selinux_netlbl_cache_invalidate(void) 55 { 71 { 56 return; 72 return; 57 } 73 } 58 74 59 static inline void selinux_netlbl_err(struct s !! 75 static inline void selinux_netlbl_err(struct sk_buff *skb, 60 int erro !! 76 u16 family, >> 77 int error, >> 78 int gateway) 61 { 79 { 62 return; 80 return; 63 } 81 } 64 82 65 static inline void !! 83 static inline void selinux_netlbl_sk_security_free( 66 selinux_netlbl_sk_security_free(struct sk_secu !! 84 struct sk_security_struct *sksec) 67 { 85 { 68 return; 86 return; 69 } 87 } 70 88 71 static inline void !! 89 static inline void selinux_netlbl_sk_security_reset( 72 selinux_netlbl_sk_security_reset(struct sk_sec !! 90 struct sk_security_struct *sksec) 73 { 91 { 74 return; 92 return; 75 } 93 } 76 94 77 static inline int selinux_netlbl_skbuff_getsid !! 95 static inline int selinux_netlbl_skbuff_getsid(struct sk_buff *skb, 78 !! 96 u16 family, >> 97 u32 *type, >> 98 u32 *sid) 79 { 99 { 80 *type = NETLBL_NLTYPE_NONE; 100 *type = NETLBL_NLTYPE_NONE; 81 *sid = SECSID_NULL; 101 *sid = SECSID_NULL; 82 return 0; 102 return 0; 83 } 103 } 84 static inline int selinux_netlbl_skbuff_setsid !! 104 static inline int selinux_netlbl_skbuff_setsid(struct sk_buff *skb, >> 105 u16 family, 85 106 u32 sid) 86 { 107 { 87 return 0; 108 return 0; 88 } 109 } 89 110 90 static inline int !! 111 static inline int selinux_netlbl_conn_setsid(struct sock *sk, 91 selinux_netlbl_sctp_assoc_request(struct sctp_ !! 112 struct sockaddr *addr) 92 struct sk_bu << 93 { 113 { 94 return 0; 114 return 0; 95 } 115 } >> 116 96 static inline int selinux_netlbl_inet_conn_req 117 static inline int selinux_netlbl_inet_conn_request(struct request_sock *req, 97 118 u16 family) 98 { 119 { 99 return 0; 120 return 0; 100 } 121 } 101 static inline void selinux_netlbl_inet_csk_clo 122 static inline void selinux_netlbl_inet_csk_clone(struct sock *sk, u16 family) 102 { 123 { 103 return; 124 return; 104 } 125 } 105 static inline void selinux_netlbl_sctp_sk_clon !! 126 static inline int selinux_netlbl_socket_post_create(struct sock *sk, 106 !! 127 u16 family) 107 { << 108 return; << 109 } << 110 static inline int selinux_netlbl_socket_post_c << 111 { 128 { 112 return 0; 129 return 0; 113 } 130 } 114 static inline int selinux_netlbl_sock_rcv_skb( 131 static inline int selinux_netlbl_sock_rcv_skb(struct sk_security_struct *sksec, 115 !! 132 struct sk_buff *skb, >> 133 u16 family, 116 134 struct common_audit_data *ad) 117 { 135 { 118 return 0; 136 return 0; 119 } 137 } 120 static inline int selinux_netlbl_socket_setsoc 138 static inline int selinux_netlbl_socket_setsockopt(struct socket *sock, 121 !! 139 int level, >> 140 int optname) 122 { 141 { 123 return 0; 142 return 0; 124 } 143 } 125 static inline int selinux_netlbl_socket_connec 144 static inline int selinux_netlbl_socket_connect(struct sock *sk, 126 145 struct sockaddr *addr) 127 { << 128 return 0; << 129 } << 130 static inline int selinux_netlbl_socket_connec << 131 << 132 { 146 { 133 return 0; 147 return 0; 134 } 148 } 135 #endif /* CONFIG_NETLABEL */ 149 #endif /* CONFIG_NETLABEL */ 136 150 137 #endif 151 #endif 138 152
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.