aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Engelhardt <jengelh@medozas.de>2010-01-04 10:26:03 -0500
committerPatrick McHardy <kaber@trash.net>2010-01-04 10:26:03 -0500
commit89bc7a0f64de7bed2e0bc68a23d75699a610cd37 (patch)
treeb9e83a7f79fd8876b31ee29b362f71a22e9411a7
parent71c3ebfdb27b50dcaef38b6f70da82b9142c5fb6 (diff)
netfilter: xt_recent: save 8 bytes per htable
Moving rnd_inited into the hole after the uint8 lets go of the uint32 rnd_inited was using, plus the padding that would follow the int group. Signed-off-by: Jan Engelhardt <jengelh@medozas.de> Signed-off-by: Patrick McHardy <kaber@trash.net>
-rw-r--r--net/netfilter/xt_hashlimit.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c
index dd16e404424f..5bdc1fbf3ad7 100644
--- a/net/netfilter/xt_hashlimit.c
+++ b/net/netfilter/xt_hashlimit.c
@@ -81,13 +81,13 @@ struct xt_hashlimit_htable {
81 struct hlist_node node; /* global list of all htables */ 81 struct hlist_node node; /* global list of all htables */
82 atomic_t use; 82 atomic_t use;
83 u_int8_t family; 83 u_int8_t family;
84 bool rnd_initialized;
84 85
85 struct hashlimit_cfg1 cfg; /* config */ 86 struct hashlimit_cfg1 cfg; /* config */
86 87
87 /* used internally */ 88 /* used internally */
88 spinlock_t lock; /* lock for list_head */ 89 spinlock_t lock; /* lock for list_head */
89 u_int32_t rnd; /* random seed for hash */ 90 u_int32_t rnd; /* random seed for hash */
90 int rnd_initialized;
91 unsigned int count; /* number entries in table */ 91 unsigned int count; /* number entries in table */
92 struct timer_list timer; /* timer for gc */ 92 struct timer_list timer; /* timer for gc */
93 93
@@ -150,7 +150,7 @@ dsthash_alloc_init(struct xt_hashlimit_htable *ht,
150 * the first hashtable entry */ 150 * the first hashtable entry */
151 if (!ht->rnd_initialized) { 151 if (!ht->rnd_initialized) {
152 get_random_bytes(&ht->rnd, sizeof(ht->rnd)); 152 get_random_bytes(&ht->rnd, sizeof(ht->rnd));
153 ht->rnd_initialized = 1; 153 ht->rnd_initialized = true;
154 } 154 }
155 155
156 if (ht->cfg.max && ht->count >= ht->cfg.max) { 156 if (ht->cfg.max && ht->count >= ht->cfg.max) {
@@ -235,7 +235,7 @@ static int htable_create_v0(struct xt_hashlimit_info *minfo, u_int8_t family)
235 atomic_set(&hinfo->use, 1); 235 atomic_set(&hinfo->use, 1);
236 hinfo->count = 0; 236 hinfo->count = 0;
237 hinfo->family = family; 237 hinfo->family = family;
238 hinfo->rnd_initialized = 0; 238 hinfo->rnd_initialized = false;
239 spin_lock_init(&hinfo->lock); 239 spin_lock_init(&hinfo->lock);
240 hinfo->pde = proc_create_data(minfo->name, 0, 240 hinfo->pde = proc_create_data(minfo->name, 0,
241 (family == NFPROTO_IPV4) ? 241 (family == NFPROTO_IPV4) ?
@@ -296,7 +296,7 @@ static int htable_create(struct xt_hashlimit_mtinfo1 *minfo, u_int8_t family)
296 atomic_set(&hinfo->use, 1); 296 atomic_set(&hinfo->use, 1);
297 hinfo->count = 0; 297 hinfo->count = 0;
298 hinfo->family = family; 298 hinfo->family = family;
299 hinfo->rnd_initialized = 0; 299 hinfo->rnd_initialized = false;
300 spin_lock_init(&hinfo->lock); 300 spin_lock_init(&hinfo->lock);
301 301
302 hinfo->pde = proc_create_data(minfo->name, 0, 302 hinfo->pde = proc_create_data(minfo->name, 0,