Commit faec865d authored by Florian Westphal's avatar Florian Westphal Committed by Pablo Neira Ayuso

netfilter: remove last traces of variable-sized extensions

get rid of the (now unused) nf_ct_ext_add_length define and also
rename the function to plain nf_ct_ext_add().
Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 9f0f3ebe
...@@ -86,13 +86,7 @@ static inline void nf_ct_ext_free(struct nf_conn *ct) ...@@ -86,13 +86,7 @@ static inline void nf_ct_ext_free(struct nf_conn *ct)
} }
/* Add this type, returns pointer to data or NULL. */ /* Add this type, returns pointer to data or NULL. */
void *__nf_ct_ext_add_length(struct nf_conn *ct, enum nf_ct_ext_id id, void *nf_ct_ext_add(struct nf_conn *ct, enum nf_ct_ext_id id, gfp_t gfp);
size_t var_alloc_len, gfp_t gfp);
#define nf_ct_ext_add(ct, id, gfp) \
((id##_TYPE *)__nf_ct_ext_add_length((ct), (id), 0, (gfp)))
#define nf_ct_ext_add_length(ct, id, len, gfp) \
((id##_TYPE *)__nf_ct_ext_add_length((ct), (id), (len), (gfp)))
#define NF_CT_EXT_F_PREALLOC 0x0001 #define NF_CT_EXT_F_PREALLOC 0x0001
......
...@@ -44,8 +44,7 @@ void __nf_ct_ext_destroy(struct nf_conn *ct) ...@@ -44,8 +44,7 @@ void __nf_ct_ext_destroy(struct nf_conn *ct)
EXPORT_SYMBOL(__nf_ct_ext_destroy); EXPORT_SYMBOL(__nf_ct_ext_destroy);
static void * static void *
nf_ct_ext_create(struct nf_ct_ext **ext, enum nf_ct_ext_id id, nf_ct_ext_create(struct nf_ct_ext **ext, enum nf_ct_ext_id id, gfp_t gfp)
size_t var_alloc_len, gfp_t gfp)
{ {
unsigned int off, len; unsigned int off, len;
struct nf_ct_ext_type *t; struct nf_ct_ext_type *t;
...@@ -59,8 +58,8 @@ nf_ct_ext_create(struct nf_ct_ext **ext, enum nf_ct_ext_id id, ...@@ -59,8 +58,8 @@ nf_ct_ext_create(struct nf_ct_ext **ext, enum nf_ct_ext_id id,
} }
off = ALIGN(sizeof(struct nf_ct_ext), t->align); off = ALIGN(sizeof(struct nf_ct_ext), t->align);
len = off + t->len + var_alloc_len; len = off + t->len;
alloc_size = t->alloc_size + var_alloc_len; alloc_size = t->alloc_size;
rcu_read_unlock(); rcu_read_unlock();
*ext = kzalloc(alloc_size, gfp); *ext = kzalloc(alloc_size, gfp);
...@@ -73,8 +72,7 @@ nf_ct_ext_create(struct nf_ct_ext **ext, enum nf_ct_ext_id id, ...@@ -73,8 +72,7 @@ nf_ct_ext_create(struct nf_ct_ext **ext, enum nf_ct_ext_id id,
return (void *)(*ext) + off; return (void *)(*ext) + off;
} }
void *__nf_ct_ext_add_length(struct nf_conn *ct, enum nf_ct_ext_id id, void *nf_ct_ext_add(struct nf_conn *ct, enum nf_ct_ext_id id, gfp_t gfp)
size_t var_alloc_len, gfp_t gfp)
{ {
struct nf_ct_ext *old, *new; struct nf_ct_ext *old, *new;
int newlen, newoff; int newlen, newoff;
...@@ -85,7 +83,7 @@ void *__nf_ct_ext_add_length(struct nf_conn *ct, enum nf_ct_ext_id id, ...@@ -85,7 +83,7 @@ void *__nf_ct_ext_add_length(struct nf_conn *ct, enum nf_ct_ext_id id,
old = ct->ext; old = ct->ext;
if (!old) if (!old)
return nf_ct_ext_create(&ct->ext, id, var_alloc_len, gfp); return nf_ct_ext_create(&ct->ext, id, gfp);
if (__nf_ct_ext_exist(old, id)) if (__nf_ct_ext_exist(old, id))
return NULL; return NULL;
...@@ -98,7 +96,7 @@ void *__nf_ct_ext_add_length(struct nf_conn *ct, enum nf_ct_ext_id id, ...@@ -98,7 +96,7 @@ void *__nf_ct_ext_add_length(struct nf_conn *ct, enum nf_ct_ext_id id,
} }
newoff = ALIGN(old->len, t->align); newoff = ALIGN(old->len, t->align);
newlen = newoff + t->len + var_alloc_len; newlen = newoff + t->len;
rcu_read_unlock(); rcu_read_unlock();
new = __krealloc(old, newlen, gfp); new = __krealloc(old, newlen, gfp);
...@@ -115,7 +113,7 @@ void *__nf_ct_ext_add_length(struct nf_conn *ct, enum nf_ct_ext_id id, ...@@ -115,7 +113,7 @@ void *__nf_ct_ext_add_length(struct nf_conn *ct, enum nf_ct_ext_id id,
memset((void *)new + newoff, 0, newlen - newoff); memset((void *)new + newoff, 0, newlen - newoff);
return (void *)new + newoff; return (void *)new + newoff;
} }
EXPORT_SYMBOL(__nf_ct_ext_add_length); EXPORT_SYMBOL(nf_ct_ext_add);
static void update_alloc_size(struct nf_ct_ext_type *type) static void update_alloc_size(struct nf_ct_ext_type *type)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment