netlabel_cipso_v4.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. /*
  2. * NetLabel CIPSO/IPv4 Support
  3. *
  4. * This file defines the CIPSO/IPv4 functions for the NetLabel system. The
  5. * NetLabel system manages static and dynamic label mappings for network
  6. * protocols such as CIPSO and RIPSO.
  7. *
  8. * Author: Paul Moore <paul@paul-moore.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, see <http://www.gnu.org/licenses/>.
  26. *
  27. */
  28. #ifndef _NETLABEL_CIPSO_V4
  29. #define _NETLABEL_CIPSO_V4
  30. #include <net/netlabel.h>
  31. /*
  32. * The following NetLabel payloads are supported by the CIPSO subsystem.
  33. *
  34. * o ADD:
  35. * Sent by an application to add a new DOI mapping table.
  36. *
  37. * Required attributes:
  38. *
  39. * NLBL_CIPSOV4_A_DOI
  40. * NLBL_CIPSOV4_A_MTYPE
  41. * NLBL_CIPSOV4_A_TAGLST
  42. *
  43. * If using CIPSO_V4_MAP_TRANS the following attributes are required:
  44. *
  45. * NLBL_CIPSOV4_A_MLSLVLLST
  46. * NLBL_CIPSOV4_A_MLSCATLST
  47. *
  48. * If using CIPSO_V4_MAP_PASS or CIPSO_V4_MAP_LOCAL no additional attributes
  49. * are required.
  50. *
  51. * o REMOVE:
  52. * Sent by an application to remove a specific DOI mapping table from the
  53. * CIPSO V4 system.
  54. *
  55. * Required attributes:
  56. *
  57. * NLBL_CIPSOV4_A_DOI
  58. *
  59. * o LIST:
  60. * Sent by an application to list the details of a DOI definition. On
  61. * success the kernel should send a response using the following format.
  62. *
  63. * Required attributes:
  64. *
  65. * NLBL_CIPSOV4_A_DOI
  66. *
  67. * The valid response message format depends on the type of the DOI mapping,
  68. * the defined formats are shown below.
  69. *
  70. * Required attributes:
  71. *
  72. * NLBL_CIPSOV4_A_MTYPE
  73. * NLBL_CIPSOV4_A_TAGLST
  74. *
  75. * If using CIPSO_V4_MAP_TRANS the following attributes are required:
  76. *
  77. * NLBL_CIPSOV4_A_MLSLVLLST
  78. * NLBL_CIPSOV4_A_MLSCATLST
  79. *
  80. * If using CIPSO_V4_MAP_PASS or CIPSO_V4_MAP_LOCAL no additional attributes
  81. * are required.
  82. *
  83. * o LISTALL:
  84. * This message is sent by an application to list the valid DOIs on the
  85. * system. When sent by an application there is no payload and the
  86. * NLM_F_DUMP flag should be set. The kernel should respond with a series of
  87. * the following messages.
  88. *
  89. * Required attributes:
  90. *
  91. * NLBL_CIPSOV4_A_DOI
  92. * NLBL_CIPSOV4_A_MTYPE
  93. *
  94. */
  95. /* NetLabel CIPSOv4 commands */
  96. enum {
  97. NLBL_CIPSOV4_C_UNSPEC,
  98. NLBL_CIPSOV4_C_ADD,
  99. NLBL_CIPSOV4_C_REMOVE,
  100. NLBL_CIPSOV4_C_LIST,
  101. NLBL_CIPSOV4_C_LISTALL,
  102. __NLBL_CIPSOV4_C_MAX,
  103. };
  104. /* NetLabel CIPSOv4 attributes */
  105. enum {
  106. NLBL_CIPSOV4_A_UNSPEC,
  107. NLBL_CIPSOV4_A_DOI,
  108. /* (NLA_U32)
  109. * the DOI value */
  110. NLBL_CIPSOV4_A_MTYPE,
  111. /* (NLA_U32)
  112. * the mapping table type (defined in the cipso_ipv4.h header as
  113. * CIPSO_V4_MAP_*) */
  114. NLBL_CIPSOV4_A_TAG,
  115. /* (NLA_U8)
  116. * a CIPSO tag type, meant to be used within a NLBL_CIPSOV4_A_TAGLST
  117. * attribute */
  118. NLBL_CIPSOV4_A_TAGLST,
  119. /* (NLA_NESTED)
  120. * the CIPSO tag list for the DOI, there must be at least one
  121. * NLBL_CIPSOV4_A_TAG attribute, tags listed first are given higher
  122. * priorirty when sending packets */
  123. NLBL_CIPSOV4_A_MLSLVLLOC,
  124. /* (NLA_U32)
  125. * the local MLS sensitivity level */
  126. NLBL_CIPSOV4_A_MLSLVLREM,
  127. /* (NLA_U32)
  128. * the remote MLS sensitivity level */
  129. NLBL_CIPSOV4_A_MLSLVL,
  130. /* (NLA_NESTED)
  131. * a MLS sensitivity level mapping, must contain only one attribute of
  132. * each of the following types: NLBL_CIPSOV4_A_MLSLVLLOC and
  133. * NLBL_CIPSOV4_A_MLSLVLREM */
  134. NLBL_CIPSOV4_A_MLSLVLLST,
  135. /* (NLA_NESTED)
  136. * the CIPSO level mappings, there must be at least one
  137. * NLBL_CIPSOV4_A_MLSLVL attribute */
  138. NLBL_CIPSOV4_A_MLSCATLOC,
  139. /* (NLA_U32)
  140. * the local MLS category */
  141. NLBL_CIPSOV4_A_MLSCATREM,
  142. /* (NLA_U32)
  143. * the remote MLS category */
  144. NLBL_CIPSOV4_A_MLSCAT,
  145. /* (NLA_NESTED)
  146. * a MLS category mapping, must contain only one attribute of each of
  147. * the following types: NLBL_CIPSOV4_A_MLSCATLOC and
  148. * NLBL_CIPSOV4_A_MLSCATREM */
  149. NLBL_CIPSOV4_A_MLSCATLST,
  150. /* (NLA_NESTED)
  151. * the CIPSO category mappings, there must be at least one
  152. * NLBL_CIPSOV4_A_MLSCAT attribute */
  153. __NLBL_CIPSOV4_A_MAX,
  154. };
  155. #define NLBL_CIPSOV4_A_MAX (__NLBL_CIPSOV4_A_MAX - 1)
  156. /* NetLabel protocol functions */
  157. int netlbl_cipsov4_genl_init(void);
  158. /* Free the memory associated with a CIPSOv4 DOI definition */
  159. void netlbl_cipsov4_doi_free(struct rcu_head *entry);
  160. #endif