aboutsummaryrefslogtreecommitdiffstats
path: root/net/netlabel/netlabel_calipso.h
diff options
context:
space:
mode:
authorHuw Davies <huw@codeweavers.com>2016-06-27 15:02:46 -0400
committerPaul Moore <paul@paul-moore.com>2016-06-27 15:02:46 -0400
commitcb72d38211eacda2dd90b09540542b6582da614e (patch)
tree2a9be751e1917ede6f9a56f547eafacfa202d1e7 /net/netlabel/netlabel_calipso.h
parent8f18e675c3335b5f113dbabc4afbab6da41ff61f (diff)
netlabel: Initial support for the CALIPSO netlink protocol.
CALIPSO is a packet labelling protocol for IPv6 which is very similar to CIPSO. It is specified in RFC 5570. Much of the code is based on the current CIPSO code. This adds support for adding passthrough-type CALIPSO DOIs through the NLBL_CALIPSO_C_ADD command. It requires attributes: NLBL_CALIPSO_A_TYPE which must be CALIPSO_MAP_PASS. NLBL_CALIPSO_A_DOI. In passthrough mode the CALIPSO engine will map MLS secattr levels and categories directly to the packet label. At this stage, the major difference between this and the CIPSO code is that IPv6 may be compiled as a module. To allow for this the CALIPSO functions are registered at module init time. Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'net/netlabel/netlabel_calipso.h')
-rw-r--r--net/netlabel/netlabel_calipso.h90
1 files changed, 90 insertions, 0 deletions
diff --git a/net/netlabel/netlabel_calipso.h b/net/netlabel/netlabel_calipso.h
new file mode 100644
index 000000000000..f78790a6ce4f
--- /dev/null
+++ b/net/netlabel/netlabel_calipso.h
@@ -0,0 +1,90 @@
1/*
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 *
49 */
50
51/* NetLabel CALIPSO commands */
52enum {
53 NLBL_CALIPSO_C_UNSPEC,
54 NLBL_CALIPSO_C_ADD,
55 NLBL_CALIPSO_C_REMOVE,
56 NLBL_CALIPSO_C_LIST,
57 NLBL_CALIPSO_C_LISTALL,
58 __NLBL_CALIPSO_C_MAX,
59};
60
61/* NetLabel CALIPSO attributes */
62enum {
63 NLBL_CALIPSO_A_UNSPEC,
64 NLBL_CALIPSO_A_DOI,
65 /* (NLA_U32)
66 * the DOI value */
67 NLBL_CALIPSO_A_MTYPE,
68 /* (NLA_U32)
69 * the mapping table type (defined in the calipso.h header as
70 * CALIPSO_MAP_*) */
71 __NLBL_CALIPSO_A_MAX,
72};
73
74#define NLBL_CALIPSO_A_MAX (__NLBL_CALIPSO_A_MAX - 1)
75
76/* NetLabel protocol functions */
77#if IS_ENABLED(CONFIG_IPV6)
78int netlbl_calipso_genl_init(void);
79#else
80static inline int netlbl_calipso_genl_init(void)
81{
82 return 0;
83}
84#endif
85
86int calipso_doi_add(struct calipso_doi *doi_def,
87 struct netlbl_audit *audit_info);
88void calipso_doi_free(struct calipso_doi *doi_def);
89
90#endif