Linux Audio

Check our new training course

Loading...
v6.13.7
  1/* SPDX-License-Identifier: GPL-2.0-or-later */
  2/*
  3 * NetLabel Domain Hash Table
  4 *
  5 * This file manages the domain hash table that NetLabel uses to determine
  6 * which network labeling protocol to use for a given domain.  The NetLabel
  7 * system manages static and dynamic label mappings for network protocols such
  8 * as CIPSO and RIPSO.
  9 *
 10 * Author: Paul Moore <paul@paul-moore.com>
 
 11 */
 12
 13/*
 14 * (c) Copyright Hewlett-Packard Development Company, L.P., 2006, 2008
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 15 */
 16
 17#ifndef _NETLABEL_DOMAINHASH_H
 18#define _NETLABEL_DOMAINHASH_H
 19
 20#include <linux/types.h>
 21#include <linux/rcupdate.h>
 22#include <linux/list.h>
 23
 24#include "netlabel_addrlist.h"
 25
 26/* Domain hash table size */
 27/* XXX - currently this number is an uneducated guess */
 28#define NETLBL_DOMHSH_BITSIZE       7
 29
 30/* Domain mapping definition structures */
 31struct netlbl_domaddr_map {
 32	struct list_head list4;
 33	struct list_head list6;
 34};
 35struct netlbl_dommap_def {
 36	u32 type;
 37	union {
 38		struct netlbl_domaddr_map *addrsel;
 39		struct cipso_v4_doi *cipso;
 40		struct calipso_doi *calipso;
 41	};
 42};
 43#define netlbl_domhsh_addr4_entry(iter) \
 44	container_of(iter, struct netlbl_domaddr4_map, list)
 45struct netlbl_domaddr4_map {
 46	struct netlbl_dommap_def def;
 47
 48	struct netlbl_af4list list;
 49};
 50#define netlbl_domhsh_addr6_entry(iter) \
 51	container_of(iter, struct netlbl_domaddr6_map, list)
 52struct netlbl_domaddr6_map {
 53	struct netlbl_dommap_def def;
 54
 55	struct netlbl_af6list list;
 56};
 57
 58struct netlbl_dom_map {
 59	char *domain;
 60	struct netlbl_dommap_def def;
 61	u16 family;
 62
 63	u32 valid;
 64	struct list_head list;
 65	struct rcu_head rcu;
 66};
 67
 68/* init function */
 69int netlbl_domhsh_init(u32 size);
 70
 71/* Manipulate the domain hash table */
 72int netlbl_domhsh_add(struct netlbl_dom_map *entry,
 73		      struct netlbl_audit *audit_info);
 74int netlbl_domhsh_add_default(struct netlbl_dom_map *entry,
 75			      struct netlbl_audit *audit_info);
 76int netlbl_domhsh_remove_entry(struct netlbl_dom_map *entry,
 77			       struct netlbl_audit *audit_info);
 78int netlbl_domhsh_remove_af4(const char *domain,
 79			     const struct in_addr *addr,
 80			     const struct in_addr *mask,
 81			     struct netlbl_audit *audit_info);
 82int netlbl_domhsh_remove_af6(const char *domain,
 83			     const struct in6_addr *addr,
 84			     const struct in6_addr *mask,
 85			     struct netlbl_audit *audit_info);
 86int netlbl_domhsh_remove(const char *domain, u16 family,
 87			 struct netlbl_audit *audit_info);
 88int netlbl_domhsh_remove_default(u16 family, struct netlbl_audit *audit_info);
 89struct netlbl_dom_map *netlbl_domhsh_getentry(const char *domain, u16 family);
 90struct netlbl_dommap_def *netlbl_domhsh_getentry_af4(const char *domain,
 91						     __be32 addr);
 92#if IS_ENABLED(CONFIG_IPV6)
 93struct netlbl_dommap_def *netlbl_domhsh_getentry_af6(const char *domain,
 94						   const struct in6_addr *addr);
 95int netlbl_domhsh_remove_af6(const char *domain,
 96			     const struct in6_addr *addr,
 97			     const struct in6_addr *mask,
 98			     struct netlbl_audit *audit_info);
 99#endif /* IPv6 */
100
101int netlbl_domhsh_walk(u32 *skip_bkt,
102		     u32 *skip_chain,
103		     int (*callback) (struct netlbl_dom_map *entry, void *arg),
104		     void *cb_arg);
105
106#endif
v3.15
 
  1/*
  2 * NetLabel Domain Hash Table
  3 *
  4 * This file manages the domain hash table that NetLabel uses to determine
  5 * which network labeling protocol to use for a given domain.  The NetLabel
  6 * system manages static and dynamic label mappings for network protocols such
  7 * as CIPSO and RIPSO.
  8 *
  9 * Author: Paul Moore <paul@paul-moore.com>
 10 *
 11 */
 12
 13/*
 14 * (c) Copyright Hewlett-Packard Development Company, L.P., 2006, 2008
 15 *
 16 * This program is free software;  you can redistribute it and/or modify
 17 * it under the terms of the GNU General Public License as published by
 18 * the Free Software Foundation; either version 2 of the License, or
 19 * (at your option) any later version.
 20 *
 21 * This program is distributed in the hope that it will be useful,
 22 * but WITHOUT ANY WARRANTY;  without even the implied warranty of
 23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
 24 * the GNU General Public License for more details.
 25 *
 26 * You should have received a copy of the GNU General Public License
 27 * along with this program;  if not, see <http://www.gnu.org/licenses/>.
 28 *
 29 */
 30
 31#ifndef _NETLABEL_DOMAINHASH_H
 32#define _NETLABEL_DOMAINHASH_H
 33
 34#include <linux/types.h>
 35#include <linux/rcupdate.h>
 36#include <linux/list.h>
 37
 38#include "netlabel_addrlist.h"
 39
 40/* Domain hash table size */
 41/* XXX - currently this number is an uneducated guess */
 42#define NETLBL_DOMHSH_BITSIZE       7
 43
 44/* Domain mapping definition structures */
 45struct netlbl_domaddr_map {
 46	struct list_head list4;
 47	struct list_head list6;
 48};
 49struct netlbl_dommap_def {
 50	u32 type;
 51	union {
 52		struct netlbl_domaddr_map *addrsel;
 53		struct cipso_v4_doi *cipso;
 
 54	};
 55};
 56#define netlbl_domhsh_addr4_entry(iter) \
 57	container_of(iter, struct netlbl_domaddr4_map, list)
 58struct netlbl_domaddr4_map {
 59	struct netlbl_dommap_def def;
 60
 61	struct netlbl_af4list list;
 62};
 63#define netlbl_domhsh_addr6_entry(iter) \
 64	container_of(iter, struct netlbl_domaddr6_map, list)
 65struct netlbl_domaddr6_map {
 66	struct netlbl_dommap_def def;
 67
 68	struct netlbl_af6list list;
 69};
 70
 71struct netlbl_dom_map {
 72	char *domain;
 73	struct netlbl_dommap_def def;
 
 74
 75	u32 valid;
 76	struct list_head list;
 77	struct rcu_head rcu;
 78};
 79
 80/* init function */
 81int netlbl_domhsh_init(u32 size);
 82
 83/* Manipulate the domain hash table */
 84int netlbl_domhsh_add(struct netlbl_dom_map *entry,
 85		      struct netlbl_audit *audit_info);
 86int netlbl_domhsh_add_default(struct netlbl_dom_map *entry,
 87			      struct netlbl_audit *audit_info);
 88int netlbl_domhsh_remove_entry(struct netlbl_dom_map *entry,
 89			       struct netlbl_audit *audit_info);
 90int netlbl_domhsh_remove_af4(const char *domain,
 91			     const struct in_addr *addr,
 92			     const struct in_addr *mask,
 93			     struct netlbl_audit *audit_info);
 94int netlbl_domhsh_remove(const char *domain, struct netlbl_audit *audit_info);
 95int netlbl_domhsh_remove_default(struct netlbl_audit *audit_info);
 96struct netlbl_dom_map *netlbl_domhsh_getentry(const char *domain);
 
 
 
 
 
 97struct netlbl_dommap_def *netlbl_domhsh_getentry_af4(const char *domain,
 98						     __be32 addr);
 99#if IS_ENABLED(CONFIG_IPV6)
100struct netlbl_dommap_def *netlbl_domhsh_getentry_af6(const char *domain,
101						   const struct in6_addr *addr);
 
 
 
 
102#endif /* IPv6 */
103
104int netlbl_domhsh_walk(u32 *skip_bkt,
105		     u32 *skip_chain,
106		     int (*callback) (struct netlbl_dom_map *entry, void *arg),
107		     void *cb_arg);
108
109#endif