selinux_netlabel.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /*
  2. * SELinux interface to the NetLabel subsystem
  3. *
  4. * Author : Paul Moore <paul.moore@hp.com>
  5. *
  6. */
  7. /*
  8. * (c) Copyright Hewlett-Packard Development Company, L.P., 2006
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; either version 2 of the License, or
  13. * (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 of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
  18. * the GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  23. *
  24. */
  25. #ifndef _SELINUX_NETLABEL_H_
  26. #define _SELINUX_NETLABEL_H_
  27. #include <linux/types.h>
  28. #include <linux/fs.h>
  29. #include <linux/net.h>
  30. #include <linux/skbuff.h>
  31. #include <net/sock.h>
  32. #include "avc.h"
  33. #include "objsec.h"
  34. #ifdef CONFIG_NETLABEL
  35. void selinux_netlbl_cache_invalidate(void);
  36. int selinux_netlbl_socket_post_create(struct socket *sock,
  37. int sock_family,
  38. u32 sid);
  39. void selinux_netlbl_sock_graft(struct sock *sk, struct socket *sock);
  40. u32 selinux_netlbl_inet_conn_request(struct sk_buff *skb, u32 sock_sid);
  41. int selinux_netlbl_sock_rcv_skb(struct sk_security_struct *sksec,
  42. struct sk_buff *skb,
  43. struct avc_audit_data *ad);
  44. u32 selinux_netlbl_socket_getpeersec_stream(struct socket *sock);
  45. u32 selinux_netlbl_socket_getpeersec_dgram(struct sk_buff *skb);
  46. void selinux_netlbl_sk_security_init(struct sk_security_struct *ssec,
  47. int family);
  48. void selinux_netlbl_sk_clone_security(struct sk_security_struct *ssec,
  49. struct sk_security_struct *newssec);
  50. int selinux_netlbl_inode_permission(struct inode *inode, int mask);
  51. #else
  52. static inline void selinux_netlbl_cache_invalidate(void)
  53. {
  54. return;
  55. }
  56. static inline int selinux_netlbl_socket_post_create(struct socket *sock,
  57. int sock_family,
  58. u32 sid)
  59. {
  60. return 0;
  61. }
  62. static inline void selinux_netlbl_sock_graft(struct sock *sk,
  63. struct socket *sock)
  64. {
  65. return;
  66. }
  67. static inline u32 selinux_netlbl_inet_conn_request(struct sk_buff *skb,
  68. u32 sock_sid)
  69. {
  70. return SECSID_NULL;
  71. }
  72. static inline int selinux_netlbl_sock_rcv_skb(struct sk_security_struct *sksec,
  73. struct sk_buff *skb,
  74. struct avc_audit_data *ad)
  75. {
  76. return 0;
  77. }
  78. static inline u32 selinux_netlbl_socket_getpeersec_stream(struct socket *sock)
  79. {
  80. return SECSID_NULL;
  81. }
  82. static inline u32 selinux_netlbl_socket_getpeersec_dgram(struct sk_buff *skb)
  83. {
  84. return SECSID_NULL;
  85. }
  86. static inline void selinux_netlbl_sk_security_init(
  87. struct sk_security_struct *ssec,
  88. int family)
  89. {
  90. return;
  91. }
  92. static inline void selinux_netlbl_sk_clone_security(
  93. struct sk_security_struct *ssec,
  94. struct sk_security_struct *newssec)
  95. {
  96. return;
  97. }
  98. static inline int selinux_netlbl_inode_permission(struct inode *inode,
  99. int mask)
  100. {
  101. return 0;
  102. }
  103. #endif /* CONFIG_NETLABEL */
  104. #endif