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