Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
netlabel_domainhash.c File Reference
#include <linux/types.h>
#include <linux/rculist.h>
#include <linux/skbuff.h>
#include <linux/spinlock.h>
#include <linux/string.h>
#include <linux/audit.h>
#include <linux/slab.h>
#include <net/netlabel.h>
#include <net/cipso_ipv4.h>
#include <asm/bug.h>
#include "netlabel_mgmt.h"
#include "netlabel_addrlist.h"
#include "netlabel_domainhash.h"
#include "netlabel_user.h"

Go to the source code of this file.

Data Structures

struct  netlbl_domhsh_tbl
 

Macros

#define netlbl_domhsh_rcu_deref(p)   rcu_dereference_check(p, lockdep_is_held(&netlbl_domhsh_lock))
 

Functions

int __init netlbl_domhsh_init (u32 size)
 
int netlbl_domhsh_add (struct netlbl_dom_map *entry, struct netlbl_audit *audit_info)
 
int netlbl_domhsh_add_default (struct netlbl_dom_map *entry, struct netlbl_audit *audit_info)
 
int netlbl_domhsh_remove_entry (struct netlbl_dom_map *entry, struct netlbl_audit *audit_info)
 
int netlbl_domhsh_remove_af4 (const char *domain, const struct in_addr *addr, const struct in_addr *mask, struct netlbl_audit *audit_info)
 
int netlbl_domhsh_remove (const char *domain, struct netlbl_audit *audit_info)
 
int netlbl_domhsh_remove_default (struct netlbl_audit *audit_info)
 
struct netlbl_dom_mapnetlbl_domhsh_getentry (const char *domain)
 
struct netlbl_domaddr4_mapnetlbl_domhsh_getentry_af4 (const char *domain, __be32 addr)
 
int netlbl_domhsh_walk (u32 *skip_bkt, u32 *skip_chain, int(*callback)(struct netlbl_dom_map *entry, void *arg), void *cb_arg)
 

Macro Definition Documentation

#define netlbl_domhsh_rcu_deref (   p)    rcu_dereference_check(p, lockdep_is_held(&netlbl_domhsh_lock))

Definition at line 57 of file netlabel_domainhash.c.

Function Documentation

int netlbl_domhsh_add ( struct netlbl_dom_map entry,
struct netlbl_audit audit_info 
)

netlbl_domhsh_add - Adds a entry to the domain hash table : the entry to add : NetLabel audit information

Description: Adds a new entry to the domain hash table and handles any updates to the lower level protocol handler (i.e. CIPSO). Returns zero on success, negative on failure.

Definition at line 302 of file netlabel_domainhash.c.

int netlbl_domhsh_add_default ( struct netlbl_dom_map entry,
struct netlbl_audit audit_info 
)

netlbl_domhsh_add_default - Adds the default entry to the domain hash table : the entry to add : NetLabel audit information

Description: Adds a new default entry to the domain hash table and handles any updates to the lower level protocol handler (i.e. CIPSO). Returns zero on success, negative on failure.

Definition at line 421 of file netlabel_domainhash.c.

struct netlbl_dom_map* netlbl_domhsh_getentry ( const char domain)
read

netlbl_domhsh_getentry - Get an entry from the domain hash table : the domain name to search for

Description: Look through the domain hash table searching for an entry to match , return a pointer to a copy of the entry or NULL. The caller is responsible for ensuring that rcu_read_[un]lock() is called.

Definition at line 611 of file netlabel_domainhash.c.

struct netlbl_domaddr4_map* netlbl_domhsh_getentry_af4 ( const char domain,
__be32  addr 
)
read

netlbl_domhsh_getentry_af4 - Get an entry from the domain hash table : the domain name to search for : the IP address to search for

Description: Look through the domain hash table searching for an entry to match and , return a pointer to a copy of the entry or NULL. The caller is responsible for ensuring that rcu_read_[un]lock() is called.

Definition at line 627 of file netlabel_domainhash.c.

int __init netlbl_domhsh_init ( u32  size)

netlbl_domhsh_init - Init for the domain hash : the number of bits to use for the hash buckets

Description: Initializes the domain hash table, should be called only by netlbl_user_init() during initialization. Returns zero on success, non-zero values on error.

Definition at line 262 of file netlabel_domainhash.c.

int netlbl_domhsh_remove ( const char domain,
struct netlbl_audit audit_info 
)

netlbl_domhsh_remove - Removes an entry from the domain hash table : the domain to remove : NetLabel audit information

Description: Removes an entry from the domain hash table and handles any updates to the lower level protocol handler (i.e. CIPSO). Returns zero on success, negative on failure.

Definition at line 570 of file netlabel_domainhash.c.

int netlbl_domhsh_remove_af4 ( const char domain,
const struct in_addr addr,
const struct in_addr mask,
struct netlbl_audit audit_info 
)

netlbl_domhsh_remove_af4 - Removes an address selector entry : the domain : IPv4 address : IPv4 address mask : NetLabel audit information

Description: Removes an individual address selector from a domain mapping and potentially the entire mapping if it is empty. Returns zero on success, negative values on failure.

Definition at line 505 of file netlabel_domainhash.c.

int netlbl_domhsh_remove_default ( struct netlbl_audit audit_info)

netlbl_domhsh_remove_default - Removes the default entry from the table : NetLabel audit information

Description: Removes/resets the default entry for the domain hash table and handles any updates to the lower level protocol handler (i.e. CIPSO). Returns zero on success, non-zero on failure.

Definition at line 596 of file netlabel_domainhash.c.

int netlbl_domhsh_remove_entry ( struct netlbl_dom_map entry,
struct netlbl_audit audit_info 
)

netlbl_domhsh_remove_entry - Removes a given entry from the domain table : the entry to remove : NetLabel audit information

Description: Removes an entry from the domain hash table and handles any updates to the lower level protocol handler (i.e. CIPSO). Caller is responsible for ensuring that the RCU read lock is held. Returns zero on success, negative on failure.

Definition at line 439 of file netlabel_domainhash.c.

int netlbl_domhsh_walk ( u32 skip_bkt,
u32 skip_chain,
int(*)(struct netlbl_dom_map *entry, void *arg callback,
void cb_arg 
)

netlbl_domhsh_walk - Iterate through the domain mapping hash table : the number of buckets to skip at the start : the number of entries to skip in the first iterated bucket : callback for each entry : argument for the callback function

Description: Interate over the domain mapping hash table, skipping the first buckets and entries. For each entry in the table call , if returns a negative value stop 'walking' through the table and return. Updates the values in and on return. Returns zero on success, negative values on failure.

Definition at line 695 of file netlabel_domainhash.c.