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
387 * calipso_doi_add - Add a new DOI to the CALIPSO protocol engine
394 * ensure that the mapping table specified in @doi_def->map meets all of the
396 * zero on success and non-zero on failure.
402 int ret_val = -ENOMSG; in calipso_doi_add()
406 ret_val = ops->doi_add(doi_def, audit_info); in calipso_doi_add()
411 * calipso_doi_free - Frees a DOI definition
423 ops->doi_free(doi_def); in calipso_doi_free()
427 * calipso_doi_remove - Remove an existing DOI from the CALIPSO protocol engine
434 * domain list. Returns zero on success and negative values on failure.
439 int ret_val = -ENOMSG; in calipso_doi_remove()
443 ret_val = ops->doi_remove(doi, audit_info); in calipso_doi_remove()
448 * calipso_doi_getdef - Returns a reference to a valid DOI definition
463 ret_val = ops->doi_getdef(doi); in calipso_doi_getdef()
468 * calipso_doi_putdef - Releases a reference for the given DOI definition
480 ops->doi_putdef(doi_def); in calipso_doi_putdef()
484 * calipso_doi_walk - Iterate through the DOI definitions
491 * For each entry call @callback, if @callback returns a negative value stop
493 * return. Returns zero on success, negative values on failure.
500 int ret_val = -ENOMSG; in calipso_doi_walk()
504 ret_val = ops->doi_walk(skip_cnt, callback, cb_arg); in calipso_doi_walk()
509 * calipso_sock_getattr - Get the security attributes from a sock
517 * locking itself. Returns zero on success and negative values on failure.
522 int ret_val = -ENOMSG; in calipso_sock_getattr()
526 ret_val = ops->sock_getattr(sk, secattr); in calipso_sock_getattr()
531 * calipso_sock_setattr - Add a CALIPSO option to a socket
540 * process of being created or locked. Returns zero on success and negative
548 int ret_val = -ENOMSG; in calipso_sock_setattr()
552 ret_val = ops->sock_setattr(sk, doi_def, secattr); in calipso_sock_setattr()
557 * calipso_sock_delattr - Delete the CALIPSO option from a socket
569 ops->sock_delattr(sk); in calipso_sock_delattr()
573 * calipso_req_setattr - Add a CALIPSO option to a connection request socket
581 * negative values on failure.
588 int ret_val = -ENOMSG; in calipso_req_setattr()
592 ret_val = ops->req_setattr(req, doi_def, secattr); in calipso_req_setattr()
597 * calipso_req_delattr - Delete the CALIPSO option from a request socket
609 ops->req_delattr(req); in calipso_req_delattr()
613 * calipso_optptr - Find the CALIPSO option in the packet
627 ret_val = ops->skbuff_optptr(skb); in calipso_optptr()
632 * calipso_getattr - Get the security attributes from a memory block.
638 * Returns zero on success and negative values on failure.
644 int ret_val = -ENOMSG; in calipso_getattr()
648 ret_val = ops->opt_getattr(calipso, secattr); in calipso_getattr()
653 * calipso_skbuff_setattr - Set the CALIPSO option on a packet
667 int ret_val = -ENOMSG; in calipso_skbuff_setattr()
671 ret_val = ops->skbuff_setattr(skb, doi_def, secattr); in calipso_skbuff_setattr()
676 * calipso_skbuff_delattr - Delete any CALIPSO options from a packet
681 * success, negative values on failure.
686 int ret_val = -ENOMSG; in calipso_skbuff_delattr()
690 ret_val = ops->skbuff_delattr(skb); in calipso_skbuff_delattr()
695 * calipso_cache_invalidate - Invalidates the current CALIPSO cache
699 * success and negative values on failure.
707 ops->cache_invalidate(); in calipso_cache_invalidate()
711 * calipso_cache_add - Add an entry to the CALIPSO cache
717 * Returns zero on success, negative values on failure.
724 int ret_val = -ENOMSG; in calipso_cache_add()
728 ret_val = ops->cache_add(calipso_ptr, secattr); in calipso_cache_add()