Path: blob/master/security/selinux/include/netlabel.h
10817 views
/*1* SELinux interface to the NetLabel subsystem2*3* Author : Paul Moore <[email protected]>4*5*/67/*8* (c) Copyright Hewlett-Packard Development Company, L.P., 20069*10* This program is free software; you can redistribute it and/or modify11* it under the terms of the GNU General Public License as published by12* the Free Software Foundation; either version 2 of the License, or13* (at your option) any later version.14*15* This program is distributed in the hope that it will be useful,16* but WITHOUT ANY WARRANTY; without even the implied warranty of17* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See18* the GNU General Public License for more details.19*20* You should have received a copy of the GNU General Public License21* along with this program; if not, write to the Free Software22* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA23*24*/2526#ifndef _SELINUX_NETLABEL_H_27#define _SELINUX_NETLABEL_H_2829#include <linux/types.h>30#include <linux/fs.h>31#include <linux/net.h>32#include <linux/skbuff.h>33#include <net/sock.h>34#include <net/request_sock.h>3536#include "avc.h"37#include "objsec.h"3839#ifdef CONFIG_NETLABEL40void selinux_netlbl_cache_invalidate(void);4142void selinux_netlbl_err(struct sk_buff *skb, int error, int gateway);4344void selinux_netlbl_sk_security_free(struct sk_security_struct *sksec);45void selinux_netlbl_sk_security_reset(struct sk_security_struct *sksec);4647int selinux_netlbl_skbuff_getsid(struct sk_buff *skb,48u16 family,49u32 *type,50u32 *sid);51int selinux_netlbl_skbuff_setsid(struct sk_buff *skb,52u16 family,53u32 sid);5455int selinux_netlbl_inet_conn_request(struct request_sock *req, u16 family);56void selinux_netlbl_inet_csk_clone(struct sock *sk, u16 family);57int selinux_netlbl_socket_post_create(struct sock *sk, u16 family);58int selinux_netlbl_sock_rcv_skb(struct sk_security_struct *sksec,59struct sk_buff *skb,60u16 family,61struct common_audit_data *ad);62int selinux_netlbl_socket_setsockopt(struct socket *sock,63int level,64int optname);65int selinux_netlbl_socket_connect(struct sock *sk, struct sockaddr *addr);6667#else68static inline void selinux_netlbl_cache_invalidate(void)69{70return;71}7273static inline void selinux_netlbl_err(struct sk_buff *skb,74int error,75int gateway)76{77return;78}7980static inline void selinux_netlbl_sk_security_free(81struct sk_security_struct *sksec)82{83return;84}8586static inline void selinux_netlbl_sk_security_reset(87struct sk_security_struct *sksec)88{89return;90}9192static inline int selinux_netlbl_skbuff_getsid(struct sk_buff *skb,93u16 family,94u32 *type,95u32 *sid)96{97*type = NETLBL_NLTYPE_NONE;98*sid = SECSID_NULL;99return 0;100}101static inline int selinux_netlbl_skbuff_setsid(struct sk_buff *skb,102u16 family,103u32 sid)104{105return 0;106}107108static inline int selinux_netlbl_conn_setsid(struct sock *sk,109struct sockaddr *addr)110{111return 0;112}113114static inline int selinux_netlbl_inet_conn_request(struct request_sock *req,115u16 family)116{117return 0;118}119static inline void selinux_netlbl_inet_csk_clone(struct sock *sk, u16 family)120{121return;122}123static inline int selinux_netlbl_socket_post_create(struct sock *sk,124u16 family)125{126return 0;127}128static inline int selinux_netlbl_sock_rcv_skb(struct sk_security_struct *sksec,129struct sk_buff *skb,130u16 family,131struct common_audit_data *ad)132{133return 0;134}135static inline int selinux_netlbl_socket_setsockopt(struct socket *sock,136int level,137int optname)138{139return 0;140}141static inline int selinux_netlbl_socket_connect(struct sock *sk,142struct sockaddr *addr)143{144return 0;145}146#endif /* CONFIG_NETLABEL */147148#endif149150151