|
Packit |
51d0f7 |
/** @file
|
|
Packit |
51d0f7 |
* NetLabel Library init/exit Functions
|
|
Packit |
51d0f7 |
*
|
|
Packit |
51d0f7 |
* Author: Paul Moore <paul@paul-moore.com>
|
|
Packit |
51d0f7 |
*
|
|
Packit |
51d0f7 |
*/
|
|
Packit |
51d0f7 |
|
|
Packit |
51d0f7 |
/*
|
|
Packit |
51d0f7 |
* (c) Copyright Hewlett-Packard Development Company, L.P., 2006
|
|
Packit |
51d0f7 |
*
|
|
Packit |
51d0f7 |
* This program is free software: you can redistribute it and/or modify
|
|
Packit |
51d0f7 |
* it under the terms of version 2 of the GNU General Public License as
|
|
Packit |
51d0f7 |
* published by the Free Software Foundation.
|
|
Packit |
51d0f7 |
*
|
|
Packit |
51d0f7 |
* This program is distributed in the hope that it will be useful,
|
|
Packit |
51d0f7 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
51d0f7 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit |
51d0f7 |
* GNU General Public License for more details.
|
|
Packit |
51d0f7 |
*
|
|
Packit |
51d0f7 |
* You should have received a copy of the GNU General Public License
|
|
Packit |
51d0f7 |
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
Packit |
51d0f7 |
*
|
|
Packit |
51d0f7 |
*/
|
|
Packit |
51d0f7 |
|
|
Packit |
51d0f7 |
#include <stdlib.h>
|
|
Packit |
51d0f7 |
#include <errno.h>
|
|
Packit |
51d0f7 |
#include <sys/types.h>
|
|
Packit |
51d0f7 |
#include <sys/socket.h>
|
|
Packit |
51d0f7 |
#include <linux/types.h>
|
|
Packit |
51d0f7 |
|
|
Packit |
51d0f7 |
#include <libnetlabel.h>
|
|
Packit |
51d0f7 |
|
|
Packit |
51d0f7 |
#include "netlabel_internal.h"
|
|
Packit |
51d0f7 |
#include "mod_mgmt.h"
|
|
Packit |
51d0f7 |
#include "mod_unlabeled.h"
|
|
Packit |
51d0f7 |
#include "mod_cipso.h"
|
|
Packit |
51d0f7 |
#include "mod_calipso.h"
|
|
Packit |
51d0f7 |
|
|
Packit |
51d0f7 |
/**
|
|
Packit |
51d0f7 |
* Handle any NetLabel setup needed
|
|
Packit |
51d0f7 |
*
|
|
Packit |
51d0f7 |
* Initialize the NetLabel communication link, but do not open any general use
|
|
Packit |
51d0f7 |
* NetLabel handles. Returns zero on success, negative values on failure.
|
|
Packit |
51d0f7 |
*
|
|
Packit |
51d0f7 |
*/
|
|
Packit |
51d0f7 |
int nlbl_init(void)
|
|
Packit |
51d0f7 |
{
|
|
Packit |
51d0f7 |
int rc;
|
|
Packit |
51d0f7 |
|
|
Packit |
51d0f7 |
nlmsg_set_default_size(8192);
|
|
Packit |
51d0f7 |
|
|
Packit |
51d0f7 |
rc = nlbl_mgmt_init();
|
|
Packit |
51d0f7 |
if (rc < 0)
|
|
Packit |
51d0f7 |
return rc;
|
|
Packit |
51d0f7 |
|
|
Packit |
51d0f7 |
rc = nlbl_cipso_init();
|
|
Packit |
51d0f7 |
if (rc < 0)
|
|
Packit |
51d0f7 |
return rc;
|
|
Packit |
51d0f7 |
|
|
Packit |
51d0f7 |
rc = nlbl_unlbl_init();
|
|
Packit |
51d0f7 |
if (rc < 0)
|
|
Packit |
51d0f7 |
return rc;
|
|
Packit |
51d0f7 |
|
|
Packit |
51d0f7 |
/* CALISPO support may not exist in the kernel so
|
|
Packit |
51d0f7 |
don't return an error if it doesn't. */
|
|
Packit |
51d0f7 |
nlbl_calipso_init();
|
|
Packit |
51d0f7 |
|
|
Packit |
51d0f7 |
return 0;
|
|
Packit |
51d0f7 |
}
|
|
Packit |
51d0f7 |
|
|
Packit |
51d0f7 |
/**
|
|
Packit |
51d0f7 |
* Handle any NetLabel cleanup
|
|
Packit |
51d0f7 |
*
|
|
Packit |
51d0f7 |
* Perform any cleanup duties for the NetLabel communication link, does not
|
|
Packit |
51d0f7 |
* close any handles.
|
|
Packit |
51d0f7 |
*
|
|
Packit |
51d0f7 |
*/
|
|
Packit |
51d0f7 |
void nlbl_exit(void)
|
|
Packit |
51d0f7 |
{
|
|
Packit |
51d0f7 |
return;
|
|
Packit |
51d0f7 |
}
|