Skip to content

Commit d010315

Browse files
Florian Westphalummakynes
authored andcommitted
netfilter: nf_tables: merge exthdr expression into nft core
before: text data bss dec hex filename 5056 844 0 5900 170c net/netfilter/nft_exthdr.ko 102456 2316 401 105173 19ad5 net/netfilter/nf_tables.ko after: 106410 2392 401 109203 1aa93 net/netfilter/nf_tables.ko Signed-off-by: Florian Westphal <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent ae1bc6a commit d010315

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
@@ -12,6 +12,7 @@ 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;
1414
extern struct nft_expr_type nft_rt_type;
15+
extern struct nft_expr_type nft_exthdr_type;
1516

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

net/netfilter/Kconfig

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -474,12 +474,6 @@ config NF_TABLES_NETDEV
474474
help
475475
This option enables support for the "netdev" table.
476476

477-
config NFT_EXTHDR
478-
tristate "Netfilter nf_tables exthdr module"
479-
help
480-
This option adds the "exthdr" expression that you can use to match
481-
IPv6 extension headers and tcp options.
482-
483477
config NFT_NUMGEN
484478
tristate "Netfilter nf_tables number generator module"
485479
help

net/netfilter/Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,10 @@ 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 nft_rt.o
79+
nft_dynset.o nft_meta.o nft_rt.o nft_exthdr.o
8080

8181
obj-$(CONFIG_NF_TABLES) += nf_tables.o
8282
obj-$(CONFIG_NFT_COMPAT) += nft_compat.o
83-
obj-$(CONFIG_NFT_EXTHDR) += nft_exthdr.o
8483
obj-$(CONFIG_NFT_NUMGEN) += nft_numgen.o
8584
obj-$(CONFIG_NFT_CT) += nft_ct.o
8685
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
@@ -253,6 +253,7 @@ static struct nft_expr_type *nft_basic_types[] = {
253253
&nft_range_type,
254254
&nft_meta_type,
255255
&nft_rt_type,
256+
&nft_exthdr_type,
256257
};
257258

258259
int __init nf_tables_core_module_init(void)

net/netfilter/nft_exthdr.c

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@
1010

1111
#include <asm/unaligned.h>
1212
#include <linux/kernel.h>
13-
#include <linux/init.h>
14-
#include <linux/module.h>
1513
#include <linux/netlink.h>
1614
#include <linux/netfilter.h>
1715
#include <linux/netfilter/nf_tables.h>
16+
#include <net/netfilter/nf_tables_core.h>
1817
#include <net/netfilter/nf_tables.h>
1918
#include <net/tcp.h>
2019

@@ -353,7 +352,6 @@ static int nft_exthdr_dump_set(struct sk_buff *skb, const struct nft_expr *expr)
353352
return nft_exthdr_dump_common(skb, priv);
354353
}
355354

356-
static struct nft_expr_type nft_exthdr_type;
357355
static const struct nft_expr_ops nft_exthdr_ipv6_ops = {
358356
.type = &nft_exthdr_type,
359357
.size = NFT_EXPR_SIZE(sizeof(struct nft_exthdr)),
@@ -407,27 +405,10 @@ nft_exthdr_select_ops(const struct nft_ctx *ctx,
407405
return ERR_PTR(-EOPNOTSUPP);
408406
}
409407

410-
static struct nft_expr_type nft_exthdr_type __read_mostly = {
408+
struct nft_expr_type nft_exthdr_type __read_mostly = {
411409
.name = "exthdr",
412410
.select_ops = nft_exthdr_select_ops,
413411
.policy = nft_exthdr_policy,
414412
.maxattr = NFTA_EXTHDR_MAX,
415413
.owner = THIS_MODULE,
416414
};
417-
418-
static int __init nft_exthdr_module_init(void)
419-
{
420-
return nft_register_expr(&nft_exthdr_type);
421-
}
422-
423-
static void __exit nft_exthdr_module_exit(void)
424-
{
425-
nft_unregister_expr(&nft_exthdr_type);
426-
}
427-
428-
module_init(nft_exthdr_module_init);
429-
module_exit(nft_exthdr_module_exit);
430-
431-
MODULE_LICENSE("GPL");
432-
MODULE_AUTHOR("Patrick McHardy <[email protected]>");
433-
MODULE_ALIAS_NFT_EXPR("exthdr");

0 commit comments

Comments
 (0)