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