Lines Matching +full:non +full:- +full:negative
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_add_pass - Adds a CALIPSO pass DOI definition
66 * and add it to the CALIPSO engine. Return zero on success and non-zero on
78 return -ENOMEM; in netlbl_calipso_add_pass()
79 doi_def->type = CALIPSO_MAP_PASS; in netlbl_calipso_add_pass()
80 doi_def->doi = nla_get_u32(info->attrs[NLBL_CALIPSO_A_DOI]); in netlbl_calipso_add_pass()
89 * netlbl_calipso_add - Handle an ADD message
95 * CALIPSO engine. Returns zero on success, negative values on failure.
101 int ret_val = -EINVAL; in netlbl_calipso_add()
104 if (!info->attrs[NLBL_CALIPSO_A_DOI] || in netlbl_calipso_add()
105 !info->attrs[NLBL_CALIPSO_A_MTYPE]) in netlbl_calipso_add()
106 return -EINVAL; in netlbl_calipso_add()
109 switch (nla_get_u32(info->attrs[NLBL_CALIPSO_A_MTYPE])) { in netlbl_calipso_add()
121 * netlbl_calipso_list - Handle a LIST message
127 * Returns zero on success and negative values on error.
138 if (!info->attrs[NLBL_CALIPSO_A_DOI]) { in netlbl_calipso_list()
139 ret_val = -EINVAL; in netlbl_calipso_list()
143 doi = nla_get_u32(info->attrs[NLBL_CALIPSO_A_DOI]); in netlbl_calipso_list()
147 ret_val = -EINVAL; in netlbl_calipso_list()
153 ret_val = -ENOMEM; in netlbl_calipso_list()
159 ret_val = -ENOMEM; in netlbl_calipso_list()
163 ret_val = nla_put_u32(ans_skb, NLBL_CALIPSO_A_MTYPE, doi_def->type); in netlbl_calipso_list()
180 * netlbl_calipso_listall_cb - calipso_doi_walk() callback for LISTALL
187 * message. Returns the size of the message on success, negative values on
193 int ret_val = -ENOMEM; in netlbl_calipso_listall_cb()
197 data = genlmsg_put(cb_arg->skb, NETLINK_CB(cb_arg->nl_cb->skb).portid, in netlbl_calipso_listall_cb()
198 cb_arg->seq, &netlbl_calipso_gnl_family, in netlbl_calipso_listall_cb()
203 ret_val = nla_put_u32(cb_arg->skb, NLBL_CALIPSO_A_DOI, doi_def->doi); in netlbl_calipso_listall_cb()
206 ret_val = nla_put_u32(cb_arg->skb, in netlbl_calipso_listall_cb()
208 doi_def->type); in netlbl_calipso_listall_cb()
212 genlmsg_end(cb_arg->skb, data); in netlbl_calipso_listall_cb()
216 genlmsg_cancel(cb_arg->skb, data); in netlbl_calipso_listall_cb()
221 * netlbl_calipso_listall - Handle a LISTALL message
227 * zero on success and negative values on error.
234 u32 doi_skip = cb->args[0]; in netlbl_calipso_listall()
238 cb_arg.seq = cb->nlh->nlmsg_seq; in netlbl_calipso_listall()
242 cb->args[0] = doi_skip; in netlbl_calipso_listall()
243 return skb->len; in netlbl_calipso_listall()
247 * netlbl_calipso_remove_cb - netlbl_calipso_remove() callback for REMOVE
255 * success, negative values on failure.
262 if (entry->def.type == NETLBL_NLTYPE_CALIPSO && in netlbl_calipso_remove_cb()
263 entry->def.calipso->doi == cb_arg->doi) in netlbl_calipso_remove_cb()
264 return netlbl_domhsh_remove_entry(entry, cb_arg->audit_info); in netlbl_calipso_remove_cb()
270 * netlbl_calipso_remove - Handle a REMOVE message
276 * zero on success, negative values on failure.
281 int ret_val = -EINVAL; in netlbl_calipso_remove()
287 if (!info->attrs[NLBL_CALIPSO_A_DOI]) in netlbl_calipso_remove()
288 return -EINVAL; in netlbl_calipso_remove()
291 cb_arg.doi = nla_get_u32(info->attrs[NLBL_CALIPSO_A_DOI]); in netlbl_calipso_remove()
295 if (ret_val == 0 || ret_val == -ENOENT) { in netlbl_calipso_remove()
353 * netlbl_calipso_genl_init - Register the CALIPSO NetLabel component
357 * mechanism. Returns zero on success, negative values on failure.
368 * netlbl_calipso_ops_register - Register the CALIPSO operations
388 * calipso_doi_add - Add a new DOI to the CALIPSO protocol engine
395 * ensure that the mapping table specified in @doi_def->map meets all of the
397 * zero on success and non-zero on failure.
403 int ret_val = -ENOMSG; in calipso_doi_add()
407 ret_val = ops->doi_add(doi_def, audit_info); in calipso_doi_add()
412 * calipso_doi_free - Frees a DOI definition
424 ops->doi_free(doi_def); in calipso_doi_free()
428 * calipso_doi_remove - Remove an existing DOI from the CALIPSO protocol engine
435 * domain list. Returns zero on success and negative values on failure.
440 int ret_val = -ENOMSG; in calipso_doi_remove()
444 ret_val = ops->doi_remove(doi, audit_info); in calipso_doi_remove()
449 * calipso_doi_getdef - Returns a reference to a valid DOI definition
464 ret_val = ops->doi_getdef(doi); in calipso_doi_getdef()
469 * calipso_doi_putdef - Releases a reference for the given DOI definition
481 ops->doi_putdef(doi_def); in calipso_doi_putdef()
485 * calipso_doi_walk - Iterate through the DOI definitions
492 * For each entry call @callback, if @callback returns a negative value stop
494 * return. Returns zero on success, negative values on failure.
501 int ret_val = -ENOMSG; in calipso_doi_walk()
505 ret_val = ops->doi_walk(skip_cnt, callback, cb_arg); in calipso_doi_walk()
510 * calipso_sock_getattr - Get the security attributes from a sock
518 * locking itself. Returns zero on success and negative values on failure.
523 int ret_val = -ENOMSG; in calipso_sock_getattr()
527 ret_val = ops->sock_getattr(sk, secattr); in calipso_sock_getattr()
532 * calipso_sock_setattr - Add a CALIPSO option to a socket
541 * process of being created or locked. Returns zero on success and negative
549 int ret_val = -ENOMSG; in calipso_sock_setattr()
553 ret_val = ops->sock_setattr(sk, doi_def, secattr); in calipso_sock_setattr()
558 * calipso_sock_delattr - Delete the CALIPSO option from a socket
570 ops->sock_delattr(sk); in calipso_sock_delattr()
574 * calipso_req_setattr - Add a CALIPSO option to a connection request socket
582 * negative values on failure.
589 int ret_val = -ENOMSG; in calipso_req_setattr()
593 ret_val = ops->req_setattr(req, doi_def, secattr); in calipso_req_setattr()
598 * calipso_req_delattr - Delete the CALIPSO option from a request socket
610 ops->req_delattr(req); in calipso_req_delattr()
614 * calipso_optptr - Find the CALIPSO option in the packet
628 ret_val = ops->skbuff_optptr(skb); in calipso_optptr()
633 * calipso_getattr - Get the security attributes from a memory block.
639 * Returns zero on success and negative values on failure.
645 int ret_val = -ENOMSG; in calipso_getattr()
649 ret_val = ops->opt_getattr(calipso, secattr); in calipso_getattr()
654 * calipso_skbuff_setattr - Set the CALIPSO option on a packet
668 int ret_val = -ENOMSG; in calipso_skbuff_setattr()
672 ret_val = ops->skbuff_setattr(skb, doi_def, secattr); in calipso_skbuff_setattr()
677 * calipso_skbuff_delattr - Delete any CALIPSO options from a packet
682 * success, negative values on failure.
687 int ret_val = -ENOMSG; in calipso_skbuff_delattr()
691 ret_val = ops->skbuff_delattr(skb); in calipso_skbuff_delattr()
696 * calipso_cache_invalidate - Invalidates the current CALIPSO cache
700 * success and negative values on failure.
708 ops->cache_invalidate(); in calipso_cache_invalidate()
712 * calipso_cache_add - Add an entry to the CALIPSO cache
718 * Returns zero on success, negative values on failure.
725 int ret_val = -ENOMSG; in calipso_cache_add()
729 ret_val = ops->cache_add(calipso_ptr, secattr); in calipso_cache_add()