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, see <http://www.gnu.org/licenses/>. >> 23 * 10 */ 24 */ 11 25 12 #ifndef _SELINUX_NETLABEL_H_ 26 #ifndef _SELINUX_NETLABEL_H_ 13 #define _SELINUX_NETLABEL_H_ 27 #define _SELINUX_NETLABEL_H_ 14 28 15 #include <linux/types.h> 29 #include <linux/types.h> 16 #include <linux/fs.h> 30 #include <linux/fs.h> 17 #include <linux/net.h> 31 #include <linux/net.h> 18 #include <linux/skbuff.h> 32 #include <linux/skbuff.h> 19 #include <net/sock.h> 33 #include <net/sock.h> 20 #include <net/request_sock.h> 34 #include <net/request_sock.h> 21 #include <net/sctp/structs.h> 35 #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 int selinux_netlbl_sctp_assoc_request(struct sctp_endpoint *ep, >> 57 struct sk_buff *skb); 40 int selinux_netlbl_inet_conn_request(struct re 58 int selinux_netlbl_inet_conn_request(struct request_sock *req, u16 family); 41 void selinux_netlbl_inet_csk_clone(struct sock 59 void selinux_netlbl_inet_csk_clone(struct sock *sk, u16 family); 42 void selinux_netlbl_sctp_sk_clone(struct sock 60 void selinux_netlbl_sctp_sk_clone(struct sock *sk, struct sock *newsk); 43 int selinux_netlbl_socket_post_create(struct s 61 int selinux_netlbl_socket_post_create(struct sock *sk, u16 family); 44 int selinux_netlbl_sock_rcv_skb(struct sk_secu 62 int selinux_netlbl_sock_rcv_skb(struct sk_security_struct *sksec, 45 struct sk_buff !! 63 struct sk_buff *skb, >> 64 u16 family, 46 struct common_ 65 struct common_audit_data *ad); 47 int selinux_netlbl_socket_setsockopt(struct so !! 66 int selinux_netlbl_socket_setsockopt(struct socket *sock, >> 67 int level, 48 int optna 68 int optname); 49 int selinux_netlbl_socket_connect(struct sock 69 int selinux_netlbl_socket_connect(struct sock *sk, struct sockaddr *addr); 50 int selinux_netlbl_socket_connect_locked(struc 70 int selinux_netlbl_socket_connect_locked(struct sock *sk, 51 struc 71 struct sockaddr *addr); 52 72 53 #else 73 #else 54 static inline void selinux_netlbl_cache_invali 74 static inline void selinux_netlbl_cache_invalidate(void) 55 { 75 { 56 return; 76 return; 57 } 77 } 58 78 59 static inline void selinux_netlbl_err(struct s !! 79 static inline void selinux_netlbl_err(struct sk_buff *skb, 60 int erro !! 80 u16 family, >> 81 int error, >> 82 int gateway) 61 { 83 { 62 return; 84 return; 63 } 85 } 64 86 65 static inline void !! 87 static inline void selinux_netlbl_sk_security_free( 66 selinux_netlbl_sk_security_free(struct sk_secu !! 88 struct sk_security_struct *sksec) 67 { 89 { 68 return; 90 return; 69 } 91 } 70 92 71 static inline void !! 93 static inline void selinux_netlbl_sk_security_reset( 72 selinux_netlbl_sk_security_reset(struct sk_sec !! 94 struct sk_security_struct *sksec) 73 { 95 { 74 return; 96 return; 75 } 97 } 76 98 77 static inline int selinux_netlbl_skbuff_getsid !! 99 static inline int selinux_netlbl_skbuff_getsid(struct sk_buff *skb, 78 !! 100 u16 family, >> 101 u32 *type, >> 102 u32 *sid) 79 { 103 { 80 *type = NETLBL_NLTYPE_NONE; 104 *type = NETLBL_NLTYPE_NONE; 81 *sid = SECSID_NULL; 105 *sid = SECSID_NULL; 82 return 0; 106 return 0; 83 } 107 } 84 static inline int selinux_netlbl_skbuff_setsid !! 108 static inline int selinux_netlbl_skbuff_setsid(struct sk_buff *skb, >> 109 u16 family, 85 110 u32 sid) 86 { 111 { 87 return 0; 112 return 0; 88 } 113 } 89 114 90 static inline int !! 115 static inline int selinux_netlbl_conn_setsid(struct sock *sk, 91 selinux_netlbl_sctp_assoc_request(struct sctp_ !! 116 struct sockaddr *addr) 92 struct sk_bu !! 117 { >> 118 return 0; >> 119 } >> 120 >> 121 static inline int selinux_netlbl_sctp_assoc_request(struct sctp_endpoint *ep, >> 122 struct sk_buff *skb) 93 { 123 { 94 return 0; 124 return 0; 95 } 125 } 96 static inline int selinux_netlbl_inet_conn_req 126 static inline int selinux_netlbl_inet_conn_request(struct request_sock *req, 97 127 u16 family) 98 { 128 { 99 return 0; 129 return 0; 100 } 130 } 101 static inline void selinux_netlbl_inet_csk_clo 131 static inline void selinux_netlbl_inet_csk_clone(struct sock *sk, u16 family) 102 { 132 { 103 return; 133 return; 104 } 134 } 105 static inline void selinux_netlbl_sctp_sk_clon 135 static inline void selinux_netlbl_sctp_sk_clone(struct sock *sk, 106 136 struct sock *newsk) 107 { 137 { 108 return; 138 return; 109 } 139 } 110 static inline int selinux_netlbl_socket_post_c !! 140 static inline int selinux_netlbl_socket_post_create(struct sock *sk, >> 141 u16 family) 111 { 142 { 112 return 0; 143 return 0; 113 } 144 } 114 static inline int selinux_netlbl_sock_rcv_skb( 145 static inline int selinux_netlbl_sock_rcv_skb(struct sk_security_struct *sksec, 115 !! 146 struct sk_buff *skb, >> 147 u16 family, 116 148 struct common_audit_data *ad) 117 { 149 { 118 return 0; 150 return 0; 119 } 151 } 120 static inline int selinux_netlbl_socket_setsoc 152 static inline int selinux_netlbl_socket_setsockopt(struct socket *sock, 121 !! 153 int level, >> 154 int optname) 122 { 155 { 123 return 0; 156 return 0; 124 } 157 } 125 static inline int selinux_netlbl_socket_connec 158 static inline int selinux_netlbl_socket_connect(struct sock *sk, 126 159 struct sockaddr *addr) 127 { 160 { 128 return 0; 161 return 0; 129 } 162 } 130 static inline int selinux_netlbl_socket_connec 163 static inline int selinux_netlbl_socket_connect_locked(struct sock *sk, 131 164 struct sockaddr *addr) 132 { 165 { 133 return 0; 166 return 0; 134 } 167 } 135 #endif /* CONFIG_NETLABEL */ 168 #endif /* CONFIG_NETLABEL */ 136 169 137 #endif 170 #endif 138 171
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.