Skip to content

Commit faec865

Browse files
Florian Westphalummakynes
authored andcommitted
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: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
1 parent 9f0f3eb commit faec865

File tree

2 files changed

+8
-16
lines changed

2 files changed

+8
-16
lines changed

include/net/netfilter/nf_conntrack_extend.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,7 @@ static inline void nf_ct_ext_free(struct nf_conn *ct)
8686
}
8787

8888
/* Add this type, returns pointer to data or NULL. */
89-
void *__nf_ct_ext_add_length(struct nf_conn *ct, enum nf_ct_ext_id id,
90-
size_t var_alloc_len, gfp_t gfp);
91-
92-
#define nf_ct_ext_add(ct, id, gfp) \
93-
((id##_TYPE *)__nf_ct_ext_add_length((ct), (id), 0, (gfp)))
94-
#define nf_ct_ext_add_length(ct, id, len, gfp) \
95-
((id##_TYPE *)__nf_ct_ext_add_length((ct), (id), (len), (gfp)))
89+
void *nf_ct_ext_add(struct nf_conn *ct, enum nf_ct_ext_id id, gfp_t gfp);
9690

9791
#define NF_CT_EXT_F_PREALLOC 0x0001
9892

net/netfilter/nf_conntrack_extend.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ void __nf_ct_ext_destroy(struct nf_conn *ct)
4444
EXPORT_SYMBOL(__nf_ct_ext_destroy);
4545

4646
static void *
47-
nf_ct_ext_create(struct nf_ct_ext **ext, enum nf_ct_ext_id id,
48-
size_t var_alloc_len, gfp_t gfp)
47+
nf_ct_ext_create(struct nf_ct_ext **ext, enum nf_ct_ext_id id, gfp_t gfp)
4948
{
5049
unsigned int off, len;
5150
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,
5958
}
6059

6160
off = ALIGN(sizeof(struct nf_ct_ext), t->align);
62-
len = off + t->len + var_alloc_len;
63-
alloc_size = t->alloc_size + var_alloc_len;
61+
len = off + t->len;
62+
alloc_size = t->alloc_size;
6463
rcu_read_unlock();
6564

6665
*ext = kzalloc(alloc_size, gfp);
@@ -73,8 +72,7 @@ nf_ct_ext_create(struct nf_ct_ext **ext, enum nf_ct_ext_id id,
7372
return (void *)(*ext) + off;
7473
}
7574

76-
void *__nf_ct_ext_add_length(struct nf_conn *ct, enum nf_ct_ext_id id,
77-
size_t var_alloc_len, gfp_t gfp)
75+
void *nf_ct_ext_add(struct nf_conn *ct, enum nf_ct_ext_id id, gfp_t gfp)
7876
{
7977
struct nf_ct_ext *old, *new;
8078
int newlen, newoff;
@@ -85,7 +83,7 @@ void *__nf_ct_ext_add_length(struct nf_conn *ct, enum nf_ct_ext_id id,
8583

8684
old = ct->ext;
8785
if (!old)
88-
return nf_ct_ext_create(&ct->ext, id, var_alloc_len, gfp);
86+
return nf_ct_ext_create(&ct->ext, id, gfp);
8987

9088
if (__nf_ct_ext_exist(old, id))
9189
return NULL;
@@ -98,7 +96,7 @@ void *__nf_ct_ext_add_length(struct nf_conn *ct, enum nf_ct_ext_id id,
9896
}
9997

10098
newoff = ALIGN(old->len, t->align);
101-
newlen = newoff + t->len + var_alloc_len;
99+
newlen = newoff + t->len;
102100
rcu_read_unlock();
103101

104102
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,
115113
memset((void *)new + newoff, 0, newlen - newoff);
116114
return (void *)new + newoff;
117115
}
118-
EXPORT_SYMBOL(__nf_ct_ext_add_length);
116+
EXPORT_SYMBOL(nf_ct_ext_add);
119117

120118
static void update_alloc_size(struct nf_ct_ext_type *type)
121119
{

0 commit comments

Comments
 (0)