Skip to content

Commit ae1bc6a

Browse files
Florian Westphalummakynes
authored andcommitted
netfilter: nf_tables: merge rt expression into nft core
before: text data bss dec hex filename 2657 844 0 3501 dad net/netfilter/nft_rt.ko 100826 2240 401 103467 1942b net/netfilter/nf_tables.ko after: 2657 844 0 3501 dad net/netfilter/nft_rt.ko 102456 2316 401 105173 19ad5 net/netfilter/nf_tables.ko Signed-off-by: Florian Westphal <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 8a22543 commit ae1bc6a

File tree

5 files changed

+4
-29
lines changed

5 files changed

+4
-29
lines changed

include/net/netfilter/nf_tables_core.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ extern struct nft_expr_type nft_payload_type;
1111
extern struct nft_expr_type nft_dynset_type;
1212
extern struct nft_expr_type nft_range_type;
1313
extern struct nft_expr_type nft_meta_type;
14+
extern struct nft_expr_type nft_rt_type;
1415

1516
int nf_tables_core_module_init(void);
1617
void nf_tables_core_module_exit(void);

net/netfilter/Kconfig

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -480,12 +480,6 @@ config NFT_EXTHDR
480480
This option adds the "exthdr" expression that you can use to match
481481
IPv6 extension headers and tcp options.
482482

483-
config NFT_RT
484-
tristate "Netfilter nf_tables routing module"
485-
help
486-
This option adds the "rt" expression that you can use to match
487-
packet routing information such as the packet nexthop.
488-
489483
config NFT_NUMGEN
490484
tristate "Netfilter nf_tables number generator module"
491485
help

net/netfilter/Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,11 @@ obj-$(CONFIG_NF_DUP_NETDEV) += nf_dup_netdev.o
7676
nf_tables-objs := nf_tables_core.o nf_tables_api.o nft_chain_filter.o \
7777
nf_tables_trace.o nft_immediate.o nft_cmp.o nft_range.o \
7878
nft_bitwise.o nft_byteorder.o nft_payload.o nft_lookup.o \
79-
nft_dynset.o nft_meta.o
79+
nft_dynset.o nft_meta.o nft_rt.o
8080

8181
obj-$(CONFIG_NF_TABLES) += nf_tables.o
8282
obj-$(CONFIG_NFT_COMPAT) += nft_compat.o
8383
obj-$(CONFIG_NFT_EXTHDR) += nft_exthdr.o
84-
obj-$(CONFIG_NFT_RT) += nft_rt.o
8584
obj-$(CONFIG_NFT_NUMGEN) += nft_numgen.o
8685
obj-$(CONFIG_NFT_CT) += nft_ct.o
8786
obj-$(CONFIG_NFT_FLOW_OFFLOAD) += nft_flow_offload.o

net/netfilter/nf_tables_core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ static struct nft_expr_type *nft_basic_types[] = {
252252
&nft_dynset_type,
253253
&nft_range_type,
254254
&nft_meta_type,
255+
&nft_rt_type,
255256
};
256257

257258
int __init nf_tables_core_module_init(void)

net/netfilter/nft_rt.c

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
*/
88

99
#include <linux/kernel.h>
10-
#include <linux/init.h>
11-
#include <linux/module.h>
1210
#include <linux/netlink.h>
1311
#include <linux/netfilter.h>
1412
#include <linux/netfilter/nf_tables.h>
@@ -179,7 +177,6 @@ static int nft_rt_validate(const struct nft_ctx *ctx, const struct nft_expr *exp
179177
return nft_chain_validate_hooks(ctx->chain, hooks);
180178
}
181179

182-
static struct nft_expr_type nft_rt_type;
183180
static const struct nft_expr_ops nft_rt_get_ops = {
184181
.type = &nft_rt_type,
185182
.size = NFT_EXPR_SIZE(sizeof(struct nft_rt)),
@@ -189,27 +186,10 @@ static const struct nft_expr_ops nft_rt_get_ops = {
189186
.validate = nft_rt_validate,
190187
};
191188

192-
static struct nft_expr_type nft_rt_type __read_mostly = {
189+
struct nft_expr_type nft_rt_type __read_mostly = {
193190
.name = "rt",
194191
.ops = &nft_rt_get_ops,
195192
.policy = nft_rt_policy,
196193
.maxattr = NFTA_RT_MAX,
197194
.owner = THIS_MODULE,
198195
};
199-
200-
static int __init nft_rt_module_init(void)
201-
{
202-
return nft_register_expr(&nft_rt_type);
203-
}
204-
205-
static void __exit nft_rt_module_exit(void)
206-
{
207-
nft_unregister_expr(&nft_rt_type);
208-
}
209-
210-
module_init(nft_rt_module_init);
211-
module_exit(nft_rt_module_exit);
212-
213-
MODULE_LICENSE("GPL");
214-
MODULE_AUTHOR("Anders K. Pedersen <[email protected]>");
215-
MODULE_ALIAS_NFT_EXPR("rt");

0 commit comments

Comments
 (0)