blob: 6da737a9f37a2e2e6c3fc6f4a15e00a90a06c5c0 [file] [log] [blame]
Huw Daviescb72d382016-06-27 15:02:46 -04001/*
2 * NetLabel CALIPSO Support
3 *
4 * This file defines the CALIPSO 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 * Authors: Paul Moore <paul@paul-moore.com>
9 * Huw Davies <huw@codeweavers.com>
10 *
11 */
12
13/* (c) Copyright Hewlett-Packard Development Company, L.P., 2006
14 * (c) Copyright Huw Davies <huw@codeweavers.com>, 2015
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 of the License, or
19 * (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
24 * the GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, see <http://www.gnu.org/licenses/>.
28 *
29 */
30
31#ifndef _NETLABEL_CALIPSO
32#define _NETLABEL_CALIPSO
33
34#include <net/netlabel.h>
35#include <net/calipso.h>
36
37/* The following NetLabel payloads are supported by the CALIPSO subsystem.
38 *
39 * o ADD:
40 * Sent by an application to add a new DOI mapping table.
41 *
42 * Required attributes:
43 *
44 * NLBL_CALIPSO_A_DOI
45 * NLBL_CALIPSO_A_MTYPE
46 *
47 * If using CALIPSO_MAP_PASS no additional attributes are required.
48 *
Huw Daviesa5e34492016-06-27 15:02:47 -040049 * o LIST:
50 * Sent by an application to list the details of a DOI definition. On
51 * success the kernel should send a response using the following format.
52 *
53 * Required attributes:
54 *
55 * NLBL_CALIPSO_A_DOI
56 *
57 * The valid response message format depends on the type of the DOI mapping,
58 * the defined formats are shown below.
59 *
60 * Required attributes:
61 *
62 * NLBL_CALIPSO_A_MTYPE
63 *
64 * If using CALIPSO_MAP_PASS no additional attributes are required.
65 *
Huw Daviescb72d382016-06-27 15:02:46 -040066 */
67
68/* NetLabel CALIPSO commands */
69enum {
70 NLBL_CALIPSO_C_UNSPEC,
71 NLBL_CALIPSO_C_ADD,
72 NLBL_CALIPSO_C_REMOVE,
73 NLBL_CALIPSO_C_LIST,
74 NLBL_CALIPSO_C_LISTALL,
75 __NLBL_CALIPSO_C_MAX,
76};
77
78/* NetLabel CALIPSO attributes */
79enum {
80 NLBL_CALIPSO_A_UNSPEC,
81 NLBL_CALIPSO_A_DOI,
82 /* (NLA_U32)
83 * the DOI value */
84 NLBL_CALIPSO_A_MTYPE,
85 /* (NLA_U32)
86 * the mapping table type (defined in the calipso.h header as
87 * CALIPSO_MAP_*) */
88 __NLBL_CALIPSO_A_MAX,
89};
90
91#define NLBL_CALIPSO_A_MAX (__NLBL_CALIPSO_A_MAX - 1)
92
93/* NetLabel protocol functions */
94#if IS_ENABLED(CONFIG_IPV6)
95int netlbl_calipso_genl_init(void);
96#else
97static inline int netlbl_calipso_genl_init(void)
98{
99 return 0;
100}
101#endif
102
103int calipso_doi_add(struct calipso_doi *doi_def,
104 struct netlbl_audit *audit_info);
105void calipso_doi_free(struct calipso_doi *doi_def);
Huw Daviesa5e34492016-06-27 15:02:47 -0400106struct calipso_doi *calipso_doi_getdef(u32 doi);
107void calipso_doi_putdef(struct calipso_doi *doi_def);
Huw Daviescb72d382016-06-27 15:02:46 -0400108
109#endif