Skip to content

Commit 531e613

Browse files
Florian Westphalummakynes
authored andcommitted
netfilter: nft_set: remove indirection from update API call
This stems from a time when sets and nft_dynset resided in different kernel modules. We can replace this with a direct call. We could even remove both ->update and ->delete, given its only supported by rhashtable, but on the off-chance we'll see runtime add/delete for other types or a new set type keep that as-is for now. Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
1 parent 17a20e0 commit 531e613

File tree

5 files changed

+8
-13
lines changed

5 files changed

+8
-13
lines changed

include/net/netfilter/nf_tables.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -464,10 +464,6 @@ struct nft_set_ops {
464464
const u32 *key);
465465
const struct nft_set_ext * (*update)(struct nft_set *set,
466466
const u32 *key,
467-
struct nft_elem_priv *
468-
(*new)(struct nft_set *,
469-
const struct nft_expr *,
470-
struct nft_regs *),
471467
const struct nft_expr *expr,
472468
struct nft_regs *regs);
473469
bool (*delete)(const struct nft_set *set,

include/net/netfilter/nf_tables_core.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,4 +188,7 @@ void nft_objref_eval(const struct nft_expr *expr, struct nft_regs *regs,
188188
const struct nft_pktinfo *pkt);
189189
void nft_objref_map_eval(const struct nft_expr *expr, struct nft_regs *regs,
190190
const struct nft_pktinfo *pkt);
191+
struct nft_elem_priv *nft_dynset_new(struct nft_set *set,
192+
const struct nft_expr *expr,
193+
struct nft_regs *regs);
191194
#endif /* _NET_NF_TABLES_CORE_H */

net/netfilter/nft_dynset.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ static int nft_dynset_expr_setup(const struct nft_dynset *priv,
4444
return 0;
4545
}
4646

47-
static struct nft_elem_priv *nft_dynset_new(struct nft_set *set,
48-
const struct nft_expr *expr,
49-
struct nft_regs *regs)
47+
struct nft_elem_priv *nft_dynset_new(struct nft_set *set,
48+
const struct nft_expr *expr,
49+
struct nft_regs *regs)
5050
{
5151
const struct nft_dynset *priv = nft_expr_priv(expr);
5252
struct nft_set_ext *ext;
@@ -91,8 +91,7 @@ void nft_dynset_eval(const struct nft_expr *expr,
9191
return;
9292
}
9393

94-
ext = set->ops->update(set, &regs->data[priv->sreg_key], nft_dynset_new,
95-
expr, regs);
94+
ext = set->ops->update(set, &regs->data[priv->sreg_key], expr, regs);
9695
if (ext) {
9796
if (priv->op == NFT_DYNSET_OP_UPDATE &&
9897
nft_set_ext_exists(ext, NFT_SET_EXT_TIMEOUT) &&

net/netfilter/nft_set_hash.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,6 @@ nft_rhash_get(const struct net *net, const struct nft_set *set,
123123

124124
static const struct nft_set_ext *
125125
nft_rhash_update(struct nft_set *set, const u32 *key,
126-
struct nft_elem_priv *(*new)(struct nft_set *, const struct nft_expr *,
127-
struct nft_regs *regs),
128126
const struct nft_expr *expr, struct nft_regs *regs)
129127
{
130128
struct nft_rhash *priv = nft_set_priv(set);
@@ -141,7 +139,7 @@ nft_rhash_update(struct nft_set *set, const u32 *key,
141139
if (he != NULL)
142140
goto out;
143141

144-
elem_priv = new(set, expr, regs);
142+
elem_priv = nft_dynset_new(set, expr, regs);
145143
if (!elem_priv)
146144
goto err1;
147145

net/netfilter/nft_set_pipapo_avx2.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1137,7 +1137,6 @@ static inline void pipapo_resmap_init_avx2(const struct nft_pipapo_match *m, uns
11371137
* @net: Network namespace
11381138
* @set: nftables API set representation
11391139
* @key: nftables API element representation containing key data
1140-
* @ext: nftables API extension pointer, filled with matching reference
11411140
*
11421141
* For more details, see DOC: Theory of Operation in nft_set_pipapo.c.
11431142
*

0 commit comments

Comments
 (0)