2 * NetLabel CIPSO/IPv4 Support
4 * This file defines the CIPSO/IPv4 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
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>
34 #include <linux/audit.h>
35 #include <linux/slab.h>
37 #include <net/netlink.h>
38 #include <net/genetlink.h>
39 #include <net/netlabel.h>
40 #include <net/cipso_ipv4.h>
41 #include <linux/atomic.h>
43 #include "netlabel_user.h"
44 #include "netlabel_cipso_v4.h"
45 #include "netlabel_mgmt.h"
46 #include "netlabel_domainhash.h"
48 /* Argument struct for cipso_v4_doi_walk() */
49 struct netlbl_cipsov4_doiwalk_arg {
50 struct netlink_callback *nl_cb;
55 /* Argument struct for netlbl_domhsh_walk() */
56 struct netlbl_domhsh_walk_arg {
57 struct netlbl_audit *audit_info;
61 /* NetLabel Generic NETLINK CIPSOv4 family */
62 static struct genl_family netlbl_cipsov4_gnl_family;
63 /* NetLabel Netlink attribute policy */
64 static const struct nla_policy netlbl_cipsov4_genl_policy[NLBL_CIPSOV4_A_MAX + 1] = {
65 [NLBL_CIPSOV4_A_DOI] = { .type = NLA_U32 },
66 [NLBL_CIPSOV4_A_MTYPE] = { .type = NLA_U32 },
67 [NLBL_CIPSOV4_A_TAG] = { .type = NLA_U8 },
68 [NLBL_CIPSOV4_A_TAGLST] = { .type = NLA_NESTED },
69 [NLBL_CIPSOV4_A_MLSLVLLOC] = { .type = NLA_U32 },
70 [NLBL_CIPSOV4_A_MLSLVLREM] = { .type = NLA_U32 },
71 [NLBL_CIPSOV4_A_MLSLVL] = { .type = NLA_NESTED },
72 [NLBL_CIPSOV4_A_MLSLVLLST] = { .type = NLA_NESTED },
73 [NLBL_CIPSOV4_A_MLSCATLOC] = { .type = NLA_U32 },
74 [NLBL_CIPSOV4_A_MLSCATREM] = { .type = NLA_U32 },
75 [NLBL_CIPSOV4_A_MLSCAT] = { .type = NLA_NESTED },
76 [NLBL_CIPSOV4_A_MLSCATLST] = { .type = NLA_NESTED },
84 * netlbl_cipsov4_add_common - Parse the common sections of a ADD message
85 * @info: the Generic NETLINK info block
86 * @doi_def: the CIPSO V4 DOI definition
89 * Parse the common sections of a ADD message and fill in the related values
90 * in @doi_def. Returns zero on success, negative values on failure.
93 static int netlbl_cipsov4_add_common(struct genl_info *info,
94 struct cipso_v4_doi *doi_def)
100 doi_def->doi = nla_get_u32(info->attrs[NLBL_CIPSOV4_A_DOI]);
102 if (nla_validate_nested(info->attrs[NLBL_CIPSOV4_A_TAGLST],
104 netlbl_cipsov4_genl_policy, NULL) != 0)
107 nla_for_each_nested(nla, info->attrs[NLBL_CIPSOV4_A_TAGLST], nla_rem)
108 if (nla_type(nla) == NLBL_CIPSOV4_A_TAG) {
109 if (iter >= CIPSO_V4_TAG_MAXCNT)
111 doi_def->tags[iter++] = nla_get_u8(nla);
113 while (iter < CIPSO_V4_TAG_MAXCNT)
114 doi_def->tags[iter++] = CIPSO_V4_TAG_INVALID;
120 * NetLabel Command Handlers
124 * netlbl_cipsov4_add_std - Adds a CIPSO V4 DOI definition
125 * @info: the Generic NETLINK info block
126 * @audit_info: NetLabel audit information
129 * Create a new CIPSO_V4_MAP_TRANS DOI definition based on the given ADD
130 * message and add it to the CIPSO V4 engine. Return zero on success and
134 static int netlbl_cipsov4_add_std(struct genl_info *info,
135 struct netlbl_audit *audit_info)
137 int ret_val = -EINVAL;
138 struct cipso_v4_doi *doi_def = NULL;
139 struct nlattr *nla_a;
140 struct nlattr *nla_b;
145 if (!info->attrs[NLBL_CIPSOV4_A_TAGLST] ||
146 !info->attrs[NLBL_CIPSOV4_A_MLSLVLLST])
149 if (nla_validate_nested(info->attrs[NLBL_CIPSOV4_A_MLSLVLLST],
151 netlbl_cipsov4_genl_policy, NULL) != 0)
154 doi_def = kmalloc(sizeof(*doi_def), GFP_KERNEL);
157 doi_def->map.std = kzalloc(sizeof(*doi_def->map.std), GFP_KERNEL);
158 if (doi_def->map.std == NULL) {
162 doi_def->type = CIPSO_V4_MAP_TRANS;
164 ret_val = netlbl_cipsov4_add_common(info, doi_def);
166 goto add_std_failure;
169 nla_for_each_nested(nla_a,
170 info->attrs[NLBL_CIPSOV4_A_MLSLVLLST],
172 if (nla_type(nla_a) == NLBL_CIPSOV4_A_MLSLVL) {
173 if (nla_validate_nested(nla_a, NLBL_CIPSOV4_A_MAX,
174 netlbl_cipsov4_genl_policy,
176 goto add_std_failure;
177 nla_for_each_nested(nla_b, nla_a, nla_b_rem)
178 switch (nla_type(nla_b)) {
179 case NLBL_CIPSOV4_A_MLSLVLLOC:
180 if (nla_get_u32(nla_b) >
181 CIPSO_V4_MAX_LOC_LVLS)
182 goto add_std_failure;
183 if (nla_get_u32(nla_b) >=
184 doi_def->map.std->lvl.local_size)
185 doi_def->map.std->lvl.local_size =
186 nla_get_u32(nla_b) + 1;
188 case NLBL_CIPSOV4_A_MLSLVLREM:
189 if (nla_get_u32(nla_b) >
190 CIPSO_V4_MAX_REM_LVLS)
191 goto add_std_failure;
192 if (nla_get_u32(nla_b) >=
193 doi_def->map.std->lvl.cipso_size)
194 doi_def->map.std->lvl.cipso_size =
195 nla_get_u32(nla_b) + 1;
199 doi_def->map.std->lvl.local = kcalloc(doi_def->map.std->lvl.local_size,
201 GFP_KERNEL | __GFP_NOWARN);
202 if (doi_def->map.std->lvl.local == NULL) {
204 goto add_std_failure;
206 doi_def->map.std->lvl.cipso = kcalloc(doi_def->map.std->lvl.cipso_size,
208 GFP_KERNEL | __GFP_NOWARN);
209 if (doi_def->map.std->lvl.cipso == NULL) {
211 goto add_std_failure;
213 for (iter = 0; iter < doi_def->map.std->lvl.local_size; iter++)
214 doi_def->map.std->lvl.local[iter] = CIPSO_V4_INV_LVL;
215 for (iter = 0; iter < doi_def->map.std->lvl.cipso_size; iter++)
216 doi_def->map.std->lvl.cipso[iter] = CIPSO_V4_INV_LVL;
217 nla_for_each_nested(nla_a,
218 info->attrs[NLBL_CIPSOV4_A_MLSLVLLST],
220 if (nla_type(nla_a) == NLBL_CIPSOV4_A_MLSLVL) {
221 struct nlattr *lvl_loc;
222 struct nlattr *lvl_rem;
224 lvl_loc = nla_find_nested(nla_a,
225 NLBL_CIPSOV4_A_MLSLVLLOC);
226 lvl_rem = nla_find_nested(nla_a,
227 NLBL_CIPSOV4_A_MLSLVLREM);
228 if (lvl_loc == NULL || lvl_rem == NULL)
229 goto add_std_failure;
230 doi_def->map.std->lvl.local[nla_get_u32(lvl_loc)] =
231 nla_get_u32(lvl_rem);
232 doi_def->map.std->lvl.cipso[nla_get_u32(lvl_rem)] =
233 nla_get_u32(lvl_loc);
236 if (info->attrs[NLBL_CIPSOV4_A_MLSCATLST]) {
237 if (nla_validate_nested(info->attrs[NLBL_CIPSOV4_A_MLSCATLST],
239 netlbl_cipsov4_genl_policy, NULL) != 0)
240 goto add_std_failure;
242 nla_for_each_nested(nla_a,
243 info->attrs[NLBL_CIPSOV4_A_MLSCATLST],
245 if (nla_type(nla_a) == NLBL_CIPSOV4_A_MLSCAT) {
246 if (nla_validate_nested(nla_a,
248 netlbl_cipsov4_genl_policy,
250 goto add_std_failure;
251 nla_for_each_nested(nla_b, nla_a, nla_b_rem)
252 switch (nla_type(nla_b)) {
253 case NLBL_CIPSOV4_A_MLSCATLOC:
254 if (nla_get_u32(nla_b) >
255 CIPSO_V4_MAX_LOC_CATS)
256 goto add_std_failure;
257 if (nla_get_u32(nla_b) >=
258 doi_def->map.std->cat.local_size)
259 doi_def->map.std->cat.local_size =
260 nla_get_u32(nla_b) + 1;
262 case NLBL_CIPSOV4_A_MLSCATREM:
263 if (nla_get_u32(nla_b) >
264 CIPSO_V4_MAX_REM_CATS)
265 goto add_std_failure;
266 if (nla_get_u32(nla_b) >=
267 doi_def->map.std->cat.cipso_size)
268 doi_def->map.std->cat.cipso_size =
269 nla_get_u32(nla_b) + 1;
273 doi_def->map.std->cat.local = kcalloc(
274 doi_def->map.std->cat.local_size,
276 GFP_KERNEL | __GFP_NOWARN);
277 if (doi_def->map.std->cat.local == NULL) {
279 goto add_std_failure;
281 doi_def->map.std->cat.cipso = kcalloc(
282 doi_def->map.std->cat.cipso_size,
284 GFP_KERNEL | __GFP_NOWARN);
285 if (doi_def->map.std->cat.cipso == NULL) {
287 goto add_std_failure;
289 for (iter = 0; iter < doi_def->map.std->cat.local_size; iter++)
290 doi_def->map.std->cat.local[iter] = CIPSO_V4_INV_CAT;
291 for (iter = 0; iter < doi_def->map.std->cat.cipso_size; iter++)
292 doi_def->map.std->cat.cipso[iter] = CIPSO_V4_INV_CAT;
293 nla_for_each_nested(nla_a,
294 info->attrs[NLBL_CIPSOV4_A_MLSCATLST],
296 if (nla_type(nla_a) == NLBL_CIPSOV4_A_MLSCAT) {
297 struct nlattr *cat_loc;
298 struct nlattr *cat_rem;
300 cat_loc = nla_find_nested(nla_a,
301 NLBL_CIPSOV4_A_MLSCATLOC);
302 cat_rem = nla_find_nested(nla_a,
303 NLBL_CIPSOV4_A_MLSCATREM);
304 if (cat_loc == NULL || cat_rem == NULL)
305 goto add_std_failure;
306 doi_def->map.std->cat.local[
307 nla_get_u32(cat_loc)] =
308 nla_get_u32(cat_rem);
309 doi_def->map.std->cat.cipso[
310 nla_get_u32(cat_rem)] =
311 nla_get_u32(cat_loc);
315 ret_val = cipso_v4_doi_add(doi_def, audit_info);
317 goto add_std_failure;
321 cipso_v4_doi_free(doi_def);
326 * netlbl_cipsov4_add_pass - Adds a CIPSO V4 DOI definition
327 * @info: the Generic NETLINK info block
328 * @audit_info: NetLabel audit information
331 * Create a new CIPSO_V4_MAP_PASS DOI definition based on the given ADD message
332 * and add it to the CIPSO V4 engine. Return zero on success and non-zero on
336 static int netlbl_cipsov4_add_pass(struct genl_info *info,
337 struct netlbl_audit *audit_info)
340 struct cipso_v4_doi *doi_def = NULL;
342 if (!info->attrs[NLBL_CIPSOV4_A_TAGLST])
345 doi_def = kmalloc(sizeof(*doi_def), GFP_KERNEL);
348 doi_def->type = CIPSO_V4_MAP_PASS;
350 ret_val = netlbl_cipsov4_add_common(info, doi_def);
352 goto add_pass_failure;
354 ret_val = cipso_v4_doi_add(doi_def, audit_info);
356 goto add_pass_failure;
360 cipso_v4_doi_free(doi_def);
365 * netlbl_cipsov4_add_local - Adds a CIPSO V4 DOI definition
366 * @info: the Generic NETLINK info block
367 * @audit_info: NetLabel audit information
370 * Create a new CIPSO_V4_MAP_LOCAL DOI definition based on the given ADD
371 * message and add it to the CIPSO V4 engine. Return zero on success and
375 static int netlbl_cipsov4_add_local(struct genl_info *info,
376 struct netlbl_audit *audit_info)
379 struct cipso_v4_doi *doi_def = NULL;
381 if (!info->attrs[NLBL_CIPSOV4_A_TAGLST])
384 doi_def = kmalloc(sizeof(*doi_def), GFP_KERNEL);
387 doi_def->type = CIPSO_V4_MAP_LOCAL;
389 ret_val = netlbl_cipsov4_add_common(info, doi_def);
391 goto add_local_failure;
393 ret_val = cipso_v4_doi_add(doi_def, audit_info);
395 goto add_local_failure;
399 cipso_v4_doi_free(doi_def);
404 * netlbl_cipsov4_add - Handle an ADD message
405 * @skb: the NETLINK buffer
406 * @info: the Generic NETLINK info block
409 * Create a new DOI definition based on the given ADD message and add it to the
410 * CIPSO V4 engine. Returns zero on success, negative values on failure.
413 static int netlbl_cipsov4_add(struct sk_buff *skb, struct genl_info *info)
416 int ret_val = -EINVAL;
417 struct netlbl_audit audit_info;
419 if (!info->attrs[NLBL_CIPSOV4_A_DOI] ||
420 !info->attrs[NLBL_CIPSOV4_A_MTYPE])
423 netlbl_netlink_auditinfo(skb, &audit_info);
424 switch (nla_get_u32(info->attrs[NLBL_CIPSOV4_A_MTYPE])) {
425 case CIPSO_V4_MAP_TRANS:
426 ret_val = netlbl_cipsov4_add_std(info, &audit_info);
428 case CIPSO_V4_MAP_PASS:
429 ret_val = netlbl_cipsov4_add_pass(info, &audit_info);
431 case CIPSO_V4_MAP_LOCAL:
432 ret_val = netlbl_cipsov4_add_local(info, &audit_info);
436 atomic_inc(&netlabel_mgmt_protocount);
442 * netlbl_cipsov4_list - Handle a LIST message
443 * @skb: the NETLINK buffer
444 * @info: the Generic NETLINK info block
447 * Process a user generated LIST message and respond accordingly. While the
448 * response message generated by the kernel is straightforward, determining
449 * before hand the size of the buffer to allocate is not (we have to generate
450 * the message to know the size). In order to keep this function sane what we
451 * do is allocate a buffer of NLMSG_GOODSIZE and try to fit the response in
452 * that size, if we fail then we restart with a larger buffer and try again.
453 * We continue in this manner until we hit a limit of failed attempts then we
454 * give up and just send an error message. Returns zero on success and
455 * negative values on error.
458 static int netlbl_cipsov4_list(struct sk_buff *skb, struct genl_info *info)
461 struct sk_buff *ans_skb = NULL;
465 struct nlattr *nla_a;
466 struct nlattr *nla_b;
467 struct cipso_v4_doi *doi_def;
470 if (!info->attrs[NLBL_CIPSOV4_A_DOI]) {
476 ans_skb = nlmsg_new(NLMSG_DEFAULT_SIZE * nlsze_mult, GFP_KERNEL);
477 if (ans_skb == NULL) {
481 data = genlmsg_put_reply(ans_skb, info, &netlbl_cipsov4_gnl_family,
482 0, NLBL_CIPSOV4_C_LIST);
488 doi = nla_get_u32(info->attrs[NLBL_CIPSOV4_A_DOI]);
491 doi_def = cipso_v4_doi_getdef(doi);
492 if (doi_def == NULL) {
494 goto list_failure_lock;
497 ret_val = nla_put_u32(ans_skb, NLBL_CIPSOV4_A_MTYPE, doi_def->type);
499 goto list_failure_lock;
501 nla_a = nla_nest_start(ans_skb, NLBL_CIPSOV4_A_TAGLST);
504 goto list_failure_lock;
507 iter < CIPSO_V4_TAG_MAXCNT &&
508 doi_def->tags[iter] != CIPSO_V4_TAG_INVALID;
510 ret_val = nla_put_u8(ans_skb,
512 doi_def->tags[iter]);
514 goto list_failure_lock;
516 nla_nest_end(ans_skb, nla_a);
518 switch (doi_def->type) {
519 case CIPSO_V4_MAP_TRANS:
520 nla_a = nla_nest_start(ans_skb, NLBL_CIPSOV4_A_MLSLVLLST);
523 goto list_failure_lock;
526 iter < doi_def->map.std->lvl.local_size;
528 if (doi_def->map.std->lvl.local[iter] ==
532 nla_b = nla_nest_start(ans_skb, NLBL_CIPSOV4_A_MLSLVL);
537 ret_val = nla_put_u32(ans_skb,
538 NLBL_CIPSOV4_A_MLSLVLLOC,
542 ret_val = nla_put_u32(ans_skb,
543 NLBL_CIPSOV4_A_MLSLVLREM,
544 doi_def->map.std->lvl.local[iter]);
547 nla_nest_end(ans_skb, nla_b);
549 nla_nest_end(ans_skb, nla_a);
551 nla_a = nla_nest_start(ans_skb, NLBL_CIPSOV4_A_MLSCATLST);
557 iter < doi_def->map.std->cat.local_size;
559 if (doi_def->map.std->cat.local[iter] ==
563 nla_b = nla_nest_start(ans_skb, NLBL_CIPSOV4_A_MLSCAT);
568 ret_val = nla_put_u32(ans_skb,
569 NLBL_CIPSOV4_A_MLSCATLOC,
573 ret_val = nla_put_u32(ans_skb,
574 NLBL_CIPSOV4_A_MLSCATREM,
575 doi_def->map.std->cat.local[iter]);
578 nla_nest_end(ans_skb, nla_b);
580 nla_nest_end(ans_skb, nla_a);
584 cipso_v4_doi_putdef(doi_def);
587 genlmsg_end(ans_skb, data);
588 return genlmsg_reply(ans_skb, info);
591 /* XXX - this limit is a guesstimate */
592 if (nlsze_mult < 4) {
593 cipso_v4_doi_putdef(doi_def);
600 cipso_v4_doi_putdef(doi_def);
608 * netlbl_cipsov4_listall_cb - cipso_v4_doi_walk() callback for LISTALL
609 * @doi_def: the CIPSOv4 DOI definition
610 * @arg: the netlbl_cipsov4_doiwalk_arg structure
613 * This function is designed to be used as a callback to the
614 * cipso_v4_doi_walk() function for use in generating a response for a LISTALL
615 * message. Returns the size of the message on success, negative values on
619 static int netlbl_cipsov4_listall_cb(struct cipso_v4_doi *doi_def, void *arg)
621 int ret_val = -ENOMEM;
622 struct netlbl_cipsov4_doiwalk_arg *cb_arg = arg;
625 data = genlmsg_put(cb_arg->skb, NETLINK_CB(cb_arg->nl_cb->skb).portid,
626 cb_arg->seq, &netlbl_cipsov4_gnl_family,
627 NLM_F_MULTI, NLBL_CIPSOV4_C_LISTALL);
629 goto listall_cb_failure;
631 ret_val = nla_put_u32(cb_arg->skb, NLBL_CIPSOV4_A_DOI, doi_def->doi);
633 goto listall_cb_failure;
634 ret_val = nla_put_u32(cb_arg->skb,
635 NLBL_CIPSOV4_A_MTYPE,
638 goto listall_cb_failure;
640 genlmsg_end(cb_arg->skb, data);
644 genlmsg_cancel(cb_arg->skb, data);
649 * netlbl_cipsov4_listall - Handle a LISTALL message
650 * @skb: the NETLINK buffer
651 * @cb: the NETLINK callback
654 * Process a user generated LISTALL message and respond accordingly. Returns
655 * zero on success and negative values on error.
658 static int netlbl_cipsov4_listall(struct sk_buff *skb,
659 struct netlink_callback *cb)
661 struct netlbl_cipsov4_doiwalk_arg cb_arg;
662 u32 doi_skip = cb->args[0];
666 cb_arg.seq = cb->nlh->nlmsg_seq;
668 cipso_v4_doi_walk(&doi_skip, netlbl_cipsov4_listall_cb, &cb_arg);
670 cb->args[0] = doi_skip;
675 * netlbl_cipsov4_remove_cb - netlbl_cipsov4_remove() callback for REMOVE
676 * @entry: LSM domain mapping entry
677 * @arg: the netlbl_domhsh_walk_arg structure
680 * This function is intended for use by netlbl_cipsov4_remove() as the callback
681 * for the netlbl_domhsh_walk() function; it removes LSM domain map entries
682 * which are associated with the CIPSO DOI specified in @arg. Returns zero on
683 * success, negative values on failure.
686 static int netlbl_cipsov4_remove_cb(struct netlbl_dom_map *entry, void *arg)
688 struct netlbl_domhsh_walk_arg *cb_arg = arg;
690 if (entry->def.type == NETLBL_NLTYPE_CIPSOV4 &&
691 entry->def.cipso->doi == cb_arg->doi)
692 return netlbl_domhsh_remove_entry(entry, cb_arg->audit_info);
698 * netlbl_cipsov4_remove - Handle a REMOVE message
699 * @skb: the NETLINK buffer
700 * @info: the Generic NETLINK info block
703 * Process a user generated REMOVE message and respond accordingly. Returns
704 * zero on success, negative values on failure.
707 static int netlbl_cipsov4_remove(struct sk_buff *skb, struct genl_info *info)
709 int ret_val = -EINVAL;
710 struct netlbl_domhsh_walk_arg cb_arg;
711 struct netlbl_audit audit_info;
715 if (!info->attrs[NLBL_CIPSOV4_A_DOI])
718 netlbl_netlink_auditinfo(skb, &audit_info);
719 cb_arg.doi = nla_get_u32(info->attrs[NLBL_CIPSOV4_A_DOI]);
720 cb_arg.audit_info = &audit_info;
721 ret_val = netlbl_domhsh_walk(&skip_bkt, &skip_chain,
722 netlbl_cipsov4_remove_cb, &cb_arg);
723 if (ret_val == 0 || ret_val == -ENOENT) {
724 ret_val = cipso_v4_doi_remove(cb_arg.doi, &audit_info);
726 atomic_dec(&netlabel_mgmt_protocount);
733 * NetLabel Generic NETLINK Command Definitions
736 static const struct genl_ops netlbl_cipsov4_ops[] = {
738 .cmd = NLBL_CIPSOV4_C_ADD,
739 .flags = GENL_ADMIN_PERM,
740 .policy = netlbl_cipsov4_genl_policy,
741 .doit = netlbl_cipsov4_add,
745 .cmd = NLBL_CIPSOV4_C_REMOVE,
746 .flags = GENL_ADMIN_PERM,
747 .policy = netlbl_cipsov4_genl_policy,
748 .doit = netlbl_cipsov4_remove,
752 .cmd = NLBL_CIPSOV4_C_LIST,
754 .policy = netlbl_cipsov4_genl_policy,
755 .doit = netlbl_cipsov4_list,
759 .cmd = NLBL_CIPSOV4_C_LISTALL,
761 .policy = netlbl_cipsov4_genl_policy,
763 .dumpit = netlbl_cipsov4_listall,
767 static struct genl_family netlbl_cipsov4_gnl_family __ro_after_init = {
769 .name = NETLBL_NLTYPE_CIPSOV4_NAME,
770 .version = NETLBL_PROTO_VERSION,
771 .maxattr = NLBL_CIPSOV4_A_MAX,
772 .module = THIS_MODULE,
773 .ops = netlbl_cipsov4_ops,
774 .n_ops = ARRAY_SIZE(netlbl_cipsov4_ops),
778 * NetLabel Generic NETLINK Protocol Functions
782 * netlbl_cipsov4_genl_init - Register the CIPSOv4 NetLabel component
785 * Register the CIPSOv4 packet NetLabel component with the Generic NETLINK
786 * mechanism. Returns zero on success, negative values on failure.
789 int __init netlbl_cipsov4_genl_init(void)
791 return genl_register_family(&netlbl_cipsov4_gnl_family);