aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorPaul Moore <paul.moore@hp.com>2008-10-10 10:16:31 -0400
committerPaul Moore <paul.moore@hp.com>2008-10-10 10:16:31 -0400
commitb1edeb102397546438ab4624489c6ccd7b410d97 (patch)
treece7033f678ffe46ec3f517bb2771b9cbb04d62bb /include
parenta8134296ba9940b5b271d908666e532d34430a3c (diff)
netlabel: Replace protocol/NetLabel linking with refrerence counts
NetLabel has always had a list of backpointers in the CIPSO DOI definition structure which pointed to the NetLabel LSM domain mapping structures which referenced the CIPSO DOI struct. The rationale for this was that when an administrator removed a CIPSO DOI from the system all of the associated NetLabel LSM domain mappings should be removed as well; a list of backpointers made this a simple operation. Unfortunately, while the backpointers did make the removal easier they were a bit of a mess from an implementation point of view which was making further development difficult. Since the removal of a CIPSO DOI is a realtively rare event it seems to make sense to remove this backpointer list as the optimization was hurting us more then it was helping. However, we still need to be able to track when a CIPSO DOI definition is being used so replace the backpointer list with a reference count. In order to preserve the current functionality of removing the associated LSM domain mappings when a CIPSO DOI is removed we walk the LSM domain mapping table, removing the relevant entries. Signed-off-by: Paul Moore <paul.moore@hp.com> Reviewed-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'include')
-rw-r--r--include/net/cipso_ipv4.h21
1 files changed, 11 insertions, 10 deletions
diff --git a/include/net/cipso_ipv4.h b/include/net/cipso_ipv4.h
index a6bb94530cfd..5fe6556fb3c5 100644
--- a/include/net/cipso_ipv4.h
+++ b/include/net/cipso_ipv4.h
@@ -40,6 +40,7 @@
40#include <linux/net.h> 40#include <linux/net.h>
41#include <linux/skbuff.h> 41#include <linux/skbuff.h>
42#include <net/netlabel.h> 42#include <net/netlabel.h>
43#include <asm/atomic.h>
43 44
44/* known doi values */ 45/* known doi values */
45#define CIPSO_V4_DOI_UNKNOWN 0x00000000 46#define CIPSO_V4_DOI_UNKNOWN 0x00000000
@@ -79,10 +80,9 @@ struct cipso_v4_doi {
79 } map; 80 } map;
80 u8 tags[CIPSO_V4_TAG_MAXCNT]; 81 u8 tags[CIPSO_V4_TAG_MAXCNT];
81 82
82 u32 valid; 83 atomic_t refcount;
83 struct list_head list; 84 struct list_head list;
84 struct rcu_head rcu; 85 struct rcu_head rcu;
85 struct list_head dom_list;
86}; 86};
87 87
88/* Standard CIPSO mapping table */ 88/* Standard CIPSO mapping table */
@@ -128,25 +128,26 @@ extern int cipso_v4_rbm_strictvalid;
128 128
129#ifdef CONFIG_NETLABEL 129#ifdef CONFIG_NETLABEL
130int cipso_v4_doi_add(struct cipso_v4_doi *doi_def); 130int cipso_v4_doi_add(struct cipso_v4_doi *doi_def);
131int cipso_v4_doi_remove(u32 doi, 131void cipso_v4_doi_free(struct cipso_v4_doi *doi_def);
132 struct netlbl_audit *audit_info, 132int cipso_v4_doi_remove(u32 doi, struct netlbl_audit *audit_info);
133 void (*callback) (struct rcu_head * head));
134struct cipso_v4_doi *cipso_v4_doi_getdef(u32 doi); 133struct cipso_v4_doi *cipso_v4_doi_getdef(u32 doi);
134void cipso_v4_doi_putdef(struct cipso_v4_doi *doi_def);
135int cipso_v4_doi_walk(u32 *skip_cnt, 135int cipso_v4_doi_walk(u32 *skip_cnt,
136 int (*callback) (struct cipso_v4_doi *doi_def, void *arg), 136 int (*callback) (struct cipso_v4_doi *doi_def, void *arg),
137 void *cb_arg); 137 void *cb_arg);
138int cipso_v4_doi_domhsh_add(struct cipso_v4_doi *doi_def, const char *domain);
139int cipso_v4_doi_domhsh_remove(struct cipso_v4_doi *doi_def,
140 const char *domain);
141#else 138#else
142static inline int cipso_v4_doi_add(struct cipso_v4_doi *doi_def) 139static inline int cipso_v4_doi_add(struct cipso_v4_doi *doi_def)
143{ 140{
144 return -ENOSYS; 141 return -ENOSYS;
145} 142}
146 143
144static inline void cipso_v4_doi_free(struct cipso_v4_doi *doi_def)
145{
146 return;
147}
148
147static inline int cipso_v4_doi_remove(u32 doi, 149static inline int cipso_v4_doi_remove(u32 doi,
148 struct netlbl_audit *audit_info, 150 struct netlbl_audit *audit_info)
149 void (*callback) (struct rcu_head * head))
150{ 151{
151 return 0; 152 return 0;
152} 153}