Skip to content

Commit d037abc

Browse files
Florian Westphalummakynes
authored andcommitted
netfilter: nft_objref: make it builtin
nft_objref is needed to reference named objects, it makes no sense to disable it. Before: text data bss dec filename 4014 424 0 4438 nft_objref.o 4174 1128 0 5302 nft_objref.ko 359351 15276 864 375491 nf_tables.ko After: text data bss dec filename 3815 408 0 4223 nft_objref.o 363161 15692 864 379717 nf_tables.ko Signed-off-by: Florian Westphal <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent e7a1caa commit d037abc

File tree

5 files changed

+5
-29
lines changed

5 files changed

+5
-29
lines changed

include/net/netfilter/nf_tables_core.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ extern struct nft_expr_type nft_meta_type;
1818
extern struct nft_expr_type nft_rt_type;
1919
extern struct nft_expr_type nft_exthdr_type;
2020
extern struct nft_expr_type nft_last_type;
21+
extern struct nft_expr_type nft_objref_type;
2122

2223
#ifdef CONFIG_NETWORK_SECMARK
2324
extern struct nft_object_type nft_secmark_obj_type;

net/netfilter/Kconfig

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -568,12 +568,6 @@ config NFT_TUNNEL
568568
This option adds the "tunnel" expression that you can use to set
569569
tunneling policies.
570570

571-
config NFT_OBJREF
572-
tristate "Netfilter nf_tables stateful object reference module"
573-
help
574-
This option adds the "objref" expression that allows you to refer to
575-
stateful objects, such as counters and quotas.
576-
577571
config NFT_QUEUE
578572
depends on NETFILTER_NETLINK_QUEUE
579573
tristate "Netfilter nf_tables queue module"

net/netfilter/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ nf_tables-objs := nf_tables_core.o nf_tables_api.o nft_chain_filter.o \
8686
nf_tables_trace.o nft_immediate.o nft_cmp.o nft_range.o \
8787
nft_bitwise.o nft_byteorder.o nft_payload.o nft_lookup.o \
8888
nft_dynset.o nft_meta.o nft_rt.o nft_exthdr.o nft_last.o \
89-
nft_counter.o nft_chain_route.o nf_tables_offload.o \
89+
nft_counter.o nft_objref.o \
90+
nft_chain_route.o nf_tables_offload.o \
9091
nft_set_hash.o nft_set_bitmap.o nft_set_rbtree.o \
9192
nft_set_pipapo.o
9293

@@ -104,7 +105,6 @@ obj-$(CONFIG_NFT_CT) += nft_ct.o
104105
obj-$(CONFIG_NFT_FLOW_OFFLOAD) += nft_flow_offload.o
105106
obj-$(CONFIG_NFT_LIMIT) += nft_limit.o
106107
obj-$(CONFIG_NFT_NAT) += nft_nat.o
107-
obj-$(CONFIG_NFT_OBJREF) += nft_objref.o
108108
obj-$(CONFIG_NFT_QUEUE) += nft_queue.o
109109
obj-$(CONFIG_NFT_QUOTA) += nft_quota.o
110110
obj-$(CONFIG_NFT_REJECT) += nft_reject.o

net/netfilter/nf_tables_core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,7 @@ static struct nft_expr_type *nft_basic_types[] = {
340340
&nft_exthdr_type,
341341
&nft_last_type,
342342
&nft_counter_type,
343+
&nft_objref_type,
343344
};
344345

345346
static struct nft_object_type *nft_basic_objects[] = {

net/netfilter/nft_objref.c

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ static void nft_objref_activate(const struct nft_ctx *ctx,
8282
obj->use++;
8383
}
8484

85-
static struct nft_expr_type nft_objref_type;
8685
static const struct nft_expr_ops nft_objref_ops = {
8786
.type = &nft_objref_type,
8887
.size = NFT_EXPR_SIZE(sizeof(struct nft_object *)),
@@ -195,7 +194,6 @@ static void nft_objref_map_destroy(const struct nft_ctx *ctx,
195194
nf_tables_destroy_set(ctx, priv->set);
196195
}
197196

198-
static struct nft_expr_type nft_objref_type;
199197
static const struct nft_expr_ops nft_objref_map_ops = {
200198
.type = &nft_objref_type,
201199
.size = NFT_EXPR_SIZE(sizeof(struct nft_objref_map)),
@@ -233,28 +231,10 @@ static const struct nla_policy nft_objref_policy[NFTA_OBJREF_MAX + 1] = {
233231
[NFTA_OBJREF_SET_ID] = { .type = NLA_U32 },
234232
};
235233

236-
static struct nft_expr_type nft_objref_type __read_mostly = {
234+
struct nft_expr_type nft_objref_type __read_mostly = {
237235
.name = "objref",
238236
.select_ops = nft_objref_select_ops,
239237
.policy = nft_objref_policy,
240238
.maxattr = NFTA_OBJREF_MAX,
241239
.owner = THIS_MODULE,
242240
};
243-
244-
static int __init nft_objref_module_init(void)
245-
{
246-
return nft_register_expr(&nft_objref_type);
247-
}
248-
249-
static void __exit nft_objref_module_exit(void)
250-
{
251-
nft_unregister_expr(&nft_objref_type);
252-
}
253-
254-
module_init(nft_objref_module_init);
255-
module_exit(nft_objref_module_exit);
256-
257-
MODULE_LICENSE("GPL");
258-
MODULE_AUTHOR("Pablo Neira Ayuso <[email protected]>");
259-
MODULE_ALIAS_NFT_EXPR("objref");
260-
MODULE_DESCRIPTION("nftables stateful object reference module");

0 commit comments

Comments
 (0)