1d15c345fSPaul Moore /* 2d15c345fSPaul Moore * NetLabel Management Support 3d15c345fSPaul Moore * 4d15c345fSPaul Moore * This file defines the management functions for the NetLabel system. The 5d15c345fSPaul Moore * NetLabel system manages static and dynamic label mappings for network 6d15c345fSPaul Moore * protocols such as CIPSO and RIPSO. 7d15c345fSPaul Moore * 8d15c345fSPaul Moore * Author: Paul Moore <paul.moore@hp.com> 9d15c345fSPaul Moore * 10d15c345fSPaul Moore */ 11d15c345fSPaul Moore 12d15c345fSPaul Moore /* 13d15c345fSPaul Moore * (c) Copyright Hewlett-Packard Development Company, L.P., 2006 14d15c345fSPaul Moore * 15d15c345fSPaul Moore * This program is free software; you can redistribute it and/or modify 16d15c345fSPaul Moore * it under the terms of the GNU General Public License as published by 17d15c345fSPaul Moore * the Free Software Foundation; either version 2 of the License, or 18d15c345fSPaul Moore * (at your option) any later version. 19d15c345fSPaul Moore * 20d15c345fSPaul Moore * This program is distributed in the hope that it will be useful, 21d15c345fSPaul Moore * but WITHOUT ANY WARRANTY; without even the implied warranty of 22d15c345fSPaul Moore * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 23d15c345fSPaul Moore * the GNU General Public License for more details. 24d15c345fSPaul Moore * 25d15c345fSPaul Moore * You should have received a copy of the GNU General Public License 26d15c345fSPaul Moore * along with this program; if not, write to the Free Software 27d15c345fSPaul Moore * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 28d15c345fSPaul Moore * 29d15c345fSPaul Moore */ 30d15c345fSPaul Moore 31d15c345fSPaul Moore #ifndef _NETLABEL_MGMT_H 32d15c345fSPaul Moore #define _NETLABEL_MGMT_H 33d15c345fSPaul Moore 34d15c345fSPaul Moore #include <net/netlabel.h> 35c783f1ceSPaul Moore #include <asm/atomic.h> 36d15c345fSPaul Moore 37d15c345fSPaul Moore /* 38fd385855SPaul Moore * The following NetLabel payloads are supported by the management interface. 39d15c345fSPaul Moore * 40d15c345fSPaul Moore * o ADD: 41d15c345fSPaul Moore * Sent by an application to add a domain mapping to the NetLabel system. 42d15c345fSPaul Moore * 43fd385855SPaul Moore * Required attributes: 44d15c345fSPaul Moore * 45fd385855SPaul Moore * NLBL_MGMT_A_DOMAIN 46fd385855SPaul Moore * NLBL_MGMT_A_PROTOCOL 47d15c345fSPaul Moore * 48fd385855SPaul Moore * If using NETLBL_NLTYPE_CIPSOV4 the following attributes are required: 49d15c345fSPaul Moore * 50fd385855SPaul Moore * NLBL_MGMT_A_CV4DOI 51d15c345fSPaul Moore * 52fd385855SPaul Moore * If using NETLBL_NLTYPE_UNLABELED no other attributes are required. 53d15c345fSPaul Moore * 54d15c345fSPaul Moore * o REMOVE: 55d15c345fSPaul Moore * Sent by an application to remove a domain mapping from the NetLabel 56fd385855SPaul Moore * system. 57d15c345fSPaul Moore * 58fd385855SPaul Moore * Required attributes: 59d15c345fSPaul Moore * 60fd385855SPaul Moore * NLBL_MGMT_A_DOMAIN 61d15c345fSPaul Moore * 62fd385855SPaul Moore * o LISTALL: 63d15c345fSPaul Moore * This message can be sent either from an application or by the kernel in 64fd385855SPaul Moore * response to an application generated LISTALL message. When sent by an 65fd385855SPaul Moore * application there is no payload and the NLM_F_DUMP flag should be set. 66fd385855SPaul Moore * The kernel should respond with a series of the following messages. 67d15c345fSPaul Moore * 68fd385855SPaul Moore * Required attributes: 69d15c345fSPaul Moore * 70fd385855SPaul Moore * NLBL_MGMT_A_DOMAIN 71fd385855SPaul Moore * NLBL_MGMT_A_PROTOCOL 72d15c345fSPaul Moore * 73fd385855SPaul Moore * If using NETLBL_NLTYPE_CIPSOV4 the following attributes are required: 74d15c345fSPaul Moore * 75fd385855SPaul Moore * NLBL_MGMT_A_CV4DOI 76d15c345fSPaul Moore * 77fd385855SPaul Moore * If using NETLBL_NLTYPE_UNLABELED no other attributes are required. 78d15c345fSPaul Moore * 79d15c345fSPaul Moore * o ADDDEF: 80d15c345fSPaul Moore * Sent by an application to set the default domain mapping for the NetLabel 81fd385855SPaul Moore * system. 82d15c345fSPaul Moore * 83fd385855SPaul Moore * Required attributes: 84d15c345fSPaul Moore * 85fd385855SPaul Moore * NLBL_MGMT_A_PROTOCOL 86d15c345fSPaul Moore * 87fd385855SPaul Moore * If using NETLBL_NLTYPE_CIPSOV4 the following attributes are required: 88d15c345fSPaul Moore * 89fd385855SPaul Moore * NLBL_MGMT_A_CV4DOI 90d15c345fSPaul Moore * 91fd385855SPaul Moore * If using NETLBL_NLTYPE_UNLABELED no other attributes are required. 92d15c345fSPaul Moore * 93d15c345fSPaul Moore * o REMOVEDEF: 94d15c345fSPaul Moore * Sent by an application to remove the default domain mapping from the 95fd385855SPaul Moore * NetLabel system, there is no payload. 96d15c345fSPaul Moore * 97d15c345fSPaul Moore * o LISTDEF: 98d15c345fSPaul Moore * This message can be sent either from an application or by the kernel in 99d15c345fSPaul Moore * response to an application generated LISTDEF message. When sent by an 100fd385855SPaul Moore * application there is no payload. On success the kernel should send a 101fd385855SPaul Moore * response using the following format. 102d15c345fSPaul Moore * 103fd385855SPaul Moore * Required attributes: 104d15c345fSPaul Moore * 105fd385855SPaul Moore * NLBL_MGMT_A_PROTOCOL 106d15c345fSPaul Moore * 107fd385855SPaul Moore * If using NETLBL_NLTYPE_CIPSOV4 the following attributes are required: 108d15c345fSPaul Moore * 109fd385855SPaul Moore * NLBL_MGMT_A_CV4DOI 110d15c345fSPaul Moore * 111fd385855SPaul Moore * If using NETLBL_NLTYPE_UNLABELED no other attributes are required. 112d15c345fSPaul Moore * 113fd385855SPaul Moore * o PROTOCOLS: 114fd385855SPaul Moore * Sent by an application to request a list of configured NetLabel protocols 115fd385855SPaul Moore * in the kernel. When sent by an application there is no payload and the 116fd385855SPaul Moore * NLM_F_DUMP flag should be set. The kernel should respond with a series of 117fd385855SPaul Moore * the following messages. 118d15c345fSPaul Moore * 119fd385855SPaul Moore * Required attributes: 120d15c345fSPaul Moore * 121fd385855SPaul Moore * NLBL_MGMT_A_PROTOCOL 122d15c345fSPaul Moore * 123d15c345fSPaul Moore * o VERSION: 124fd385855SPaul Moore * Sent by an application to request the NetLabel version. When sent by an 125fd385855SPaul Moore * application there is no payload. This message type is also used by the 126fd385855SPaul Moore * kernel to respond to an VERSION request. 127d15c345fSPaul Moore * 128fd385855SPaul Moore * Required attributes: 129d15c345fSPaul Moore * 130fd385855SPaul Moore * NLBL_MGMT_A_VERSION 131d15c345fSPaul Moore * 132d15c345fSPaul Moore */ 133d15c345fSPaul Moore 134d15c345fSPaul Moore /* NetLabel Management commands */ 135d15c345fSPaul Moore enum { 136d15c345fSPaul Moore NLBL_MGMT_C_UNSPEC, 137d15c345fSPaul Moore NLBL_MGMT_C_ADD, 138d15c345fSPaul Moore NLBL_MGMT_C_REMOVE, 139fd385855SPaul Moore NLBL_MGMT_C_LISTALL, 140d15c345fSPaul Moore NLBL_MGMT_C_ADDDEF, 141d15c345fSPaul Moore NLBL_MGMT_C_REMOVEDEF, 142d15c345fSPaul Moore NLBL_MGMT_C_LISTDEF, 143fd385855SPaul Moore NLBL_MGMT_C_PROTOCOLS, 144d15c345fSPaul Moore NLBL_MGMT_C_VERSION, 145d15c345fSPaul Moore __NLBL_MGMT_C_MAX, 146d15c345fSPaul Moore }; 147d15c345fSPaul Moore #define NLBL_MGMT_C_MAX (__NLBL_MGMT_C_MAX - 1) 148d15c345fSPaul Moore 149fd385855SPaul Moore /* NetLabel Management attributes */ 150fd385855SPaul Moore enum { 151fd385855SPaul Moore NLBL_MGMT_A_UNSPEC, 152fd385855SPaul Moore NLBL_MGMT_A_DOMAIN, 153fd385855SPaul Moore /* (NLA_NUL_STRING) 154fd385855SPaul Moore * the NULL terminated LSM domain string */ 155fd385855SPaul Moore NLBL_MGMT_A_PROTOCOL, 156fd385855SPaul Moore /* (NLA_U32) 157fd385855SPaul Moore * the NetLabel protocol type (defined by NETLBL_NLTYPE_*) */ 158fd385855SPaul Moore NLBL_MGMT_A_VERSION, 159fd385855SPaul Moore /* (NLA_U32) 160fd385855SPaul Moore * the NetLabel protocol version number (defined by 161fd385855SPaul Moore * NETLBL_PROTO_VERSION) */ 162fd385855SPaul Moore NLBL_MGMT_A_CV4DOI, 163fd385855SPaul Moore /* (NLA_U32) 164fd385855SPaul Moore * the CIPSOv4 DOI value */ 165fd385855SPaul Moore __NLBL_MGMT_A_MAX, 166fd385855SPaul Moore }; 167fd385855SPaul Moore #define NLBL_MGMT_A_MAX (__NLBL_MGMT_A_MAX - 1) 168fd385855SPaul Moore 169d15c345fSPaul Moore /* NetLabel protocol functions */ 170d15c345fSPaul Moore int netlbl_mgmt_genl_init(void); 171d15c345fSPaul Moore 172c783f1ceSPaul Moore /* NetLabel configured protocol reference counter */ 173c783f1ceSPaul Moore extern atomic_t netlabel_mgmt_protocount; 17423bcdc1aSPaul Moore 175d15c345fSPaul Moore #endif 176