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.moore@hp.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, int error, int gateway); 30 int gateway); << 31 44 32 void selinux_netlbl_sk_security_free(struct sk !! 45 void selinux_netlbl_sk_security_free(struct sk_security_struct *ssec); 33 void selinux_netlbl_sk_security_reset(struct s !! 46 void selinux_netlbl_sk_security_reset(struct sk_security_struct *ssec); 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 int error, >> 76 int gateway) 61 { 77 { 62 return; 78 return; 63 } 79 } 64 80 65 static inline void !! 81 static inline void selinux_netlbl_sk_security_free( 66 selinux_netlbl_sk_security_free(struct sk_secu !! 82 struct sk_security_struct *ssec) 67 { 83 { 68 return; 84 return; 69 } 85 } 70 86 71 static inline void !! 87 static inline void selinux_netlbl_sk_security_reset( 72 selinux_netlbl_sk_security_reset(struct sk_sec !! 88 struct sk_security_struct *ssec) 73 { 89 { 74 return; 90 return; 75 } 91 } 76 92 77 static inline int selinux_netlbl_skbuff_getsid !! 93 static inline int selinux_netlbl_skbuff_getsid(struct sk_buff *skb, 78 !! 94 u16 family, >> 95 u32 *type, >> 96 u32 *sid) 79 { 97 { 80 *type = NETLBL_NLTYPE_NONE; 98 *type = NETLBL_NLTYPE_NONE; 81 *sid = SECSID_NULL; 99 *sid = SECSID_NULL; 82 return 0; 100 return 0; 83 } 101 } 84 static inline int selinux_netlbl_skbuff_setsid !! 102 static inline int selinux_netlbl_skbuff_setsid(struct sk_buff *skb, >> 103 u16 family, 85 104 u32 sid) 86 { 105 { 87 return 0; 106 return 0; 88 } 107 } 89 108 90 static inline int !! 109 static inline int selinux_netlbl_conn_setsid(struct sock *sk, 91 selinux_netlbl_sctp_assoc_request(struct sctp_ !! 110 struct sockaddr *addr) 92 struct sk_bu << 93 { 111 { 94 return 0; 112 return 0; 95 } 113 } >> 114 96 static inline int selinux_netlbl_inet_conn_req 115 static inline int selinux_netlbl_inet_conn_request(struct request_sock *req, 97 116 u16 family) 98 { 117 { 99 return 0; 118 return 0; 100 } 119 } 101 static inline void selinux_netlbl_inet_csk_clo 120 static inline void selinux_netlbl_inet_csk_clone(struct sock *sk, u16 family) 102 { 121 { 103 return; 122 return; 104 } 123 } 105 static inline void selinux_netlbl_sctp_sk_clon !! 124 static inline int selinux_netlbl_socket_post_create(struct sock *sk, 106 !! 125 u16 family) 107 { << 108 return; << 109 } << 110 static inline int selinux_netlbl_socket_post_c << 111 { 126 { 112 return 0; 127 return 0; 113 } 128 } 114 static inline int selinux_netlbl_sock_rcv_skb( 129 static inline int selinux_netlbl_sock_rcv_skb(struct sk_security_struct *sksec, 115 !! 130 struct sk_buff *skb, >> 131 u16 family, 116 132 struct common_audit_data *ad) 117 { 133 { 118 return 0; 134 return 0; 119 } 135 } 120 static inline int selinux_netlbl_socket_setsoc 136 static inline int selinux_netlbl_socket_setsockopt(struct socket *sock, 121 !! 137 int level, >> 138 int optname) 122 { 139 { 123 return 0; 140 return 0; 124 } 141 } 125 static inline int selinux_netlbl_socket_connec 142 static inline int selinux_netlbl_socket_connect(struct sock *sk, 126 143 struct sockaddr *addr) 127 { << 128 return 0; << 129 } << 130 static inline int selinux_netlbl_socket_connec << 131 << 132 { 144 { 133 return 0; 145 return 0; 134 } 146 } 135 #endif /* CONFIG_NETLABEL */ 147 #endif /* CONFIG_NETLABEL */ 136 148 137 #endif 149 #endif 138 150
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.