2 * NetLabel Management Support
4 * This file defines the management functions for the NetLabel system. The
5 * NetLabel system manages static and dynamic label mappings for network
6 * protocols such as CIPSO and RIPSO.
8 * Author: Paul Moore <paul@paul-moore.com>
13 * (c) Copyright Hewlett-Packard Development Company, L.P., 2006, 2008
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.
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.
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, see <http://www.gnu.org/licenses/>.
30 #include <linux/types.h>
31 #include <linux/socket.h>
32 #include <linux/string.h>
33 #include <linux/skbuff.h>
35 #include <linux/in6.h>
36 #include <linux/slab.h>
38 #include <net/netlink.h>
39 #include <net/genetlink.h>
42 #include <net/netlabel.h>
43 #include <net/cipso_ipv4.h>
44 #include <net/calipso.h>
45 #include <linux/atomic.h>
47 #include "netlabel_calipso.h"
48 #include "netlabel_domainhash.h"
49 #include "netlabel_user.h"
50 #include "netlabel_mgmt.h"
52 /* NetLabel configured protocol counter */
53 atomic_t netlabel_mgmt_protocount = ATOMIC_INIT(0);
55 /* Argument struct for netlbl_domhsh_walk() */
56 struct netlbl_domhsh_walk_arg {
57 struct netlink_callback *nl_cb;
62 /* NetLabel Generic NETLINK CIPSOv4 family */
63 static struct genl_family netlbl_mgmt_gnl_family = {
64 .id = GENL_ID_GENERATE,
66 .name = NETLBL_NLTYPE_MGMT_NAME,
67 .version = NETLBL_PROTO_VERSION,
68 .maxattr = NLBL_MGMT_A_MAX,
71 /* NetLabel Netlink attribute policy */
72 static const struct nla_policy netlbl_mgmt_genl_policy[NLBL_MGMT_A_MAX + 1] = {
73 [NLBL_MGMT_A_DOMAIN] = { .type = NLA_NUL_STRING },
74 [NLBL_MGMT_A_PROTOCOL] = { .type = NLA_U32 },
75 [NLBL_MGMT_A_VERSION] = { .type = NLA_U32 },
76 [NLBL_MGMT_A_CV4DOI] = { .type = NLA_U32 },
77 [NLBL_MGMT_A_FAMILY] = { .type = NLA_U16 },
78 [NLBL_MGMT_A_CLPDOI] = { .type = NLA_U32 },
86 * netlbl_mgmt_add - Handle an ADD message
87 * @info: the Generic NETLINK info block
88 * @audit_info: NetLabel audit information
91 * Helper function for the ADD and ADDDEF messages to add the domain mappings
92 * from the message to the hash table. See netlabel.h for a description of the
93 * message format. Returns zero on success, negative values on failure.
96 static int netlbl_mgmt_add_common(struct genl_info *info,
97 struct netlbl_audit *audit_info)
99 int ret_val = -EINVAL;
100 struct netlbl_domaddr_map *addrmap = NULL;
101 struct cipso_v4_doi *cipsov4 = NULL;
102 #if IS_ENABLED(CONFIG_IPV6)
103 struct calipso_doi *calipso = NULL;
106 struct netlbl_dom_map *entry = kzalloc(sizeof(*entry), GFP_KERNEL);
110 entry->def.type = nla_get_u32(info->attrs[NLBL_MGMT_A_PROTOCOL]);
111 if (info->attrs[NLBL_MGMT_A_DOMAIN]) {
112 size_t tmp_size = nla_len(info->attrs[NLBL_MGMT_A_DOMAIN]);
113 entry->domain = kmalloc(tmp_size, GFP_KERNEL);
114 if (entry->domain == NULL) {
118 nla_strlcpy(entry->domain,
119 info->attrs[NLBL_MGMT_A_DOMAIN], tmp_size);
122 /* NOTE: internally we allow/use a entry->def.type value of
123 * NETLBL_NLTYPE_ADDRSELECT but we don't currently allow users
124 * to pass that as a protocol value because we need to know the
127 switch (entry->def.type) {
128 case NETLBL_NLTYPE_UNLABELED:
129 if (info->attrs[NLBL_MGMT_A_FAMILY])
131 nla_get_u16(info->attrs[NLBL_MGMT_A_FAMILY]);
133 entry->family = AF_UNSPEC;
135 case NETLBL_NLTYPE_CIPSOV4:
136 if (!info->attrs[NLBL_MGMT_A_CV4DOI])
137 goto add_free_domain;
139 tmp_val = nla_get_u32(info->attrs[NLBL_MGMT_A_CV4DOI]);
140 cipsov4 = cipso_v4_doi_getdef(tmp_val);
142 goto add_free_domain;
143 entry->family = AF_INET;
144 entry->def.cipso = cipsov4;
146 #if IS_ENABLED(CONFIG_IPV6)
147 case NETLBL_NLTYPE_CALIPSO:
148 if (!info->attrs[NLBL_MGMT_A_CLPDOI])
149 goto add_free_domain;
151 tmp_val = nla_get_u32(info->attrs[NLBL_MGMT_A_CLPDOI]);
152 calipso = calipso_doi_getdef(tmp_val);
154 goto add_free_domain;
155 entry->family = AF_INET6;
156 entry->def.calipso = calipso;
160 goto add_free_domain;
163 if ((entry->family == AF_INET && info->attrs[NLBL_MGMT_A_IPV6ADDR]) ||
164 (entry->family == AF_INET6 && info->attrs[NLBL_MGMT_A_IPV4ADDR]))
165 goto add_doi_put_def;
167 if (info->attrs[NLBL_MGMT_A_IPV4ADDR]) {
168 struct in_addr *addr;
169 struct in_addr *mask;
170 struct netlbl_domaddr4_map *map;
172 addrmap = kzalloc(sizeof(*addrmap), GFP_KERNEL);
173 if (addrmap == NULL) {
175 goto add_doi_put_def;
177 INIT_LIST_HEAD(&addrmap->list4);
178 INIT_LIST_HEAD(&addrmap->list6);
180 if (nla_len(info->attrs[NLBL_MGMT_A_IPV4ADDR]) !=
181 sizeof(struct in_addr)) {
183 goto add_free_addrmap;
185 if (nla_len(info->attrs[NLBL_MGMT_A_IPV4MASK]) !=
186 sizeof(struct in_addr)) {
188 goto add_free_addrmap;
190 addr = nla_data(info->attrs[NLBL_MGMT_A_IPV4ADDR]);
191 mask = nla_data(info->attrs[NLBL_MGMT_A_IPV4MASK]);
193 map = kzalloc(sizeof(*map), GFP_KERNEL);
196 goto add_free_addrmap;
198 map->list.addr = addr->s_addr & mask->s_addr;
199 map->list.mask = mask->s_addr;
201 map->def.type = entry->def.type;
203 map->def.cipso = cipsov4;
205 ret_val = netlbl_af4list_add(&map->list, &addrmap->list4);
208 goto add_free_addrmap;
211 entry->family = AF_INET;
212 entry->def.type = NETLBL_NLTYPE_ADDRSELECT;
213 entry->def.addrsel = addrmap;
214 #if IS_ENABLED(CONFIG_IPV6)
215 } else if (info->attrs[NLBL_MGMT_A_IPV6ADDR]) {
216 struct in6_addr *addr;
217 struct in6_addr *mask;
218 struct netlbl_domaddr6_map *map;
220 addrmap = kzalloc(sizeof(*addrmap), GFP_KERNEL);
221 if (addrmap == NULL) {
223 goto add_doi_put_def;
225 INIT_LIST_HEAD(&addrmap->list4);
226 INIT_LIST_HEAD(&addrmap->list6);
228 if (nla_len(info->attrs[NLBL_MGMT_A_IPV6ADDR]) !=
229 sizeof(struct in6_addr)) {
231 goto add_free_addrmap;
233 if (nla_len(info->attrs[NLBL_MGMT_A_IPV6MASK]) !=
234 sizeof(struct in6_addr)) {
236 goto add_free_addrmap;
238 addr = nla_data(info->attrs[NLBL_MGMT_A_IPV6ADDR]);
239 mask = nla_data(info->attrs[NLBL_MGMT_A_IPV6MASK]);
241 map = kzalloc(sizeof(*map), GFP_KERNEL);
244 goto add_free_addrmap;
246 map->list.addr = *addr;
247 map->list.addr.s6_addr32[0] &= mask->s6_addr32[0];
248 map->list.addr.s6_addr32[1] &= mask->s6_addr32[1];
249 map->list.addr.s6_addr32[2] &= mask->s6_addr32[2];
250 map->list.addr.s6_addr32[3] &= mask->s6_addr32[3];
251 map->list.mask = *mask;
253 map->def.type = entry->def.type;
255 map->def.calipso = calipso;
257 ret_val = netlbl_af6list_add(&map->list, &addrmap->list6);
260 goto add_free_addrmap;
263 entry->family = AF_INET6;
264 entry->def.type = NETLBL_NLTYPE_ADDRSELECT;
265 entry->def.addrsel = addrmap;
269 ret_val = netlbl_domhsh_add(entry, audit_info);
271 goto add_free_addrmap;
278 cipso_v4_doi_putdef(cipsov4);
279 #if IS_ENABLED(CONFIG_IPV6)
280 calipso_doi_putdef(calipso);
283 kfree(entry->domain);
290 * netlbl_mgmt_listentry - List a NetLabel/LSM domain map entry
291 * @skb: the NETLINK buffer
292 * @entry: the map entry
295 * This function is a helper function used by the LISTALL and LISTDEF command
296 * handlers. The caller is responsible for ensuring that the RCU read lock
297 * is held. Returns zero on success, negative values on failure.
300 static int netlbl_mgmt_listentry(struct sk_buff *skb,
301 struct netlbl_dom_map *entry)
304 struct nlattr *nla_a;
305 struct nlattr *nla_b;
306 struct netlbl_af4list *iter4;
307 #if IS_ENABLED(CONFIG_IPV6)
308 struct netlbl_af6list *iter6;
311 if (entry->domain != NULL) {
312 ret_val = nla_put_string(skb,
313 NLBL_MGMT_A_DOMAIN, entry->domain);
318 ret_val = nla_put_u16(skb, NLBL_MGMT_A_FAMILY, entry->family);
322 switch (entry->def.type) {
323 case NETLBL_NLTYPE_ADDRSELECT:
324 nla_a = nla_nest_start(skb, NLBL_MGMT_A_SELECTORLIST);
328 netlbl_af4list_foreach_rcu(iter4, &entry->def.addrsel->list4) {
329 struct netlbl_domaddr4_map *map4;
330 struct in_addr addr_struct;
332 nla_b = nla_nest_start(skb, NLBL_MGMT_A_ADDRSELECTOR);
336 addr_struct.s_addr = iter4->addr;
337 ret_val = nla_put_in_addr(skb, NLBL_MGMT_A_IPV4ADDR,
341 addr_struct.s_addr = iter4->mask;
342 ret_val = nla_put_in_addr(skb, NLBL_MGMT_A_IPV4MASK,
346 map4 = netlbl_domhsh_addr4_entry(iter4);
347 ret_val = nla_put_u32(skb, NLBL_MGMT_A_PROTOCOL,
351 switch (map4->def.type) {
352 case NETLBL_NLTYPE_CIPSOV4:
353 ret_val = nla_put_u32(skb, NLBL_MGMT_A_CV4DOI,
354 map4->def.cipso->doi);
360 nla_nest_end(skb, nla_b);
362 #if IS_ENABLED(CONFIG_IPV6)
363 netlbl_af6list_foreach_rcu(iter6, &entry->def.addrsel->list6) {
364 struct netlbl_domaddr6_map *map6;
366 nla_b = nla_nest_start(skb, NLBL_MGMT_A_ADDRSELECTOR);
370 ret_val = nla_put_in6_addr(skb, NLBL_MGMT_A_IPV6ADDR,
374 ret_val = nla_put_in6_addr(skb, NLBL_MGMT_A_IPV6MASK,
378 map6 = netlbl_domhsh_addr6_entry(iter6);
379 ret_val = nla_put_u32(skb, NLBL_MGMT_A_PROTOCOL,
384 switch (map6->def.type) {
385 case NETLBL_NLTYPE_CALIPSO:
386 ret_val = nla_put_u32(skb, NLBL_MGMT_A_CLPDOI,
387 map6->def.calipso->doi);
393 nla_nest_end(skb, nla_b);
397 nla_nest_end(skb, nla_a);
399 case NETLBL_NLTYPE_UNLABELED:
400 ret_val = nla_put_u32(skb, NLBL_MGMT_A_PROTOCOL,
403 case NETLBL_NLTYPE_CIPSOV4:
404 ret_val = nla_put_u32(skb, NLBL_MGMT_A_PROTOCOL,
408 ret_val = nla_put_u32(skb, NLBL_MGMT_A_CV4DOI,
409 entry->def.cipso->doi);
411 case NETLBL_NLTYPE_CALIPSO:
412 ret_val = nla_put_u32(skb, NLBL_MGMT_A_PROTOCOL,
416 ret_val = nla_put_u32(skb, NLBL_MGMT_A_CLPDOI,
417 entry->def.calipso->doi);
425 * NetLabel Command Handlers
429 * netlbl_mgmt_add - Handle an ADD message
430 * @skb: the NETLINK buffer
431 * @info: the Generic NETLINK info block
434 * Process a user generated ADD message and add the domains from the message
435 * to the hash table. See netlabel.h for a description of the message format.
436 * Returns zero on success, negative values on failure.
439 static int netlbl_mgmt_add(struct sk_buff *skb, struct genl_info *info)
441 struct netlbl_audit audit_info;
443 if ((!info->attrs[NLBL_MGMT_A_DOMAIN]) ||
444 (!info->attrs[NLBL_MGMT_A_PROTOCOL]) ||
445 (info->attrs[NLBL_MGMT_A_IPV4ADDR] &&
446 info->attrs[NLBL_MGMT_A_IPV6ADDR]) ||
447 (info->attrs[NLBL_MGMT_A_IPV4MASK] &&
448 info->attrs[NLBL_MGMT_A_IPV6MASK]) ||
449 ((info->attrs[NLBL_MGMT_A_IPV4ADDR] != NULL) ^
450 (info->attrs[NLBL_MGMT_A_IPV4MASK] != NULL)) ||
451 ((info->attrs[NLBL_MGMT_A_IPV6ADDR] != NULL) ^
452 (info->attrs[NLBL_MGMT_A_IPV6MASK] != NULL)))
455 netlbl_netlink_auditinfo(skb, &audit_info);
457 return netlbl_mgmt_add_common(info, &audit_info);
461 * netlbl_mgmt_remove - Handle a REMOVE message
462 * @skb: the NETLINK buffer
463 * @info: the Generic NETLINK info block
466 * Process a user generated REMOVE message and remove the specified domain
467 * mappings. Returns zero on success, negative values on failure.
470 static int netlbl_mgmt_remove(struct sk_buff *skb, struct genl_info *info)
473 struct netlbl_audit audit_info;
475 if (!info->attrs[NLBL_MGMT_A_DOMAIN])
478 netlbl_netlink_auditinfo(skb, &audit_info);
480 domain = nla_data(info->attrs[NLBL_MGMT_A_DOMAIN]);
481 return netlbl_domhsh_remove(domain, AF_UNSPEC, &audit_info);
485 * netlbl_mgmt_listall_cb - netlbl_domhsh_walk() callback for LISTALL
486 * @entry: the domain mapping hash table entry
487 * @arg: the netlbl_domhsh_walk_arg structure
490 * This function is designed to be used as a callback to the
491 * netlbl_domhsh_walk() function for use in generating a response for a LISTALL
492 * message. Returns the size of the message on success, negative values on
496 static int netlbl_mgmt_listall_cb(struct netlbl_dom_map *entry, void *arg)
498 int ret_val = -ENOMEM;
499 struct netlbl_domhsh_walk_arg *cb_arg = arg;
502 data = genlmsg_put(cb_arg->skb, NETLINK_CB(cb_arg->nl_cb->skb).portid,
503 cb_arg->seq, &netlbl_mgmt_gnl_family,
504 NLM_F_MULTI, NLBL_MGMT_C_LISTALL);
506 goto listall_cb_failure;
508 ret_val = netlbl_mgmt_listentry(cb_arg->skb, entry);
510 goto listall_cb_failure;
513 genlmsg_end(cb_arg->skb, data);
517 genlmsg_cancel(cb_arg->skb, data);
522 * netlbl_mgmt_listall - Handle a LISTALL message
523 * @skb: the NETLINK buffer
524 * @cb: the NETLINK callback
527 * Process a user generated LISTALL message and dumps the domain hash table in
528 * a form suitable for use in a kernel generated LISTALL message. Returns zero
529 * on success, negative values on failure.
532 static int netlbl_mgmt_listall(struct sk_buff *skb,
533 struct netlink_callback *cb)
535 struct netlbl_domhsh_walk_arg cb_arg;
536 u32 skip_bkt = cb->args[0];
537 u32 skip_chain = cb->args[1];
541 cb_arg.seq = cb->nlh->nlmsg_seq;
543 netlbl_domhsh_walk(&skip_bkt,
545 netlbl_mgmt_listall_cb,
548 cb->args[0] = skip_bkt;
549 cb->args[1] = skip_chain;
554 * netlbl_mgmt_adddef - Handle an ADDDEF message
555 * @skb: the NETLINK buffer
556 * @info: the Generic NETLINK info block
559 * Process a user generated ADDDEF message and respond accordingly. Returns
560 * zero on success, negative values on failure.
563 static int netlbl_mgmt_adddef(struct sk_buff *skb, struct genl_info *info)
565 struct netlbl_audit audit_info;
567 if ((!info->attrs[NLBL_MGMT_A_PROTOCOL]) ||
568 (info->attrs[NLBL_MGMT_A_IPV4ADDR] &&
569 info->attrs[NLBL_MGMT_A_IPV6ADDR]) ||
570 (info->attrs[NLBL_MGMT_A_IPV4MASK] &&
571 info->attrs[NLBL_MGMT_A_IPV6MASK]) ||
572 ((info->attrs[NLBL_MGMT_A_IPV4ADDR] != NULL) ^
573 (info->attrs[NLBL_MGMT_A_IPV4MASK] != NULL)) ||
574 ((info->attrs[NLBL_MGMT_A_IPV6ADDR] != NULL) ^
575 (info->attrs[NLBL_MGMT_A_IPV6MASK] != NULL)))
578 netlbl_netlink_auditinfo(skb, &audit_info);
580 return netlbl_mgmt_add_common(info, &audit_info);
584 * netlbl_mgmt_removedef - Handle a REMOVEDEF message
585 * @skb: the NETLINK buffer
586 * @info: the Generic NETLINK info block
589 * Process a user generated REMOVEDEF message and remove the default domain
590 * mapping. Returns zero on success, negative values on failure.
593 static int netlbl_mgmt_removedef(struct sk_buff *skb, struct genl_info *info)
595 struct netlbl_audit audit_info;
597 netlbl_netlink_auditinfo(skb, &audit_info);
599 return netlbl_domhsh_remove_default(AF_UNSPEC, &audit_info);
603 * netlbl_mgmt_listdef - Handle a LISTDEF message
604 * @skb: the NETLINK buffer
605 * @info: the Generic NETLINK info block
608 * Process a user generated LISTDEF message and dumps the default domain
609 * mapping in a form suitable for use in a kernel generated LISTDEF message.
610 * Returns zero on success, negative values on failure.
613 static int netlbl_mgmt_listdef(struct sk_buff *skb, struct genl_info *info)
615 int ret_val = -ENOMEM;
616 struct sk_buff *ans_skb = NULL;
618 struct netlbl_dom_map *entry;
621 if (info->attrs[NLBL_MGMT_A_FAMILY])
622 family = nla_get_u16(info->attrs[NLBL_MGMT_A_FAMILY]);
626 ans_skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
629 data = genlmsg_put_reply(ans_skb, info, &netlbl_mgmt_gnl_family,
630 0, NLBL_MGMT_C_LISTDEF);
632 goto listdef_failure;
635 entry = netlbl_domhsh_getentry(NULL, family);
638 goto listdef_failure_lock;
640 ret_val = netlbl_mgmt_listentry(ans_skb, entry);
643 goto listdef_failure;
645 genlmsg_end(ans_skb, data);
646 return genlmsg_reply(ans_skb, info);
648 listdef_failure_lock:
656 * netlbl_mgmt_protocols_cb - Write an individual PROTOCOL message response
657 * @skb: the skb to write to
658 * @cb: the NETLINK callback
659 * @protocol: the NetLabel protocol to use in the message
662 * This function is to be used in conjunction with netlbl_mgmt_protocols() to
663 * answer a application's PROTOCOLS message. Returns the size of the message
664 * on success, negative values on failure.
667 static int netlbl_mgmt_protocols_cb(struct sk_buff *skb,
668 struct netlink_callback *cb,
671 int ret_val = -ENOMEM;
674 data = genlmsg_put(skb, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq,
675 &netlbl_mgmt_gnl_family, NLM_F_MULTI,
676 NLBL_MGMT_C_PROTOCOLS);
678 goto protocols_cb_failure;
680 ret_val = nla_put_u32(skb, NLBL_MGMT_A_PROTOCOL, protocol);
682 goto protocols_cb_failure;
684 genlmsg_end(skb, data);
687 protocols_cb_failure:
688 genlmsg_cancel(skb, data);
693 * netlbl_mgmt_protocols - Handle a PROTOCOLS message
694 * @skb: the NETLINK buffer
695 * @cb: the NETLINK callback
698 * Process a user generated PROTOCOLS message and respond accordingly.
701 static int netlbl_mgmt_protocols(struct sk_buff *skb,
702 struct netlink_callback *cb)
704 u32 protos_sent = cb->args[0];
706 if (protos_sent == 0) {
707 if (netlbl_mgmt_protocols_cb(skb,
709 NETLBL_NLTYPE_UNLABELED) < 0)
710 goto protocols_return;
713 if (protos_sent == 1) {
714 if (netlbl_mgmt_protocols_cb(skb,
716 NETLBL_NLTYPE_CIPSOV4) < 0)
717 goto protocols_return;
720 #if IS_ENABLED(CONFIG_IPV6)
721 if (protos_sent == 2) {
722 if (netlbl_mgmt_protocols_cb(skb,
724 NETLBL_NLTYPE_CALIPSO) < 0)
725 goto protocols_return;
731 cb->args[0] = protos_sent;
736 * netlbl_mgmt_version - Handle a VERSION message
737 * @skb: the NETLINK buffer
738 * @info: the Generic NETLINK info block
741 * Process a user generated VERSION message and respond accordingly. Returns
742 * zero on success, negative values on failure.
745 static int netlbl_mgmt_version(struct sk_buff *skb, struct genl_info *info)
747 int ret_val = -ENOMEM;
748 struct sk_buff *ans_skb = NULL;
751 ans_skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
754 data = genlmsg_put_reply(ans_skb, info, &netlbl_mgmt_gnl_family,
755 0, NLBL_MGMT_C_VERSION);
757 goto version_failure;
759 ret_val = nla_put_u32(ans_skb,
761 NETLBL_PROTO_VERSION);
763 goto version_failure;
765 genlmsg_end(ans_skb, data);
766 return genlmsg_reply(ans_skb, info);
775 * NetLabel Generic NETLINK Command Definitions
778 static const struct genl_ops netlbl_mgmt_genl_ops[] = {
780 .cmd = NLBL_MGMT_C_ADD,
781 .flags = GENL_ADMIN_PERM,
782 .policy = netlbl_mgmt_genl_policy,
783 .doit = netlbl_mgmt_add,
787 .cmd = NLBL_MGMT_C_REMOVE,
788 .flags = GENL_ADMIN_PERM,
789 .policy = netlbl_mgmt_genl_policy,
790 .doit = netlbl_mgmt_remove,
794 .cmd = NLBL_MGMT_C_LISTALL,
796 .policy = netlbl_mgmt_genl_policy,
798 .dumpit = netlbl_mgmt_listall,
801 .cmd = NLBL_MGMT_C_ADDDEF,
802 .flags = GENL_ADMIN_PERM,
803 .policy = netlbl_mgmt_genl_policy,
804 .doit = netlbl_mgmt_adddef,
808 .cmd = NLBL_MGMT_C_REMOVEDEF,
809 .flags = GENL_ADMIN_PERM,
810 .policy = netlbl_mgmt_genl_policy,
811 .doit = netlbl_mgmt_removedef,
815 .cmd = NLBL_MGMT_C_LISTDEF,
817 .policy = netlbl_mgmt_genl_policy,
818 .doit = netlbl_mgmt_listdef,
822 .cmd = NLBL_MGMT_C_PROTOCOLS,
824 .policy = netlbl_mgmt_genl_policy,
826 .dumpit = netlbl_mgmt_protocols,
829 .cmd = NLBL_MGMT_C_VERSION,
831 .policy = netlbl_mgmt_genl_policy,
832 .doit = netlbl_mgmt_version,
838 * NetLabel Generic NETLINK Protocol Functions
842 * netlbl_mgmt_genl_init - Register the NetLabel management component
845 * Register the NetLabel management component with the Generic NETLINK
846 * mechanism. Returns zero on success, negative values on failure.
849 int __init netlbl_mgmt_genl_init(void)
851 return genl_register_family_with_ops(&netlbl_mgmt_gnl_family,
852 netlbl_mgmt_genl_ops);