2006-08-04 03:48:37 +04:00
/*
* NetLabel Management Support
*
* This file defines the management functions for the NetLabel system . The
* NetLabel system manages static and dynamic label mappings for network
* protocols such as CIPSO and RIPSO .
*
2011-08-01 15:10:33 +04:00
* Author : Paul Moore < paul @ paul - moore . com >
2006-08-04 03:48:37 +04:00
*
*/
/*
* ( c ) Copyright Hewlett - Packard Development Company , L . P . , 2006
*
* This program is free software ; you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation ; either version 2 of the License , or
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See
* the GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
2013-12-06 21:13:41 +04:00
* along with this program ; if not , see < http : //www.gnu.org/licenses/>.
2006-08-04 03:48:37 +04:00
*
*/
# ifndef _NETLABEL_MGMT_H
# define _NETLABEL_MGMT_H
# include <net/netlabel.h>
2011-07-27 03:09:06 +04:00
# include <linux/atomic.h>
2006-08-04 03:48:37 +04:00
/*
2006-09-26 02:56:37 +04:00
* The following NetLabel payloads are supported by the management interface .
2006-08-04 03:48:37 +04:00
*
* o ADD :
* Sent by an application to add a domain mapping to the NetLabel system .
*
2006-09-26 02:56:37 +04:00
* Required attributes :
2006-08-04 03:48:37 +04:00
*
2006-09-26 02:56:37 +04:00
* NLBL_MGMT_A_DOMAIN
* NLBL_MGMT_A_PROTOCOL
2006-08-04 03:48:37 +04:00
*
2008-10-10 18:16:32 +04:00
* If IPv4 is specified the following attributes are required :
*
* NLBL_MGMT_A_IPV4ADDR
* NLBL_MGMT_A_IPV4MASK
*
* If IPv6 is specified the following attributes are required :
*
* NLBL_MGMT_A_IPV6ADDR
* NLBL_MGMT_A_IPV6MASK
*
2006-09-26 02:56:37 +04:00
* If using NETLBL_NLTYPE_CIPSOV4 the following attributes are required :
2006-08-04 03:48:37 +04:00
*
2006-09-26 02:56:37 +04:00
* NLBL_MGMT_A_CV4DOI
2006-08-04 03:48:37 +04:00
*
2006-09-26 02:56:37 +04:00
* If using NETLBL_NLTYPE_UNLABELED no other attributes are required .
2006-08-04 03:48:37 +04:00
*
* o REMOVE :
* Sent by an application to remove a domain mapping from the NetLabel
2006-09-26 02:56:37 +04:00
* system .
2006-08-04 03:48:37 +04:00
*
2006-09-26 02:56:37 +04:00
* Required attributes :
2006-08-04 03:48:37 +04:00
*
2006-09-26 02:56:37 +04:00
* NLBL_MGMT_A_DOMAIN
2006-08-04 03:48:37 +04:00
*
2006-09-26 02:56:37 +04:00
* o LISTALL :
2006-08-04 03:48:37 +04:00
* This message can be sent either from an application or by the kernel in
2006-09-26 02:56:37 +04:00
* response to an application generated LISTALL message . When sent by an
* application there is no payload and the NLM_F_DUMP flag should be set .
* The kernel should respond with a series of the following messages .
2006-08-04 03:48:37 +04:00
*
2006-09-26 02:56:37 +04:00
* Required attributes :
2006-08-04 03:48:37 +04:00
*
2006-09-26 02:56:37 +04:00
* NLBL_MGMT_A_DOMAIN
2008-10-10 18:16:32 +04:00
*
* If the IP address selectors are not used the following attribute is
* required :
*
2006-09-26 02:56:37 +04:00
* NLBL_MGMT_A_PROTOCOL
2006-08-04 03:48:37 +04:00
*
2008-10-10 18:16:32 +04:00
* If the IP address selectors are used then the following attritbute is
* required :
*
* NLBL_MGMT_A_SELECTORLIST
*
* If the mapping is using the NETLBL_NLTYPE_CIPSOV4 type then the following
* attributes are required :
2006-08-04 03:48:37 +04:00
*
2006-09-26 02:56:37 +04:00
* NLBL_MGMT_A_CV4DOI
2006-08-04 03:48:37 +04:00
*
2008-10-10 18:16:32 +04:00
* If the mapping is using the NETLBL_NLTYPE_UNLABELED type no other
* attributes are required .
2006-08-04 03:48:37 +04:00
*
* o ADDDEF :
* Sent by an application to set the default domain mapping for the NetLabel
2006-09-26 02:56:37 +04:00
* system .
2006-08-04 03:48:37 +04:00
*
2006-09-26 02:56:37 +04:00
* Required attributes :
2006-08-04 03:48:37 +04:00
*
2006-09-26 02:56:37 +04:00
* NLBL_MGMT_A_PROTOCOL
2006-08-04 03:48:37 +04:00
*
2006-09-26 02:56:37 +04:00
* If using NETLBL_NLTYPE_CIPSOV4 the following attributes are required :
2006-08-04 03:48:37 +04:00
*
2006-09-26 02:56:37 +04:00
* NLBL_MGMT_A_CV4DOI
2006-08-04 03:48:37 +04:00
*
2006-09-26 02:56:37 +04:00
* If using NETLBL_NLTYPE_UNLABELED no other attributes are required .
2006-08-04 03:48:37 +04:00
*
* o REMOVEDEF :
* Sent by an application to remove the default domain mapping from the
2006-09-26 02:56:37 +04:00
* NetLabel system , there is no payload .
2006-08-04 03:48:37 +04:00
*
* o LISTDEF :
* This message can be sent either from an application or by the kernel in
* response to an application generated LISTDEF message . When sent by an
2006-09-26 02:56:37 +04:00
* application there is no payload . On success the kernel should send a
* response using the following format .
2006-08-04 03:48:37 +04:00
*
2008-10-10 18:16:32 +04:00
* If the IP address selectors are not used the following attribute is
* required :
2006-08-04 03:48:37 +04:00
*
2006-09-26 02:56:37 +04:00
* NLBL_MGMT_A_PROTOCOL
2006-08-04 03:48:37 +04:00
*
2008-10-10 18:16:32 +04:00
* If the IP address selectors are used then the following attritbute is
* required :
*
* NLBL_MGMT_A_SELECTORLIST
*
* If the mapping is using the NETLBL_NLTYPE_CIPSOV4 type then the following
* attributes are required :
2006-08-04 03:48:37 +04:00
*
2006-09-26 02:56:37 +04:00
* NLBL_MGMT_A_CV4DOI
2006-08-04 03:48:37 +04:00
*
2008-10-10 18:16:32 +04:00
* If the mapping is using the NETLBL_NLTYPE_UNLABELED type no other
* attributes are required .
2006-08-04 03:48:37 +04:00
*
2006-09-26 02:56:37 +04:00
* o PROTOCOLS :
* Sent by an application to request a list of configured NetLabel protocols
* in the kernel . When sent by an application there is no payload and the
* NLM_F_DUMP flag should be set . The kernel should respond with a series of
* the following messages .
2006-08-04 03:48:37 +04:00
*
2006-09-26 02:56:37 +04:00
* Required attributes :
2006-08-04 03:48:37 +04:00
*
2006-09-26 02:56:37 +04:00
* NLBL_MGMT_A_PROTOCOL
2006-08-04 03:48:37 +04:00
*
* o VERSION :
2006-09-26 02:56:37 +04:00
* Sent by an application to request the NetLabel version . When sent by an
* application there is no payload . This message type is also used by the
* kernel to respond to an VERSION request .
2006-08-04 03:48:37 +04:00
*
2006-09-26 02:56:37 +04:00
* Required attributes :
2006-08-04 03:48:37 +04:00
*
2006-09-26 02:56:37 +04:00
* NLBL_MGMT_A_VERSION
2006-08-04 03:48:37 +04:00
*
*/
/* NetLabel Management commands */
enum {
NLBL_MGMT_C_UNSPEC ,
NLBL_MGMT_C_ADD ,
NLBL_MGMT_C_REMOVE ,
2006-09-26 02:56:37 +04:00
NLBL_MGMT_C_LISTALL ,
2006-08-04 03:48:37 +04:00
NLBL_MGMT_C_ADDDEF ,
NLBL_MGMT_C_REMOVEDEF ,
NLBL_MGMT_C_LISTDEF ,
2006-09-26 02:56:37 +04:00
NLBL_MGMT_C_PROTOCOLS ,
2006-08-04 03:48:37 +04:00
NLBL_MGMT_C_VERSION ,
__NLBL_MGMT_C_MAX ,
} ;
2006-09-26 02:56:37 +04:00
/* NetLabel Management attributes */
enum {
NLBL_MGMT_A_UNSPEC ,
NLBL_MGMT_A_DOMAIN ,
/* (NLA_NUL_STRING)
* the NULL terminated LSM domain string */
NLBL_MGMT_A_PROTOCOL ,
/* (NLA_U32)
* the NetLabel protocol type ( defined by NETLBL_NLTYPE_ * ) */
NLBL_MGMT_A_VERSION ,
/* (NLA_U32)
* the NetLabel protocol version number ( defined by
* NETLBL_PROTO_VERSION ) */
NLBL_MGMT_A_CV4DOI ,
/* (NLA_U32)
* the CIPSOv4 DOI value */
2008-10-10 18:16:32 +04:00
NLBL_MGMT_A_IPV6ADDR ,
/* (NLA_BINARY, struct in6_addr)
* an IPv6 address */
NLBL_MGMT_A_IPV6MASK ,
/* (NLA_BINARY, struct in6_addr)
* an IPv6 address mask */
NLBL_MGMT_A_IPV4ADDR ,
/* (NLA_BINARY, struct in_addr)
* an IPv4 address */
NLBL_MGMT_A_IPV4MASK ,
/* (NLA_BINARY, struct in_addr)
* and IPv4 address mask */
NLBL_MGMT_A_ADDRSELECTOR ,
/* (NLA_NESTED)
* an IP address selector , must contain an address , mask , and protocol
* attribute plus any protocol specific attributes */
NLBL_MGMT_A_SELECTORLIST ,
/* (NLA_NESTED)
* the selector list , there must be at least one
* NLBL_MGMT_A_ADDRSELECTOR attribute */
2006-09-26 02:56:37 +04:00
__NLBL_MGMT_A_MAX ,
} ;
# define NLBL_MGMT_A_MAX (__NLBL_MGMT_A_MAX - 1)
2006-08-04 03:48:37 +04:00
/* NetLabel protocol functions */
int netlbl_mgmt_genl_init ( void ) ;
2008-01-29 16:37:52 +03:00
/* NetLabel configured protocol reference counter */
extern atomic_t netlabel_mgmt_protocount ;
2007-07-18 20:28:45 +04:00
2006-08-04 03:48:37 +04:00
# endif