diff options
Diffstat (limited to 'net/netlabel/netlabel_domainhash.h')
| -rw-r--r-- | net/netlabel/netlabel_domainhash.h | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/net/netlabel/netlabel_domainhash.h b/net/netlabel/netlabel_domainhash.h index 8220990ceb96..bfcb6763a1a1 100644 --- a/net/netlabel/netlabel_domainhash.h +++ b/net/netlabel/netlabel_domainhash.h | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | */ | 11 | */ |
| 12 | 12 | ||
| 13 | /* | 13 | /* |
| 14 | * (c) Copyright Hewlett-Packard Development Company, L.P., 2006 | 14 | * (c) Copyright Hewlett-Packard Development Company, L.P., 2006, 2008 |
| 15 | * | 15 | * |
| 16 | * This program is free software; you can redistribute it and/or modify | 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 | 17 | * it under the terms of the GNU General Public License as published by |
| @@ -36,16 +36,43 @@ | |||
| 36 | #include <linux/rcupdate.h> | 36 | #include <linux/rcupdate.h> |
| 37 | #include <linux/list.h> | 37 | #include <linux/list.h> |
| 38 | 38 | ||
| 39 | #include "netlabel_addrlist.h" | ||
| 40 | |||
| 39 | /* Domain hash table size */ | 41 | /* Domain hash table size */ |
| 40 | /* XXX - currently this number is an uneducated guess */ | 42 | /* XXX - currently this number is an uneducated guess */ |
| 41 | #define NETLBL_DOMHSH_BITSIZE 7 | 43 | #define NETLBL_DOMHSH_BITSIZE 7 |
| 42 | 44 | ||
| 43 | /* Domain mapping definition struct */ | 45 | /* Domain mapping definition structures */ |
| 46 | #define netlbl_domhsh_addr4_entry(iter) \ | ||
| 47 | container_of(iter, struct netlbl_domaddr4_map, list) | ||
| 48 | struct netlbl_domaddr4_map { | ||
| 49 | u32 type; | ||
| 50 | union { | ||
| 51 | struct cipso_v4_doi *cipsov4; | ||
| 52 | } type_def; | ||
| 53 | |||
| 54 | struct netlbl_af4list list; | ||
| 55 | }; | ||
| 56 | #define netlbl_domhsh_addr6_entry(iter) \ | ||
| 57 | container_of(iter, struct netlbl_domaddr6_map, list) | ||
| 58 | struct netlbl_domaddr6_map { | ||
| 59 | u32 type; | ||
| 60 | |||
| 61 | /* NOTE: no 'type_def' union needed at present since we don't currently | ||
| 62 | * support any IPv6 labeling protocols */ | ||
| 63 | |||
| 64 | struct netlbl_af6list list; | ||
| 65 | }; | ||
| 66 | struct netlbl_domaddr_map { | ||
| 67 | struct list_head list4; | ||
| 68 | struct list_head list6; | ||
| 69 | }; | ||
| 44 | struct netlbl_dom_map { | 70 | struct netlbl_dom_map { |
| 45 | char *domain; | 71 | char *domain; |
| 46 | u32 type; | 72 | u32 type; |
| 47 | union { | 73 | union { |
| 48 | struct cipso_v4_doi *cipsov4; | 74 | struct cipso_v4_doi *cipsov4; |
| 75 | struct netlbl_domaddr_map *addrsel; | ||
| 49 | } type_def; | 76 | } type_def; |
| 50 | 77 | ||
| 51 | u32 valid; | 78 | u32 valid; |
| @@ -61,12 +88,21 @@ int netlbl_domhsh_add(struct netlbl_dom_map *entry, | |||
| 61 | struct netlbl_audit *audit_info); | 88 | struct netlbl_audit *audit_info); |
| 62 | int netlbl_domhsh_add_default(struct netlbl_dom_map *entry, | 89 | int netlbl_domhsh_add_default(struct netlbl_dom_map *entry, |
| 63 | struct netlbl_audit *audit_info); | 90 | struct netlbl_audit *audit_info); |
| 91 | int netlbl_domhsh_remove_entry(struct netlbl_dom_map *entry, | ||
| 92 | struct netlbl_audit *audit_info); | ||
| 64 | int netlbl_domhsh_remove(const char *domain, struct netlbl_audit *audit_info); | 93 | int netlbl_domhsh_remove(const char *domain, struct netlbl_audit *audit_info); |
| 65 | int netlbl_domhsh_remove_default(struct netlbl_audit *audit_info); | 94 | int netlbl_domhsh_remove_default(struct netlbl_audit *audit_info); |
| 66 | struct netlbl_dom_map *netlbl_domhsh_getentry(const char *domain); | 95 | struct netlbl_dom_map *netlbl_domhsh_getentry(const char *domain); |
| 96 | struct netlbl_domaddr4_map *netlbl_domhsh_getentry_af4(const char *domain, | ||
| 97 | __be32 addr); | ||
| 67 | int netlbl_domhsh_walk(u32 *skip_bkt, | 98 | int netlbl_domhsh_walk(u32 *skip_bkt, |
| 68 | u32 *skip_chain, | 99 | u32 *skip_chain, |
| 69 | int (*callback) (struct netlbl_dom_map *entry, void *arg), | 100 | int (*callback) (struct netlbl_dom_map *entry, void *arg), |
| 70 | void *cb_arg); | 101 | void *cb_arg); |
| 71 | 102 | ||
| 103 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
| 104 | struct netlbl_domaddr6_map *netlbl_domhsh_getentry_af6(const char *domain, | ||
| 105 | const struct in6_addr *addr); | ||
| 106 | #endif /* IPv6 */ | ||
| 107 | |||
| 72 | #endif | 108 | #endif |
