xref: /openbmc/linux/net/netlabel/netlabel_unlabeled.h (revision fd3858554b62c3af6b7664b5c58ad864c87116c9)
1d15c345fSPaul Moore /*
2d15c345fSPaul Moore  * NetLabel Unlabeled Support
3d15c345fSPaul Moore  *
4d15c345fSPaul Moore  * This file defines functions for dealing with unlabeled packets for the
5d15c345fSPaul Moore  * NetLabel system.  The NetLabel system manages static and dynamic label
6d15c345fSPaul Moore  * mappings for network 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_UNLABELED_H
32d15c345fSPaul Moore #define _NETLABEL_UNLABELED_H
33d15c345fSPaul Moore 
34d15c345fSPaul Moore #include <net/netlabel.h>
35d15c345fSPaul Moore 
36d15c345fSPaul Moore /*
37d15c345fSPaul Moore  * The following NetLabel payloads are supported by the Unlabeled subsystem.
38d15c345fSPaul Moore  *
39d15c345fSPaul Moore  * o ACCEPT
40d15c345fSPaul Moore  *   This message is sent from an application to specify if the kernel should
41d15c345fSPaul Moore  *   allow unlabled packets to pass if they do not match any of the static
42d15c345fSPaul Moore  *   mappings defined in the unlabeled module.
43d15c345fSPaul Moore  *
44*fd385855SPaul Moore  *   Required attributes:
45d15c345fSPaul Moore  *
46*fd385855SPaul Moore  *     NLBL_UNLABEL_A_ACPTFLG
47d15c345fSPaul Moore  *
48d15c345fSPaul Moore  * o LIST
49d15c345fSPaul Moore  *   This message can be sent either from an application or by the kernel in
50d15c345fSPaul Moore  *   response to an application generated LIST message.  When sent by an
51d15c345fSPaul Moore  *   application there is no payload.  The kernel should respond to a LIST
52*fd385855SPaul Moore  *   message with a LIST message on success.
53d15c345fSPaul Moore  *
54*fd385855SPaul Moore  *   Required attributes:
55d15c345fSPaul Moore  *
56*fd385855SPaul Moore  *     NLBL_UNLABEL_A_ACPTFLG
57d15c345fSPaul Moore  *
58d15c345fSPaul Moore  */
59d15c345fSPaul Moore 
60d15c345fSPaul Moore /* NetLabel Unlabeled commands */
61d15c345fSPaul Moore enum {
62d15c345fSPaul Moore 	NLBL_UNLABEL_C_UNSPEC,
63d15c345fSPaul Moore 	NLBL_UNLABEL_C_ACCEPT,
64d15c345fSPaul Moore 	NLBL_UNLABEL_C_LIST,
65d15c345fSPaul Moore 	__NLBL_UNLABEL_C_MAX,
66d15c345fSPaul Moore };
67d15c345fSPaul Moore #define NLBL_UNLABEL_C_MAX (__NLBL_UNLABEL_C_MAX - 1)
68d15c345fSPaul Moore 
69*fd385855SPaul Moore /* NetLabel Unlabeled attributes */
70*fd385855SPaul Moore enum {
71*fd385855SPaul Moore 	NLBL_UNLABEL_A_UNSPEC,
72*fd385855SPaul Moore 	NLBL_UNLABEL_A_ACPTFLG,
73*fd385855SPaul Moore 	/* (NLA_U8)
74*fd385855SPaul Moore 	 * if true then unlabeled packets are allowed to pass, else unlabeled
75*fd385855SPaul Moore 	 * packets are rejected */
76*fd385855SPaul Moore 	__NLBL_UNLABEL_A_MAX,
77*fd385855SPaul Moore };
78*fd385855SPaul Moore #define NLBL_UNLABEL_A_MAX (__NLBL_UNLABEL_A_MAX - 1)
79*fd385855SPaul Moore 
80d15c345fSPaul Moore /* NetLabel protocol functions */
81d15c345fSPaul Moore int netlbl_unlabel_genl_init(void);
82d15c345fSPaul Moore 
83d15c345fSPaul Moore /* Process Unlabeled incoming network packets */
84d15c345fSPaul Moore int netlbl_unlabel_getattr(struct netlbl_lsm_secattr *secattr);
85d15c345fSPaul Moore 
86d15c345fSPaul Moore /* Set the default configuration to allow Unlabeled packets */
87d15c345fSPaul Moore int netlbl_unlabel_defconf(void);
88d15c345fSPaul Moore 
89d15c345fSPaul Moore #endif
90