1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32#ifndef _NETLABEL_DOMAINHASH_H
33#define _NETLABEL_DOMAINHASH_H
34
35#include <linux/types.h>
36#include <linux/rcupdate.h>
37#include <linux/list.h>
38
39#include "netlabel_addrlist.h"
40
41
42
43#define NETLBL_DOMHSH_BITSIZE 7
44
45
46struct netlbl_domaddr_map {
47 struct list_head list4;
48 struct list_head list6;
49};
50struct netlbl_dommap_def {
51 u32 type;
52 union {
53 struct netlbl_domaddr_map *addrsel;
54 struct cipso_v4_doi *cipso;
55 };
56};
57#define netlbl_domhsh_addr4_entry(iter) \
58 container_of(iter, struct netlbl_domaddr4_map, list)
59struct netlbl_domaddr4_map {
60 struct netlbl_dommap_def def;
61
62 struct netlbl_af4list list;
63};
64#define netlbl_domhsh_addr6_entry(iter) \
65 container_of(iter, struct netlbl_domaddr6_map, list)
66struct netlbl_domaddr6_map {
67 struct netlbl_dommap_def def;
68
69 struct netlbl_af6list list;
70};
71
72struct netlbl_dom_map {
73 char *domain;
74 struct netlbl_dommap_def def;
75
76 u32 valid;
77 struct list_head list;
78 struct rcu_head rcu;
79};
80
81
82int netlbl_domhsh_init(u32 size);
83
84
85int netlbl_domhsh_add(struct netlbl_dom_map *entry,
86 struct netlbl_audit *audit_info);
87int netlbl_domhsh_add_default(struct netlbl_dom_map *entry,
88 struct netlbl_audit *audit_info);
89int netlbl_domhsh_remove_entry(struct netlbl_dom_map *entry,
90 struct netlbl_audit *audit_info);
91int netlbl_domhsh_remove_af4(const char *domain,
92 const struct in_addr *addr,
93 const struct in_addr *mask,
94 struct netlbl_audit *audit_info);
95int netlbl_domhsh_remove(const char *domain, struct netlbl_audit *audit_info);
96int netlbl_domhsh_remove_default(struct netlbl_audit *audit_info);
97struct netlbl_dom_map *netlbl_domhsh_getentry(const char *domain);
98struct netlbl_dommap_def *netlbl_domhsh_getentry_af4(const char *domain,
99 __be32 addr);
100#if IS_ENABLED(CONFIG_IPV6)
101struct netlbl_dommap_def *netlbl_domhsh_getentry_af6(const char *domain,
102 const struct in6_addr *addr);
103#endif
104
105int netlbl_domhsh_walk(u32 *skip_bkt,
106 u32 *skip_chain,
107 int (*callback) (struct netlbl_dom_map *entry, void *arg),
108 void *cb_arg);
109
110#endif
111