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()
354 * netlbl_calipso_genl_init - Register the CALIPSO NetLabel component
358 * mechanism. Returns zero on success, negative values on failure.
369 * netlbl_calipso_ops_register - Register the CALIPSO operations
389 * calipso_doi_add - Add a new DOI to the CALIPSO protocol engine
396 * ensure that the mapping table specified in @doi_def->map meets all of the
398 * zero on success and non-zero on failure.
404 int ret_val = -ENOMSG; in calipso_doi_add()
408 ret_val = ops->doi_add(doi_def, audit_info); in calipso_doi_add()
413 * calipso_doi_free - Frees a DOI definition
425 ops->doi_free(doi_def); in calipso_doi_free()
429 * calipso_doi_remove - Remove an existing DOI from the CALIPSO protocol engine
436 * domain list. Returns zero on success and negative values on failure.
441 int ret_val = -ENOMSG; in calipso_doi_remove()
445 ret_val = ops->doi_remove(doi, audit_info); in calipso_doi_remove()
450 * calipso_doi_getdef - Returns a reference to a valid DOI definition
465 ret_val = ops->doi_getdef(doi); in calipso_doi_getdef()
470 * calipso_doi_putdef - Releases a reference for the given DOI definition
482 ops->doi_putdef(doi_def); in calipso_doi_putdef()
486 * calipso_doi_walk - Iterate through the DOI definitions
493 * For each entry call @callback, if @callback returns a negative value stop
495 * return. Returns zero on success, negative values on failure.
502 int ret_val = -ENOMSG; in calipso_doi_walk()
506 ret_val = ops->doi_walk(skip_cnt, callback, cb_arg); in calipso_doi_walk()
511 * calipso_sock_getattr - Get the security attributes from a sock
519 * locking itself. Returns zero on success and negative values on failure.
524 int ret_val = -ENOMSG; in calipso_sock_getattr()
528 ret_val = ops->sock_getattr(sk, secattr); in calipso_sock_getattr()
533 * calipso_sock_setattr - Add a CALIPSO option to a socket
542 * process of being created or locked. Returns zero on success and negative
550 int ret_val = -ENOMSG; in calipso_sock_setattr()
554 ret_val = ops->sock_setattr(sk, doi_def, secattr); in calipso_sock_setattr()
559 * calipso_sock_delattr - Delete the CALIPSO option from a socket
571 ops->sock_delattr(sk); in calipso_sock_delattr()
575 * calipso_req_setattr - Add a CALIPSO option to a connection request socket
583 * negative values on failure.
590 int ret_val = -ENOMSG; in calipso_req_setattr()
594 ret_val = ops->req_setattr(req, doi_def, secattr); in calipso_req_setattr()
599 * calipso_req_delattr - Delete the CALIPSO option from a request socket
611 ops->req_delattr(req); in calipso_req_delattr()
615 * calipso_optptr - Find the CALIPSO option in the packet
629 ret_val = ops->skbuff_optptr(skb); in calipso_optptr()
634 * calipso_getattr - Get the security attributes from a memory block.
640 * Returns zero on success and negative values on failure.
646 int ret_val = -ENOMSG; in calipso_getattr()
650 ret_val = ops->opt_getattr(calipso, secattr); in calipso_getattr()
655 * calipso_skbuff_setattr - Set the CALIPSO option on a packet
669 int ret_val = -ENOMSG; in calipso_skbuff_setattr()
673 ret_val = ops->skbuff_setattr(skb, doi_def, secattr); in calipso_skbuff_setattr()
678 * calipso_skbuff_delattr - Delete any CALIPSO options from a packet
683 * success, negative values on failure.
688 int ret_val = -ENOMSG; in calipso_skbuff_delattr()
692 ret_val = ops->skbuff_delattr(skb); in calipso_skbuff_delattr()
697 * calipso_cache_invalidate - Invalidates the current CALIPSO cache
701 * success and negative values on failure.
709 ops->cache_invalidate(); in calipso_cache_invalidate()
713 * calipso_cache_add - Add an entry to the CALIPSO cache
719 * Returns zero on success, negative values on failure.
726 int ret_val = -ENOMSG; in calipso_cache_add()
730 ret_val = ops->cache_add(calipso_ptr, secattr); in calipso_cache_add()