netlabel_unlabeled.h 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /*
  2. * NetLabel Unlabeled Support
  3. *
  4. * This file defines functions for dealing with unlabeled packets for the
  5. * NetLabel system. The NetLabel system manages static and dynamic label
  6. * mappings for network protocols such as CIPSO and RIPSO.
  7. *
  8. * Author: Paul Moore <paul.moore@hp.com>
  9. *
  10. */
  11. /*
  12. * (c) Copyright Hewlett-Packard Development Company, L.P., 2006
  13. *
  14. * This program is free software; you can redistribute it and/or modify
  15. * it under the terms of the GNU General Public License as published by
  16. * the Free Software Foundation; either version 2 of the License, or
  17. * (at your option) any later version.
  18. *
  19. * This program is distributed in the hope that it will be useful,
  20. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
  22. * the GNU General Public License for more details.
  23. *
  24. * You should have received a copy of the GNU General Public License
  25. * along with this program; if not, write to the Free Software
  26. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  27. *
  28. */
  29. #ifndef _NETLABEL_UNLABELED_H
  30. #define _NETLABEL_UNLABELED_H
  31. #include <net/netlabel.h>
  32. /*
  33. * The following NetLabel payloads are supported by the Unlabeled subsystem.
  34. *
  35. * o ACK:
  36. * Sent by the kernel in response to an applications message, applications
  37. * should never send this message.
  38. *
  39. * +----------------------+-----------------------+
  40. * | seq number (32 bits) | return code (32 bits) |
  41. * +----------------------+-----------------------+
  42. *
  43. * seq number: the sequence number of the original message, taken from the
  44. * nlmsghdr structure
  45. * return code: return value, based on errno values
  46. *
  47. * o ACCEPT
  48. * This message is sent from an application to specify if the kernel should
  49. * allow unlabled packets to pass if they do not match any of the static
  50. * mappings defined in the unlabeled module.
  51. *
  52. * +-----------------+
  53. * | allow (32 bits) |
  54. * +-----------------+
  55. *
  56. * allow: if true (1) then allow the packets to pass, if false (0) then
  57. * reject the packets
  58. *
  59. * o LIST
  60. * This message can be sent either from an application or by the kernel in
  61. * response to an application generated LIST message. When sent by an
  62. * application there is no payload. The kernel should respond to a LIST
  63. * message either with a LIST message on success or an ACK message on
  64. * failure.
  65. *
  66. * +-----------------------+
  67. * | accept flag (32 bits) |
  68. * +-----------------------+
  69. *
  70. * accept flag: if true (1) then unlabeled packets are allowed to pass,
  71. * if false (0) then unlabeled packets are rejected
  72. *
  73. */
  74. /* NetLabel Unlabeled commands */
  75. enum {
  76. NLBL_UNLABEL_C_UNSPEC,
  77. NLBL_UNLABEL_C_ACK,
  78. NLBL_UNLABEL_C_ACCEPT,
  79. NLBL_UNLABEL_C_LIST,
  80. __NLBL_UNLABEL_C_MAX,
  81. };
  82. #define NLBL_UNLABEL_C_MAX (__NLBL_UNLABEL_C_MAX - 1)
  83. /* NetLabel protocol functions */
  84. int netlbl_unlabel_genl_init(void);
  85. /* Process Unlabeled incoming network packets */
  86. int netlbl_unlabel_getattr(struct netlbl_lsm_secattr *secattr);
  87. /* Set the default configuration to allow Unlabeled packets */
  88. int netlbl_unlabel_defconf(void);
  89. #endif