Linux Audio

Check our new training course

Loading...
v3.1
  1/*
  2 * NetLabel Management Support
  3 *
  4 * This file defines the management 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/*
 13 * (c) Copyright Hewlett-Packard Development Company, L.P., 2006
 14 *
 15 * This program is free software;  you can redistribute it and/or modify
 16 * it under the terms of the GNU General Public License as published by
 17 * the Free Software Foundation; either version 2 of the License, or
 18 * (at your option) any later version.
 19 *
 20 * This program is distributed in the hope that it will be useful,
 21 * but WITHOUT ANY WARRANTY;  without even the implied warranty of
 22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
 23 * the GNU General Public License for more details.
 24 *
 25 * You should have received a copy of the GNU General Public License
 26 * along with this program;  if not, write to the Free Software
 27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 28 *
 29 */
 30
 31#ifndef _NETLABEL_MGMT_H
 32#define _NETLABEL_MGMT_H
 33
 34#include <net/netlabel.h>
 35#include <linux/atomic.h>
 36
 37/*
 38 * The following NetLabel payloads are supported by the management interface.
 39 *
 40 * o ADD:
 41 *   Sent by an application to add a domain mapping to the NetLabel system.
 42 *
 43 *   Required attributes:
 44 *
 45 *     NLBL_MGMT_A_DOMAIN
 46 *     NLBL_MGMT_A_PROTOCOL
 47 *
 48 *   If IPv4 is specified the following attributes are required:
 49 *
 50 *     NLBL_MGMT_A_IPV4ADDR
 51 *     NLBL_MGMT_A_IPV4MASK
 52 *
 53 *   If IPv6 is specified the following attributes are required:
 54 *
 55 *     NLBL_MGMT_A_IPV6ADDR
 56 *     NLBL_MGMT_A_IPV6MASK
 57 *
 58 *   If using NETLBL_NLTYPE_CIPSOV4 the following attributes are required:
 59 *
 60 *     NLBL_MGMT_A_CV4DOI
 61 *
 62 *   If using NETLBL_NLTYPE_UNLABELED no other attributes are required.
 
 
 
 63 *
 64 * o REMOVE:
 65 *   Sent by an application to remove a domain mapping from the NetLabel
 66 *   system.
 67 *
 68 *   Required attributes:
 69 *
 70 *     NLBL_MGMT_A_DOMAIN
 71 *
 72 * o LISTALL:
 73 *   This message can be sent either from an application or by the kernel in
 74 *   response to an application generated LISTALL message.  When sent by an
 75 *   application there is no payload and the NLM_F_DUMP flag should be set.
 76 *   The kernel should respond with a series of the following messages.
 77 *
 78 *   Required attributes:
 79 *
 80 *     NLBL_MGMT_A_DOMAIN
 
 81 *
 82 *   If the IP address selectors are not used the following attribute is
 83 *   required:
 84 *
 85 *     NLBL_MGMT_A_PROTOCOL
 86 *
 87 *   If the IP address selectors are used then the following attritbute is
 88 *   required:
 89 *
 90 *     NLBL_MGMT_A_SELECTORLIST
 91 *
 92 *   If the mapping is using the NETLBL_NLTYPE_CIPSOV4 type then the following
 93 *   attributes are required:
 94 *
 95 *     NLBL_MGMT_A_CV4DOI
 96 *
 97 *   If the mapping is using the NETLBL_NLTYPE_UNLABELED type no other
 98 *   attributes are required.
 99 *
100 * o ADDDEF:
101 *   Sent by an application to set the default domain mapping for the NetLabel
102 *   system.
103 *
104 *   Required attributes:
105 *
106 *     NLBL_MGMT_A_PROTOCOL
107 *
108 *   If using NETLBL_NLTYPE_CIPSOV4 the following attributes are required:
109 *
110 *     NLBL_MGMT_A_CV4DOI
111 *
112 *   If using NETLBL_NLTYPE_UNLABELED no other attributes are required.
 
 
 
113 *
114 * o REMOVEDEF:
115 *   Sent by an application to remove the default domain mapping from the
116 *   NetLabel system, there is no payload.
117 *
118 * o LISTDEF:
119 *   This message can be sent either from an application or by the kernel in
120 *   response to an application generated LISTDEF message.  When sent by an
121 *   application there is no payload.  On success the kernel should send a
122 *   response using the following format.
123 *
124 *   If the IP address selectors are not used the following attribute is
 
 
 
 
125 *   required:
126 *
127 *     NLBL_MGMT_A_PROTOCOL
 
128 *
129 *   If the IP address selectors are used then the following attritbute is
130 *   required:
131 *
132 *     NLBL_MGMT_A_SELECTORLIST
133 *
134 *   If the mapping is using the NETLBL_NLTYPE_CIPSOV4 type then the following
135 *   attributes are required:
136 *
137 *     NLBL_MGMT_A_CV4DOI
138 *
139 *   If the mapping is using the NETLBL_NLTYPE_UNLABELED type no other
140 *   attributes are required.
141 *
142 * o PROTOCOLS:
143 *   Sent by an application to request a list of configured NetLabel protocols
144 *   in the kernel.  When sent by an application there is no payload and the
145 *   NLM_F_DUMP flag should be set.  The kernel should respond with a series of
146 *   the following messages.
147 *
148 *   Required attributes:
149 *
150 *     NLBL_MGMT_A_PROTOCOL
151 *
152 * o VERSION:
153 *   Sent by an application to request the NetLabel version.  When sent by an
154 *   application there is no payload.  This message type is also used by the
155 *   kernel to respond to an VERSION request.
156 *
157 *   Required attributes:
158 *
159 *     NLBL_MGMT_A_VERSION
160 *
161 */
162
163/* NetLabel Management commands */
164enum {
165	NLBL_MGMT_C_UNSPEC,
166	NLBL_MGMT_C_ADD,
167	NLBL_MGMT_C_REMOVE,
168	NLBL_MGMT_C_LISTALL,
169	NLBL_MGMT_C_ADDDEF,
170	NLBL_MGMT_C_REMOVEDEF,
171	NLBL_MGMT_C_LISTDEF,
172	NLBL_MGMT_C_PROTOCOLS,
173	NLBL_MGMT_C_VERSION,
174	__NLBL_MGMT_C_MAX,
175};
176
177/* NetLabel Management attributes */
178enum {
179	NLBL_MGMT_A_UNSPEC,
180	NLBL_MGMT_A_DOMAIN,
181	/* (NLA_NUL_STRING)
182	 * the NULL terminated LSM domain string */
183	NLBL_MGMT_A_PROTOCOL,
184	/* (NLA_U32)
185	 * the NetLabel protocol type (defined by NETLBL_NLTYPE_*) */
186	NLBL_MGMT_A_VERSION,
187	/* (NLA_U32)
188	 * the NetLabel protocol version number (defined by
189	 * NETLBL_PROTO_VERSION) */
190	NLBL_MGMT_A_CV4DOI,
191	/* (NLA_U32)
192	 * the CIPSOv4 DOI value */
193	NLBL_MGMT_A_IPV6ADDR,
194	/* (NLA_BINARY, struct in6_addr)
195	 * an IPv6 address */
196	NLBL_MGMT_A_IPV6MASK,
197	/* (NLA_BINARY, struct in6_addr)
198	 * an IPv6 address mask */
199	NLBL_MGMT_A_IPV4ADDR,
200	/* (NLA_BINARY, struct in_addr)
201	 * an IPv4 address */
202	NLBL_MGMT_A_IPV4MASK,
203	/* (NLA_BINARY, struct in_addr)
204	 * and IPv4 address mask */
205	NLBL_MGMT_A_ADDRSELECTOR,
206	/* (NLA_NESTED)
207	 * an IP address selector, must contain an address, mask, and protocol
208	 * attribute plus any protocol specific attributes */
209	NLBL_MGMT_A_SELECTORLIST,
210	/* (NLA_NESTED)
211	 * the selector list, there must be at least one
212	 * NLBL_MGMT_A_ADDRSELECTOR attribute */
 
 
 
 
 
 
213	__NLBL_MGMT_A_MAX,
214};
215#define NLBL_MGMT_A_MAX (__NLBL_MGMT_A_MAX - 1)
216
217/* NetLabel protocol functions */
218int netlbl_mgmt_genl_init(void);
219
220/* NetLabel configured protocol reference counter */
221extern atomic_t netlabel_mgmt_protocount;
222
223#endif
v4.17
  1/*
  2 * NetLabel Management Support
  3 *
  4 * This file defines the management 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/*
 13 * (c) Copyright Hewlett-Packard Development Company, L.P., 2006
 14 *
 15 * This program is free software;  you can redistribute it and/or modify
 16 * it under the terms of the GNU General Public License as published by
 17 * the Free Software Foundation; either version 2 of the License, or
 18 * (at your option) any later version.
 19 *
 20 * This program is distributed in the hope that it will be useful,
 21 * but WITHOUT ANY WARRANTY;  without even the implied warranty of
 22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
 23 * the GNU General Public License for more details.
 24 *
 25 * You should have received a copy of the GNU General Public License
 26 * along with this program;  if not, see <http://www.gnu.org/licenses/>.
 
 27 *
 28 */
 29
 30#ifndef _NETLABEL_MGMT_H
 31#define _NETLABEL_MGMT_H
 32
 33#include <net/netlabel.h>
 34#include <linux/atomic.h>
 35
 36/*
 37 * The following NetLabel payloads are supported by the management interface.
 38 *
 39 * o ADD:
 40 *   Sent by an application to add a domain mapping to the NetLabel system.
 41 *
 42 *   Required attributes:
 43 *
 44 *     NLBL_MGMT_A_DOMAIN
 45 *     NLBL_MGMT_A_PROTOCOL
 46 *
 47 *   If IPv4 is specified the following attributes are required:
 48 *
 49 *     NLBL_MGMT_A_IPV4ADDR
 50 *     NLBL_MGMT_A_IPV4MASK
 51 *
 52 *   If IPv6 is specified the following attributes are required:
 53 *
 54 *     NLBL_MGMT_A_IPV6ADDR
 55 *     NLBL_MGMT_A_IPV6MASK
 56 *
 57 *   If using NETLBL_NLTYPE_CIPSOV4 the following attributes are required:
 58 *
 59 *     NLBL_MGMT_A_CV4DOI
 60 *
 61 *   If using NETLBL_NLTYPE_UNLABELED no other attributes are required,
 62 *   however the following attribute may optionally be sent:
 63 *
 64 *     NLBL_MGMT_A_FAMILY
 65 *
 66 * o REMOVE:
 67 *   Sent by an application to remove a domain mapping from the NetLabel
 68 *   system.
 69 *
 70 *   Required attributes:
 71 *
 72 *     NLBL_MGMT_A_DOMAIN
 73 *
 74 * o LISTALL:
 75 *   This message can be sent either from an application or by the kernel in
 76 *   response to an application generated LISTALL message.  When sent by an
 77 *   application there is no payload and the NLM_F_DUMP flag should be set.
 78 *   The kernel should respond with a series of the following messages.
 79 *
 80 *   Required attributes:
 81 *
 82 *     NLBL_MGMT_A_DOMAIN
 83 *     NLBL_MGMT_A_FAMILY
 84 *
 85 *   If the IP address selectors are not used the following attribute is
 86 *   required:
 87 *
 88 *     NLBL_MGMT_A_PROTOCOL
 89 *
 90 *   If the IP address selectors are used then the following attritbute is
 91 *   required:
 92 *
 93 *     NLBL_MGMT_A_SELECTORLIST
 94 *
 95 *   If the mapping is using the NETLBL_NLTYPE_CIPSOV4 type then the following
 96 *   attributes are required:
 97 *
 98 *     NLBL_MGMT_A_CV4DOI
 99 *
100 *   If the mapping is using the NETLBL_NLTYPE_UNLABELED type no other
101 *   attributes are required.
102 *
103 * o ADDDEF:
104 *   Sent by an application to set the default domain mapping for the NetLabel
105 *   system.
106 *
107 *   Required attributes:
108 *
109 *     NLBL_MGMT_A_PROTOCOL
110 *
111 *   If using NETLBL_NLTYPE_CIPSOV4 the following attributes are required:
112 *
113 *     NLBL_MGMT_A_CV4DOI
114 *
115 *   If using NETLBL_NLTYPE_UNLABELED no other attributes are required,
116 *   however the following attribute may optionally be sent:
117 *
118 *     NLBL_MGMT_A_FAMILY
119 *
120 * o REMOVEDEF:
121 *   Sent by an application to remove the default domain mapping from the
122 *   NetLabel system, there is no payload.
123 *
124 * o LISTDEF:
125 *   This message can be sent either from an application or by the kernel in
126 *   response to an application generated LISTDEF message.  When sent by an
127 *   application there may be an optional payload.
 
128 *
129 *     NLBL_MGMT_A_FAMILY
130 *
131 *   On success the kernel should send a response using the following format:
132 *
133 *   If the IP address selectors are not used the following attributes are
134 *   required:
135 *
136 *     NLBL_MGMT_A_PROTOCOL
137 *     NLBL_MGMT_A_FAMILY
138 *
139 *   If the IP address selectors are used then the following attritbute is
140 *   required:
141 *
142 *     NLBL_MGMT_A_SELECTORLIST
143 *
144 *   If the mapping is using the NETLBL_NLTYPE_CIPSOV4 type then the following
145 *   attributes are required:
146 *
147 *     NLBL_MGMT_A_CV4DOI
148 *
149 *   If the mapping is using the NETLBL_NLTYPE_UNLABELED type no other
150 *   attributes are required.
151 *
152 * o PROTOCOLS:
153 *   Sent by an application to request a list of configured NetLabel protocols
154 *   in the kernel.  When sent by an application there is no payload and the
155 *   NLM_F_DUMP flag should be set.  The kernel should respond with a series of
156 *   the following messages.
157 *
158 *   Required attributes:
159 *
160 *     NLBL_MGMT_A_PROTOCOL
161 *
162 * o VERSION:
163 *   Sent by an application to request the NetLabel version.  When sent by an
164 *   application there is no payload.  This message type is also used by the
165 *   kernel to respond to an VERSION request.
166 *
167 *   Required attributes:
168 *
169 *     NLBL_MGMT_A_VERSION
170 *
171 */
172
173/* NetLabel Management commands */
174enum {
175	NLBL_MGMT_C_UNSPEC,
176	NLBL_MGMT_C_ADD,
177	NLBL_MGMT_C_REMOVE,
178	NLBL_MGMT_C_LISTALL,
179	NLBL_MGMT_C_ADDDEF,
180	NLBL_MGMT_C_REMOVEDEF,
181	NLBL_MGMT_C_LISTDEF,
182	NLBL_MGMT_C_PROTOCOLS,
183	NLBL_MGMT_C_VERSION,
184	__NLBL_MGMT_C_MAX,
185};
186
187/* NetLabel Management attributes */
188enum {
189	NLBL_MGMT_A_UNSPEC,
190	NLBL_MGMT_A_DOMAIN,
191	/* (NLA_NUL_STRING)
192	 * the NULL terminated LSM domain string */
193	NLBL_MGMT_A_PROTOCOL,
194	/* (NLA_U32)
195	 * the NetLabel protocol type (defined by NETLBL_NLTYPE_*) */
196	NLBL_MGMT_A_VERSION,
197	/* (NLA_U32)
198	 * the NetLabel protocol version number (defined by
199	 * NETLBL_PROTO_VERSION) */
200	NLBL_MGMT_A_CV4DOI,
201	/* (NLA_U32)
202	 * the CIPSOv4 DOI value */
203	NLBL_MGMT_A_IPV6ADDR,
204	/* (NLA_BINARY, struct in6_addr)
205	 * an IPv6 address */
206	NLBL_MGMT_A_IPV6MASK,
207	/* (NLA_BINARY, struct in6_addr)
208	 * an IPv6 address mask */
209	NLBL_MGMT_A_IPV4ADDR,
210	/* (NLA_BINARY, struct in_addr)
211	 * an IPv4 address */
212	NLBL_MGMT_A_IPV4MASK,
213	/* (NLA_BINARY, struct in_addr)
214	 * and IPv4 address mask */
215	NLBL_MGMT_A_ADDRSELECTOR,
216	/* (NLA_NESTED)
217	 * an IP address selector, must contain an address, mask, and protocol
218	 * attribute plus any protocol specific attributes */
219	NLBL_MGMT_A_SELECTORLIST,
220	/* (NLA_NESTED)
221	 * the selector list, there must be at least one
222	 * NLBL_MGMT_A_ADDRSELECTOR attribute */
223	NLBL_MGMT_A_FAMILY,
224	/* (NLA_U16)
225	 * The address family */
226	NLBL_MGMT_A_CLPDOI,
227	/* (NLA_U32)
228	 * the CALIPSO DOI value */
229	__NLBL_MGMT_A_MAX,
230};
231#define NLBL_MGMT_A_MAX (__NLBL_MGMT_A_MAX - 1)
232
233/* NetLabel protocol functions */
234int netlbl_mgmt_genl_init(void);
235
236/* NetLabel configured protocol reference counter */
237extern atomic_t netlabel_mgmt_protocount;
238
239#endif