Lines Matching +full:zero +full:- +full:based
1 // SPDX-License-Identifier: GPL-2.0-or-later
9 * Authors: Paul Moore <paul@paul-moore.com>
13 /* (c) Copyright Hewlett-Packard Development Company, L.P., 2006
60 * netlbl_calipso_ops_register - Register the CALIPSO operations
82 * netlbl_calipso_add_pass - Adds a CALIPSO pass DOI definition
87 * Create a new CALIPSO_MAP_PASS DOI definition based on the given ADD message
88 * and add it to the CALIPSO engine. Return zero on success and non-zero on
100 return -ENOMEM; in netlbl_calipso_add_pass()
101 doi_def->type = CALIPSO_MAP_PASS; in netlbl_calipso_add_pass()
102 doi_def->doi = nla_get_u32(info->attrs[NLBL_CALIPSO_A_DOI]); in netlbl_calipso_add_pass()
111 * netlbl_calipso_add - Handle an ADD message
116 * Create a new DOI definition based on the given ADD message and add it to the
117 * CALIPSO engine. Returns zero on success, negative values on failure.
122 int ret_val = -EINVAL; in netlbl_calipso_add()
126 if (!info->attrs[NLBL_CALIPSO_A_DOI] || in netlbl_calipso_add()
127 !info->attrs[NLBL_CALIPSO_A_MTYPE]) in netlbl_calipso_add()
128 return -EINVAL; in netlbl_calipso_add()
131 return -EOPNOTSUPP; in netlbl_calipso_add()
134 switch (nla_get_u32(info->attrs[NLBL_CALIPSO_A_MTYPE])) { in netlbl_calipso_add()
146 * netlbl_calipso_list - Handle a LIST message
152 * Returns zero on success and negative values on error.
163 if (!info->attrs[NLBL_CALIPSO_A_DOI]) { in netlbl_calipso_list()
164 ret_val = -EINVAL; in netlbl_calipso_list()
168 doi = nla_get_u32(info->attrs[NLBL_CALIPSO_A_DOI]); in netlbl_calipso_list()
172 ret_val = -EINVAL; in netlbl_calipso_list()
178 ret_val = -ENOMEM; in netlbl_calipso_list()
184 ret_val = -ENOMEM; in netlbl_calipso_list()
188 ret_val = nla_put_u32(ans_skb, NLBL_CALIPSO_A_MTYPE, doi_def->type); in netlbl_calipso_list()
205 * netlbl_calipso_listall_cb - calipso_doi_walk() callback for LISTALL
218 int ret_val = -ENOMEM; in netlbl_calipso_listall_cb()
222 data = genlmsg_put(cb_arg->skb, NETLINK_CB(cb_arg->nl_cb->skb).portid, in netlbl_calipso_listall_cb()
223 cb_arg->seq, &netlbl_calipso_gnl_family, in netlbl_calipso_listall_cb()
228 ret_val = nla_put_u32(cb_arg->skb, NLBL_CALIPSO_A_DOI, doi_def->doi); in netlbl_calipso_listall_cb()
231 ret_val = nla_put_u32(cb_arg->skb, in netlbl_calipso_listall_cb()
233 doi_def->type); in netlbl_calipso_listall_cb()
237 genlmsg_end(cb_arg->skb, data); in netlbl_calipso_listall_cb()
241 genlmsg_cancel(cb_arg->skb, data); in netlbl_calipso_listall_cb()
246 * netlbl_calipso_listall - Handle a LISTALL message
252 * zero on success and negative values on error.
259 u32 doi_skip = cb->args[0]; in netlbl_calipso_listall()
263 cb_arg.seq = cb->nlh->nlmsg_seq; in netlbl_calipso_listall()
267 cb->args[0] = doi_skip; in netlbl_calipso_listall()
268 return skb->len; in netlbl_calipso_listall()
272 * netlbl_calipso_remove_cb - netlbl_calipso_remove() callback for REMOVE
279 * which are associated with the CALIPSO DOI specified in @arg. Returns zero on
287 if (entry->def.type == NETLBL_NLTYPE_CALIPSO && in netlbl_calipso_remove_cb()
288 entry->def.calipso->doi == cb_arg->doi) in netlbl_calipso_remove_cb()
289 return netlbl_domhsh_remove_entry(entry, cb_arg->audit_info); in netlbl_calipso_remove_cb()
295 * netlbl_calipso_remove - Handle a REMOVE message
301 * zero on success, negative values on failure.
306 int ret_val = -EINVAL; in netlbl_calipso_remove()
312 if (!info->attrs[NLBL_CALIPSO_A_DOI]) in netlbl_calipso_remove()
313 return -EINVAL; in netlbl_calipso_remove()
316 cb_arg.doi = nla_get_u32(info->attrs[NLBL_CALIPSO_A_DOI]); in netlbl_calipso_remove()
320 if (ret_val == 0 || ret_val == -ENOENT) { in netlbl_calipso_remove()
379 * netlbl_calipso_genl_init - Register the CALIPSO NetLabel component
383 * mechanism. Returns zero on success, negative values on failure.
392 * calipso_doi_add - Add a new DOI to the CALIPSO protocol engine
399 * ensure that the mapping table specified in @doi_def->map meets all of the
401 * zero on success and non-zero on failure.
407 int ret_val = -ENOMSG; in calipso_doi_add()
411 ret_val = ops->doi_add(doi_def, audit_info); in calipso_doi_add()
416 * calipso_doi_free - Frees a DOI definition
428 ops->doi_free(doi_def); in calipso_doi_free()
432 * calipso_doi_remove - Remove an existing DOI from the CALIPSO protocol engine
439 * domain list. Returns zero on success and negative values on failure.
444 int ret_val = -ENOMSG; in calipso_doi_remove()
448 ret_val = ops->doi_remove(doi, audit_info); in calipso_doi_remove()
453 * calipso_doi_getdef - Returns a reference to a valid DOI definition
468 ret_val = ops->doi_getdef(doi); in calipso_doi_getdef()
473 * calipso_doi_putdef - Releases a reference for the given DOI definition
485 ops->doi_putdef(doi_def); in calipso_doi_putdef()
489 * calipso_doi_walk - Iterate through the DOI definitions
498 * return. Returns zero on success, negative values on failure.
505 int ret_val = -ENOMSG; in calipso_doi_walk()
509 ret_val = ops->doi_walk(skip_cnt, callback, cb_arg); in calipso_doi_walk()
514 * calipso_sock_getattr - Get the security attributes from a sock
522 * locking itself. Returns zero on success and negative values on failure.
527 int ret_val = -ENOMSG; in calipso_sock_getattr()
531 ret_val = ops->sock_getattr(sk, secattr); in calipso_sock_getattr()
536 * calipso_sock_setattr - Add a CALIPSO option to a socket
545 * process of being created or locked. Returns zero on success and negative
553 int ret_val = -ENOMSG; in calipso_sock_setattr()
557 ret_val = ops->sock_setattr(sk, doi_def, secattr); in calipso_sock_setattr()
562 * calipso_sock_delattr - Delete the CALIPSO option from a socket
574 ops->sock_delattr(sk); in calipso_sock_delattr()
578 * calipso_req_setattr - Add a CALIPSO option to a connection request socket
585 * security attributes passed to the function. Returns zero on success and
593 int ret_val = -ENOMSG; in calipso_req_setattr()
597 ret_val = ops->req_setattr(req, doi_def, secattr); in calipso_req_setattr()
602 * calipso_req_delattr - Delete the CALIPSO option from a request socket
614 ops->req_delattr(req); in calipso_req_delattr()
618 * calipso_optptr - Find the CALIPSO option in the packet
632 ret_val = ops->skbuff_optptr(skb); in calipso_optptr()
637 * calipso_getattr - Get the security attributes from a memory block.
643 * Returns zero on success and negative values on failure.
649 int ret_val = -ENOMSG; in calipso_getattr()
653 ret_val = ops->opt_getattr(calipso, secattr); in calipso_getattr()
658 * calipso_skbuff_setattr - Set the CALIPSO option on a packet
664 * Set the CALIPSO option on the given packet based on the security attributes.
672 int ret_val = -ENOMSG; in calipso_skbuff_setattr()
676 ret_val = ops->skbuff_setattr(skb, doi_def, secattr); in calipso_skbuff_setattr()
681 * calipso_skbuff_delattr - Delete any CALIPSO options from a packet
685 * Removes any and all CALIPSO options from the given packet. Returns zero on
691 int ret_val = -ENOMSG; in calipso_skbuff_delattr()
695 ret_val = ops->skbuff_delattr(skb); in calipso_skbuff_delattr()
700 * calipso_cache_invalidate - Invalidates the current CALIPSO cache
703 * Invalidates and frees any entries in the CALIPSO cache. Returns zero on
712 ops->cache_invalidate(); in calipso_cache_invalidate()
716 * calipso_cache_add - Add an entry to the CALIPSO cache
722 * Returns zero on success, negative values on failure.
729 int ret_val = -ENOMSG; in calipso_cache_add()
733 ret_val = ops->cache_add(calipso_ptr, secattr); in calipso_cache_add()