1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * NetLabel Management Support
5 * This file defines the management functions for the NetLabel system. The
6 * NetLabel system manages static and dynamic label mappings for network
7 * protocols such as CIPSO and RIPSO.
9 * Author: Paul Moore <paul@paul-moore.com>
13 * (c) Copyright Hewlett-Packard Development Company, L.P., 2006
16 #ifndef _NETLABEL_MGMT_H
17 #define _NETLABEL_MGMT_H
19 #include <net/netlabel.h>
20 #include <linux/atomic.h>
23 * The following NetLabel payloads are supported by the management interface.
26 * Sent by an application to add a domain mapping to the NetLabel system.
28 * Required attributes:
31 * NLBL_MGMT_A_PROTOCOL
33 * If IPv4 is specified the following attributes are required:
35 * NLBL_MGMT_A_IPV4ADDR
36 * NLBL_MGMT_A_IPV4MASK
38 * If IPv6 is specified the following attributes are required:
40 * NLBL_MGMT_A_IPV6ADDR
41 * NLBL_MGMT_A_IPV6MASK
43 * If using NETLBL_NLTYPE_CIPSOV4 the following attributes are required:
47 * If using NETLBL_NLTYPE_UNLABELED no other attributes are required,
48 * however the following attribute may optionally be sent:
53 * Sent by an application to remove a domain mapping from the NetLabel
56 * Required attributes:
61 * This message can be sent either from an application or by the kernel in
62 * response to an application generated LISTALL message. When sent by an
63 * application there is no payload and the NLM_F_DUMP flag should be set.
64 * The kernel should respond with a series of the following messages.
66 * Required attributes:
71 * If the IP address selectors are not used the following attribute is
74 * NLBL_MGMT_A_PROTOCOL
76 * If the IP address selectors are used then the following attritbute is
79 * NLBL_MGMT_A_SELECTORLIST
81 * If the mapping is using the NETLBL_NLTYPE_CIPSOV4 type then the following
82 * attributes are required:
86 * If the mapping is using the NETLBL_NLTYPE_UNLABELED type no other
87 * attributes are required.
90 * Sent by an application to set the default domain mapping for the NetLabel
93 * Required attributes:
95 * NLBL_MGMT_A_PROTOCOL
97 * If using NETLBL_NLTYPE_CIPSOV4 the following attributes are required:
101 * If using NETLBL_NLTYPE_UNLABELED no other attributes are required,
102 * however the following attribute may optionally be sent:
107 * Sent by an application to remove the default domain mapping from the
108 * NetLabel system, there is no payload.
111 * This message can be sent either from an application or by the kernel in
112 * response to an application generated LISTDEF message. When sent by an
113 * application there may be an optional payload.
117 * On success the kernel should send a response using the following format:
119 * If the IP address selectors are not used the following attributes are
122 * NLBL_MGMT_A_PROTOCOL
125 * If the IP address selectors are used then the following attritbute is
128 * NLBL_MGMT_A_SELECTORLIST
130 * If the mapping is using the NETLBL_NLTYPE_CIPSOV4 type then the following
131 * attributes are required:
135 * If the mapping is using the NETLBL_NLTYPE_UNLABELED type no other
136 * attributes are required.
139 * Sent by an application to request a list of configured NetLabel protocols
140 * in the kernel. When sent by an application there is no payload and the
141 * NLM_F_DUMP flag should be set. The kernel should respond with a series of
142 * the following messages.
144 * Required attributes:
146 * NLBL_MGMT_A_PROTOCOL
149 * Sent by an application to request the NetLabel version. When sent by an
150 * application there is no payload. This message type is also used by the
151 * kernel to respond to an VERSION request.
153 * Required attributes:
155 * NLBL_MGMT_A_VERSION
159 /* NetLabel Management commands */
166 NLBL_MGMT_C_REMOVEDEF,
168 NLBL_MGMT_C_PROTOCOLS,
173 /* NetLabel Management attributes */
178 * the NULL terminated LSM domain string */
179 NLBL_MGMT_A_PROTOCOL,
181 * the NetLabel protocol type (defined by NETLBL_NLTYPE_*) */
184 * the NetLabel protocol version number (defined by
185 * NETLBL_PROTO_VERSION) */
188 * the CIPSOv4 DOI value */
189 NLBL_MGMT_A_IPV6ADDR,
190 /* (NLA_BINARY, struct in6_addr)
192 NLBL_MGMT_A_IPV6MASK,
193 /* (NLA_BINARY, struct in6_addr)
194 * an IPv6 address mask */
195 NLBL_MGMT_A_IPV4ADDR,
196 /* (NLA_BINARY, struct in_addr)
198 NLBL_MGMT_A_IPV4MASK,
199 /* (NLA_BINARY, struct in_addr)
200 * and IPv4 address mask */
201 NLBL_MGMT_A_ADDRSELECTOR,
203 * an IP address selector, must contain an address, mask, and protocol
204 * attribute plus any protocol specific attributes */
205 NLBL_MGMT_A_SELECTORLIST,
207 * the selector list, there must be at least one
208 * NLBL_MGMT_A_ADDRSELECTOR attribute */
211 * The address family */
214 * the CALIPSO DOI value */
217 #define NLBL_MGMT_A_MAX (__NLBL_MGMT_A_MAX - 1)
219 /* NetLabel protocol functions */
220 int netlbl_mgmt_genl_init(void);
222 /* NetLabel configured protocol reference counter */
223 extern atomic_t netlabel_mgmt_protocount;