// SPDX-License-Identifier: GPL-2.0-or-later /* * CALIPSO - Common Architecture Label IPv6 Security Option * * This is an implementation of the CALIPSO protocol as specified in * RFC 5570. * * Authors: Paul Moore <paul.moore@hp.com> * Huw Davies <huw@codeweavers.com>
*/
/* Maximum size of the calipso option including * the two-byte TLV header.
*/ #define CALIPSO_OPT_LEN_MAX (2 + 252)
/* Size of the minimum calipso option including * the two-byte TLV header.
*/ #define CALIPSO_HDR_LEN (2 + 8)
/* Maximum size of the calipso option including * the two-byte TLV header and upto 3 bytes of * leading pad and 7 bytes of trailing pad.
*/ #define CALIPSO_OPT_LEN_MAX_WITH_PAD (3 + CALIPSO_OPT_LEN_MAX + 7)
/* Maximum size of u32 aligned buffer required to hold calipso * option. Max of 3 initial pad bytes starting from buffer + 3. * i.e. the worst case is when the previous tlv finishes on 4n + 3.
*/ #define CALIPSO_MAX_BUFFER (6 + CALIPSO_OPT_LEN_MAX)
/* List of available DOI definitions */ static DEFINE_SPINLOCK(calipso_doi_list_lock); static LIST_HEAD(calipso_doi_list);
/** * calipso_cache_entry_free - Frees a cache entry * @entry: the entry to free * * Description: * This function frees the memory associated with a cache entry including the * LSM cache data if there are no longer any users, i.e. reference count == 0. *
*/ staticvoid calipso_cache_entry_free(struct calipso_map_cache_entry *entry)
{ if (entry->lsm_data)
netlbl_secattr_cache_free(entry->lsm_data);
kfree(entry->key);
kfree(entry);
}
/** * calipso_map_cache_hash - Hashing function for the CALIPSO cache * @key: the hash key * @key_len: the length of the key in bytes * * Description: * The CALIPSO tag hashing function. Returns a 32-bit hash value. *
*/ static u32 calipso_map_cache_hash(constunsignedchar *key, u32 key_len)
{ return jhash(key, key_len, 0);
}
/** * calipso_cache_init - Initialize the CALIPSO cache * * Description: * Initializes the CALIPSO label mapping cache, this function should be called * before any of the other functions defined in this file. Returns zero on * success, negative values on error. *
*/ staticint __init calipso_cache_init(void)
{
u32 iter;
calipso_cache = kcalloc(CALIPSO_CACHE_BUCKETS, sizeof(struct calipso_map_cache_bkt),
GFP_KERNEL); if (!calipso_cache) return -ENOMEM;
for (iter = 0; iter < CALIPSO_CACHE_BUCKETS; iter++) {
spin_lock_init(&calipso_cache[iter].lock);
calipso_cache[iter].size = 0;
INIT_LIST_HEAD(&calipso_cache[iter].list);
}
return 0;
}
/** * calipso_cache_invalidate - Invalidates the current CALIPSO cache * * Description: * Invalidates and frees any entries in the CALIPSO cache. Returns zero on * success and negative values on failure. *
*/ staticvoid calipso_cache_invalidate(void)
{ struct calipso_map_cache_entry *entry, *tmp_entry;
u32 iter;
/** * calipso_cache_check - Check the CALIPSO cache for a label mapping * @key: the buffer to check * @key_len: buffer length in bytes * @secattr: the security attribute struct to use * * Description: * This function checks the cache to see if a label mapping already exists for * the given key. If there is a match then the cache is adjusted and the * @secattr struct is populated with the correct LSM security attributes. The * cache is adjusted in the following manner if the entry is not already the * first in the cache bucket: * * 1. The cache entry's activity counter is incremented * 2. The previous (higher ranking) entry's activity counter is decremented * 3. If the difference between the two activity counters is geater than * CALIPSO_CACHE_REORDERLIMIT the two entries are swapped * * Returns zero on success, -ENOENT for a cache miss, and other negative values * on error. *
*/ staticint calipso_cache_check(constunsignedchar *key,
u32 key_len, struct netlbl_lsm_secattr *secattr)
{
u32 bkt; struct calipso_map_cache_entry *entry; struct calipso_map_cache_entry *prev_entry = NULL;
u32 hash;
/** * calipso_cache_add - Add an entry to the CALIPSO cache * @calipso_ptr: the CALIPSO option * @secattr: the packet's security attributes * * Description: * Add a new entry into the CALIPSO label mapping cache. Add the new entry to * head of the cache bucket's list, if the cache bucket is out of room remove * the last entry in the list first. It is important to note that there is * currently no checking for duplicate keys. Returns zero on success, * negative values on failure. The key stored starts at calipso_ptr + 2, * i.e. the type and length bytes are not stored, this corresponds to * calipso_ptr[1] bytes of data. *
*/ staticint calipso_cache_add(constunsignedchar *calipso_ptr, conststruct netlbl_lsm_secattr *secattr)
{ int ret_val = -EPERM;
u32 bkt; struct calipso_map_cache_entry *entry = NULL; struct calipso_map_cache_entry *old_entry = NULL;
u32 calipso_ptr_len;
if (!calipso_cache_enabled || calipso_cache_bucketsize <= 0) return 0;
cache_add_failure: if (entry)
calipso_cache_entry_free(entry); return ret_val;
}
/* DOI List Functions
*/
/** * calipso_doi_search - Searches for a DOI definition * @doi: the DOI to search for * * Description: * Search the DOI definition list for a DOI definition with a DOI value that * matches @doi. The caller is responsible for calling rcu_read_[un]lock(). * Returns a pointer to the DOI definition on success and NULL on failure.
*/ staticstruct calipso_doi *calipso_doi_search(u32 doi)
{ struct calipso_doi *iter;
list_for_each_entry_rcu(iter, &calipso_doi_list, list) if (iter->doi == doi && refcount_read(&iter->refcount)) return iter; return NULL;
}
/** * calipso_doi_add - Add a new DOI to the CALIPSO protocol engine * @doi_def: the DOI structure * @audit_info: NetLabel audit information * * Description: * The caller defines a new DOI for use by the CALIPSO engine and calls this * function to add it to the list of acceptable domains. The caller must * ensure that the mapping table specified in @doi_def->map meets all of the * requirements of the mapping type (see calipso.h for details). Returns * zero on success and non-zero on failure. *
*/ staticint calipso_doi_add(struct calipso_doi *doi_def, struct netlbl_audit *audit_info)
{ int ret_val = -EINVAL;
u32 doi;
u32 doi_type; struct audit_buffer *audit_buf;
doi = doi_def->doi;
doi_type = doi_def->type;
if (doi_def->doi == CALIPSO_DOI_UNKNOWN) goto doi_add_return;
/** * calipso_doi_free - Frees a DOI definition * @doi_def: the DOI definition * * Description: * This function frees all of the memory associated with a DOI definition. *
*/ staticvoid calipso_doi_free(struct calipso_doi *doi_def)
{
kfree(doi_def);
}
/** * calipso_doi_free_rcu - Frees a DOI definition via the RCU pointer * @entry: the entry's RCU field * * Description: * This function is designed to be used as a callback to the call_rcu() * function so that the memory allocated to the DOI definition can be released * safely. *
*/ staticvoid calipso_doi_free_rcu(struct rcu_head *entry)
{ struct calipso_doi *doi_def;
/** * calipso_doi_remove - Remove an existing DOI from the CALIPSO protocol engine * @doi: the DOI value * @audit_info: NetLabel audit information * * Description: * Removes a DOI definition from the CALIPSO engine. The NetLabel routines will * be called to release their own LSM domain mappings as well as our own * domain list. Returns zero on success and negative values on failure. *
*/ staticint calipso_doi_remove(u32 doi, struct netlbl_audit *audit_info)
{ int ret_val; struct calipso_doi *doi_def; struct audit_buffer *audit_buf;
/** * calipso_doi_getdef - Returns a reference to a valid DOI definition * @doi: the DOI value * * Description: * Searches for a valid DOI definition and if one is found it is returned to * the caller. Otherwise NULL is returned. The caller must ensure that * calipso_doi_putdef() is called when the caller is done. *
*/ staticstruct calipso_doi *calipso_doi_getdef(u32 doi)
{ struct calipso_doi *doi_def;
rcu_read_lock();
doi_def = calipso_doi_search(doi); if (!doi_def) goto doi_getdef_return; if (!refcount_inc_not_zero(&doi_def->refcount))
doi_def = NULL;
/** * calipso_doi_putdef - Releases a reference for the given DOI definition * @doi_def: the DOI definition * * Description: * Releases a DOI definition reference obtained from calipso_doi_getdef(). *
*/ staticvoid calipso_doi_putdef(struct calipso_doi *doi_def)
{ if (!doi_def) return;
if (!refcount_dec_and_test(&doi_def->refcount)) return;
/** * calipso_doi_walk - Iterate through the DOI definitions * @skip_cnt: skip past this number of DOI definitions, updated * @callback: callback for each DOI definition * @cb_arg: argument for the callback function * * Description: * Iterate over the DOI definition list, skipping the first @skip_cnt entries. * For each entry call @callback, if @callback returns a negative value stop * 'walking' through the list and return. Updates the value in @skip_cnt upon * return. Returns zero on success, negative values on failure. *
*/ staticint calipso_doi_walk(u32 *skip_cnt, int (*callback)(struct calipso_doi *doi_def, void *arg), void *cb_arg)
{ int ret_val = -ENOENT;
u32 doi_cnt = 0; struct calipso_doi *iter_doi;
rcu_read_lock();
list_for_each_entry_rcu(iter_doi, &calipso_doi_list, list) if (refcount_read(&iter_doi->refcount) > 0) { if (doi_cnt++ < *skip_cnt) continue;
ret_val = callback(iter_doi, cb_arg); if (ret_val < 0) {
doi_cnt--; goto doi_walk_return;
}
}
/** * calipso_validate - Validate a CALIPSO option * @skb: the packet * @option: the start of the option * * Description: * This routine is called to validate a CALIPSO option. * If the option is valid then %true is returned, otherwise * %false is returned. * * The caller should have already checked that the length of the * option (including the TLV header) is >= 10 and that the catmap * length is consistent with the option length. * * We leave checks on the level and categories to the socket layer.
*/ bool calipso_validate(conststruct sk_buff *skb, constunsignedchar *option)
{ struct calipso_doi *doi_def; bool ret_val;
u16 crc, len = option[1] + 2; staticconst u8 zero[2];
/* The original CRC runs over the option including the TLV header
* with the CRC-16 field (at offset 8) zeroed out. */
crc = crc_ccitt(0xffff, option, 8);
crc = crc_ccitt(crc, zero, sizeof(zero)); if (len > 10)
crc = crc_ccitt(crc, option + 10, len - 10);
crc = ~crc; if (option[8] != (crc & 0xff) || option[9] != ((crc >> 8) & 0xff)) returnfalse;
/** * calipso_map_cat_hton - Perform a category mapping from host to network * @doi_def: the DOI definition * @secattr: the security attributes * @net_cat: the zero'd out category bitmap in network/CALIPSO format * @net_cat_len: the length of the CALIPSO bitmap in bytes * * Description: * Perform a label mapping to translate a local MLS category bitmap to the * correct CALIPSO bitmap using the given DOI definition. Returns the minimum * size in bytes of the network bitmap on success, negative values otherwise. *
*/ staticint calipso_map_cat_hton(conststruct calipso_doi *doi_def, conststruct netlbl_lsm_secattr *secattr, unsignedchar *net_cat,
u32 net_cat_len)
{ int spot = -1;
u32 net_spot_max = 0;
u32 net_clen_bits = net_cat_len * 8;
for (;;) {
spot = netlbl_catmap_walk(secattr->attr.mls.cat,
spot + 1); if (spot < 0) break; if (spot >= net_clen_bits) return -ENOSPC;
netlbl_bitmap_setbit(net_cat, spot, 1);
if (spot > net_spot_max)
net_spot_max = spot;
}
return (net_spot_max / 32 + 1) * 4;
}
/** * calipso_map_cat_ntoh - Perform a category mapping from network to host * @doi_def: the DOI definition * @net_cat: the category bitmap in network/CALIPSO format * @net_cat_len: the length of the CALIPSO bitmap in bytes * @secattr: the security attributes * * Description: * Perform a label mapping to translate a CALIPSO bitmap to the correct local * MLS category bitmap using the given DOI definition. Returns zero on * success, negative values on failure. *
*/ staticint calipso_map_cat_ntoh(conststruct calipso_doi *doi_def, constunsignedchar *net_cat,
u32 net_cat_len, struct netlbl_lsm_secattr *secattr)
{ int ret_val; int spot = -1;
u32 net_clen_bits = net_cat_len * 8;
for (;;) {
spot = netlbl_bitmap_walk(net_cat,
net_clen_bits,
spot + 1,
1); if (spot < 0) return 0;
/** * calipso_pad_write - Writes pad bytes in TLV format * @buf: the buffer * @offset: offset from start of buffer to write padding * @count: number of pad bytes to write * * Description: * Write @count bytes of TLV padding into @buffer starting at offset @offset. * @count should be less than 8 - see RFC 4942. *
*/ staticint calipso_pad_write(unsignedchar *buf, unsignedint offset, unsignedint count)
{ if (WARN_ON_ONCE(count >= 8)) return -EINVAL;
/** * calipso_genopt - Generate a CALIPSO option * @buf: the option buffer * @start: offset from which to write * @buf_len: the size of opt_buf * @doi_def: the CALIPSO DOI to use * @secattr: the security attributes * * Description: * Generate a CALIPSO option using the DOI definition and security attributes * passed to the function. This also generates upto three bytes of leading * padding that ensures that the option is 4n + 2 aligned. It returns the * number of bytes written (including any initial padding).
*/ staticint calipso_genopt(unsignedchar *buf, u32 start, u32 buf_len, conststruct calipso_doi *doi_def, conststruct netlbl_lsm_secattr *secattr)
{ int ret_val;
u32 len, pad;
u16 crc; staticconstunsignedchar padding[4] = {2, 1, 0, 3}; unsignedchar *calipso;
/* CALIPSO has 4n + 2 alignment */
pad = padding[start & 3]; if (buf_len <= start + pad + CALIPSO_HDR_LEN) return -ENOSPC;
if ((secattr->flags & NETLBL_SECATTR_MLS_LVL) == 0) return -EPERM;
len = CALIPSO_HDR_LEN;
if (secattr->flags & NETLBL_SECATTR_MLS_CAT) {
ret_val = calipso_map_cat_hton(doi_def,
secattr,
buf + start + pad + len,
buf_len - start - pad - len); if (ret_val < 0) return ret_val;
len += ret_val;
}
/** * calipso_opt_update - Replaces socket's hop options with a new set * @sk: the socket * @hop: new hop options * * Description: * Replaces @sk's hop options with @hop. @hop may be NULL to leave * the socket with no hop options. *
*/ staticint calipso_opt_update(struct sock *sk, struct ipv6_opt_hdr *hop)
{ struct ipv6_txoptions *old = txopt_get(inet6_sk(sk)), *txopts;
/** * calipso_tlv_len - Returns the length of the TLV * @opt: the option header * @offset: offset of the TLV within the header * * Description: * Returns the length of the TLV option at offset @offset within * the option header @opt. Checks that the entire TLV fits inside * the option header, returns a negative value if this is not the case.
*/ staticint calipso_tlv_len(struct ipv6_opt_hdr *opt, unsignedint offset)
{ unsignedchar *tlv = (unsignedchar *)opt; unsignedint opt_len = ipv6_optlen(opt), tlv_len;
/** * calipso_opt_find - Finds the CALIPSO option in an IPv6 hop options header * @hop: the hop options header * @start: on return holds the offset of any leading padding * @end: on return holds the offset of the first non-pad TLV after CALIPSO * * Description: * Finds the space occupied by a CALIPSO option (including any leading and * trailing padding). * * If a CALIPSO option exists set @start and @end to the * offsets within @hop of the start of padding before the first * CALIPSO option and the end of padding after the first CALIPSO * option. In this case the function returns 0. * * In the absence of a CALIPSO option, @start and @end will be * set to the start and end of any trailing padding in the header. * This is useful when appending a new option, as the caller may want * to overwrite some of this padding. In this case the function will * return -ENOENT.
*/ staticint calipso_opt_find(struct ipv6_opt_hdr *hop, unsignedint *start, unsignedint *end)
{ int ret_val = -ENOENT, tlv_len; unsignedint opt_len, offset, offset_s = 0, offset_e = 0; unsignedchar *opt = (unsignedchar *)hop;
/** * calipso_opt_insert - Inserts a CALIPSO option into an IPv6 hop opt hdr * @hop: the original hop options header * @doi_def: the CALIPSO DOI to use * @secattr: the specific security attributes of the socket * * Description: * Creates a new hop options header based on @hop with a * CALIPSO option added to it. If @hop already contains a CALIPSO * option this is overwritten, otherwise the new option is appended * after any existing options. If @hop is NULL then the new header * will contain just the CALIPSO option and any needed padding. *
*/ staticstruct ipv6_opt_hdr *
calipso_opt_insert(struct ipv6_opt_hdr *hop, conststruct calipso_doi *doi_def, conststruct netlbl_lsm_secattr *secattr)
{ unsignedint start, end, buf_len, pad, hop_len; struct ipv6_opt_hdr *new; int ret_val;
/** * calipso_opt_del - Removes the CALIPSO option from an option header * @hop: the original header * @new: the new header * * Description: * Creates a new header based on @hop without any CALIPSO option. If @hop * doesn't contain a CALIPSO option it returns -ENOENT. If @hop contains * no other non-padding options, it returns zero with @new set to NULL. * Otherwise it returns zero, creates a new header without the CALIPSO * option (and removing as much padding as possible) and returns with * @new set to that header. *
*/ staticint calipso_opt_del(struct ipv6_opt_hdr *hop, struct ipv6_opt_hdr **new)
{ int ret_val; unsignedint start, end, delta, pad, hop_len;
ret_val = calipso_opt_find(hop, &start, &end); if (ret_val) return ret_val;
hop_len = ipv6_optlen(hop); if (start == sizeof(*hop) && end == hop_len) { /* There's no other option in the header so return NULL */
*new = NULL; return 0;
}
/** * calipso_opt_getattr - Get the security attributes from a memory block * @calipso: the CALIPSO option * @secattr: the security attributes * * Description: * Inspect @calipso and return the security attributes in @secattr. * Returns zero on success and negative values on failure. *
*/ staticint calipso_opt_getattr(constunsignedchar *calipso, struct netlbl_lsm_secattr *secattr)
{ int ret_val = -ENOMSG;
u32 doi, len = calipso[1], cat_len = calipso[6] * 4; struct calipso_doi *doi_def;
if (cat_len + 8 > len) return -EINVAL;
if (calipso_cache_check(calipso + 2, calipso[1], secattr) == 0) return 0;
doi = get_unaligned_be32(calipso + 2);
rcu_read_lock();
doi_def = calipso_doi_search(doi); if (!doi_def) goto getattr_return;
/** * calipso_sock_getattr - Get the security attributes from a sock * @sk: the sock * @secattr: the security attributes * * Description: * Query @sk to see if there is a CALIPSO option attached to the sock and if * there is return the CALIPSO security attributes in @secattr. This function * requires that @sk be locked, or privately held, but it does not do any * locking itself. Returns zero on success and negative values on failure. *
*/ staticint calipso_sock_getattr(struct sock *sk, struct netlbl_lsm_secattr *secattr)
{ struct ipv6_opt_hdr *hop; int opt_len, len, ret_val = -ENOMSG, offset; unsignedchar *opt; struct ipv6_pinfo *pinfo = inet6_sk(sk); struct ipv6_txoptions *txopts;
if (!pinfo) return -EAFNOSUPPORT;
txopts = txopt_get(pinfo); if (!txopts || !txopts->hopopt) goto done;
/** * calipso_sock_setattr - Add a CALIPSO option to a socket * @sk: the socket * @doi_def: the CALIPSO DOI to use * @secattr: the specific security attributes of the socket * * Description: * Set the CALIPSO option on the given socket using the DOI definition and * security attributes passed to the function. This function requires * exclusive access to @sk, which means it either needs to be in the * process of being created or locked. Returns zero on success and negative * values on failure. *
*/ staticint calipso_sock_setattr(struct sock *sk, conststruct calipso_doi *doi_def, conststruct netlbl_lsm_secattr *secattr)
{ int ret_val; struct ipv6_opt_hdr *old, *new; struct ipv6_pinfo *pinfo = inet6_sk(sk); struct ipv6_txoptions *txopts;
if (!pinfo) return -EAFNOSUPPORT;
txopts = txopt_get(pinfo);
old = NULL; if (txopts)
old = txopts->hopopt;
new = calipso_opt_insert(old, doi_def, secattr);
txopt_put(txopts); if (IS_ERR(new)) return PTR_ERR(new);
ret_val = calipso_opt_update(sk, new);
kfree(new); return ret_val;
}
/** * calipso_sock_delattr - Delete the CALIPSO option from a socket * @sk: the socket * * Description: * Removes the CALIPSO option from a socket, if present. *
*/ staticvoid calipso_sock_delattr(struct sock *sk)
{ struct ipv6_opt_hdr *new_hop; struct ipv6_pinfo *pinfo = inet6_sk(sk); struct ipv6_txoptions *txopts;
if (!pinfo) return;
txopts = txopt_get(pinfo); if (!txopts || !txopts->hopopt) goto done;
if (calipso_opt_del(txopts->hopopt, &new_hop)) goto done;
calipso_opt_update(sk, new_hop);
kfree(new_hop);
done:
txopt_put(txopts);
}
/* request sock functions.
*/
/** * calipso_req_setattr - Add a CALIPSO option to a connection request socket * @req: the connection request socket * @doi_def: the CALIPSO DOI to use * @secattr: the specific security attributes of the socket * * Description: * Set the CALIPSO option on the given socket using the DOI definition and * security attributes passed to the function. Returns zero on success and * negative values on failure. *
*/ staticint calipso_req_setattr(struct request_sock *req, conststruct calipso_doi *doi_def, conststruct netlbl_lsm_secattr *secattr)
{ struct ipv6_txoptions *txopts; struct inet_request_sock *req_inet = inet_rsk(req); struct ipv6_opt_hdr *old, *new; struct sock *sk = sk_to_full_sk(req_to_sk(req));
/* sk is NULL for SYN+ACK w/ SYN Cookie */ if (!sk) return -ENOMEM;
if (req_inet->ipv6_opt && req_inet->ipv6_opt->hopopt)
old = req_inet->ipv6_opt->hopopt; else
old = NULL;
new = calipso_opt_insert(old, doi_def, secattr); if (IS_ERR(new)) return PTR_ERR(new);
if (!IS_ERR(txopts)) {
txopts = xchg(&req_inet->ipv6_opt, txopts); if (txopts) {
atomic_sub(txopts->tot_len, &sk->sk_omem_alloc);
txopt_put(txopts);
}
}
kfree(new);
}
/* skbuff functions.
*/
/** * calipso_skbuff_optptr - Find the CALIPSO option in the packet * @skb: the packet * * Description: * Parse the packet's IP header looking for a CALIPSO option. Returns a pointer * to the start of the CALIPSO option on success, NULL if one if not found. *
*/ staticunsignedchar *calipso_skbuff_optptr(conststruct sk_buff *skb)
{ conststruct ipv6hdr *ip6_hdr = ipv6_hdr(skb); int offset;
/** * calipso_skbuff_setattr - Set the CALIPSO option on a packet * @skb: the packet * @doi_def: the CALIPSO DOI to use * @secattr: the security attributes * * Description: * Set the CALIPSO option on the given packet based on the security attributes. * Returns a pointer to the IP header on success and NULL on failure. *
*/ staticint calipso_skbuff_setattr(struct sk_buff *skb, conststruct calipso_doi *doi_def, conststruct netlbl_lsm_secattr *secattr)
{ int ret_val; struct ipv6hdr *ip6_hdr; struct ipv6_opt_hdr *hop; unsignedchar buf[CALIPSO_MAX_BUFFER]; int len_delta, new_end, pad, payload; unsignedint start, end;
ip6_hdr = ipv6_hdr(skb); if (ip6_hdr->nexthdr == NEXTHDR_HOP) {
hop = (struct ipv6_opt_hdr *)(ip6_hdr + 1);
ret_val = calipso_opt_find(hop, &start, &end); if (ret_val && ret_val != -ENOENT) return ret_val;
} else {
start = 0;
end = 0;
}
/** * calipso_skbuff_delattr - Delete any CALIPSO options from a packet * @skb: the packet * * Description: * Removes any and all CALIPSO options from the given packet. Returns zero on * success, negative values on failure. *
*/ staticint calipso_skbuff_delattr(struct sk_buff *skb)
{ int ret_val; struct ipv6hdr *ip6_hdr; struct ipv6_opt_hdr *old_hop;
u32 old_hop_len, start = 0, end = 0, delta, size, pad;
if (!calipso_skbuff_optptr(skb)) return 0;
/* since we are changing the packet we should make a copy */
ret_val = skb_cow(skb, skb_headroom(skb)); if (ret_val < 0) return ret_val;
/** * calipso_init - Initialize the CALIPSO module * * Description: * Initialize the CALIPSO module and prepare it for use. Returns zero on * success and negative values on failure. *
*/ int __init calipso_init(void)
{ int ret_val;
ret_val = calipso_cache_init(); if (!ret_val)
netlbl_calipso_ops_register(&ops); return ret_val;
}
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.9Bemerkung:
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.