Merge branch 'master' into upstream
[sfrench/cifs-2.6.git] / net / netlabel / netlabel_user.c
1 /*
2  * NetLabel NETLINK Interface
3  *
4  * This file defines the NETLINK interface 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  * Author: Paul Moore <paul.moore@hp.com>
9  *
10  */
11
12 /*
13  * (c) Copyright Hewlett-Packard Development Company, L.P., 2006
14  *
15  * This program is free software;  you can redistribute it and/or modify
16  * it under the terms of the GNU General Public License as published by
17  * the Free Software Foundation; either version 2 of the License, or
18  * (at your option) any later version.
19  *
20  * This program is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY;  without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
23  * the GNU General Public License for more details.
24  *
25  * You should have received a copy of the GNU General Public License
26  * along with this program;  if not, write to the Free Software
27  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28  *
29  */
30
31 #include <linux/init.h>
32 #include <linux/types.h>
33 #include <linux/list.h>
34 #include <linux/socket.h>
35 #include <net/sock.h>
36 #include <net/netlink.h>
37 #include <net/genetlink.h>
38 #include <net/netlabel.h>
39 #include <asm/bug.h>
40
41 #include "netlabel_mgmt.h"
42 #include "netlabel_unlabeled.h"
43 #include "netlabel_cipso_v4.h"
44 #include "netlabel_user.h"
45
46 /*
47  * NetLabel NETLINK Setup Functions
48  */
49
50 /**
51  * netlbl_netlink_init - Initialize the NETLINK communication channel
52  *
53  * Description:
54  * Call out to the NetLabel components so they can register their families and
55  * commands with the Generic NETLINK mechanism.  Returns zero on success and
56  * non-zero on failure.
57  *
58  */
59 int netlbl_netlink_init(void)
60 {
61         int ret_val;
62
63         ret_val = netlbl_mgmt_genl_init();
64         if (ret_val != 0)
65                 return ret_val;
66
67         ret_val = netlbl_cipsov4_genl_init();
68         if (ret_val != 0)
69                 return ret_val;
70
71         ret_val = netlbl_unlabel_genl_init();
72         if (ret_val != 0)
73                 return ret_val;
74
75         return 0;
76 }