aboutsummaryrefslogtreecommitdiffstats
path: root/net/netlabel/netlabel_kapi.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/netlabel/netlabel_kapi.c')
-rw-r--r--net/netlabel/netlabel_kapi.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/net/netlabel/netlabel_kapi.c b/net/netlabel/netlabel_kapi.c
index b165712aaa70..4f50949722a9 100644
--- a/net/netlabel/netlabel_kapi.c
+++ b/net/netlabel/netlabel_kapi.c
@@ -38,6 +38,7 @@
38#include "netlabel_domainhash.h" 38#include "netlabel_domainhash.h"
39#include "netlabel_unlabeled.h" 39#include "netlabel_unlabeled.h"
40#include "netlabel_user.h" 40#include "netlabel_user.h"
41#include "netlabel_mgmt.h"
41 42
42/* 43/*
43 * Security Attribute Functions 44 * Security Attribute Functions
@@ -245,6 +246,26 @@ int netlbl_secattr_catmap_setrng(struct netlbl_lsm_secattr_catmap *catmap,
245 */ 246 */
246 247
247/** 248/**
249 * netlbl_enabled - Determine if the NetLabel subsystem is enabled
250 *
251 * Description:
252 * The LSM can use this function to determine if it should use NetLabel
253 * security attributes in it's enforcement mechanism. Currently, NetLabel is
254 * considered to be enabled when it's configuration contains a valid setup for
255 * at least one labeled protocol (i.e. NetLabel can understand incoming
256 * labeled packets of at least one type); otherwise NetLabel is considered to
257 * be disabled.
258 *
259 */
260int netlbl_enabled(void)
261{
262 /* At some point we probably want to expose this mechanism to the user
263 * as well so that admins can toggle NetLabel regardless of the
264 * configuration */
265 return (netlbl_mgmt_protocount_value() > 0 ? 1 : 0);
266}
267
268/**
248 * netlbl_socket_setattr - Label a socket using the correct protocol 269 * netlbl_socket_setattr - Label a socket using the correct protocol
249 * @sk: the socket to label 270 * @sk: the socket to label
250 * @secattr: the security attributes 271 * @secattr: the security attributes