netfilter: nft_tunnel: Add dst_cache support
Subsystems (5)
Pablo Neira Ayuso
maintainerPATCH 20/29 netfilter: nft_tunnel: Add dst_cache support
From: wenxu <[email protected]>
The metadata_dst does not initialize the dst_cache field, this causes problems to ip_md_tunnel_xmit() since it cannot use this cache, hence, Triggering a route lookup for every packet.
--- net/netfilter/nft_tunnel.c | 7 +++++++ 1 file changed, 7 insertions(+)
net/netfilter/nft_tunnel.c +7 -0
@@ -406,6 +406,13 @@ static int nft_tunnel_obj_init(const struct nft_ctx *ctx,return -ENOMEM ;memcpy (&md->u.tun_info, &info,sizeof (info)); +#ifdef CONFIG_DST_CACHE + err =dst_cache_init (&md->u.tun_info.dst_cache,GFP_KERNEL ); +if (err <0 ) { +metadata_dst_free (md); +return err; + } +#endif ip_tunnel_info_opts_set (&md->u.tun_info, &priv->opts.u, priv->opts.len, priv->opts.flags); priv->md = md;
Signature · 1 line
2.11.0
Pablo Neira Ayuso
maintainerPATCH 21/29 netfilter: convert the proto argument from u8 to u16
From: Li RongQing <[email protected]>
The proto in struct xt_match and struct xt_target is u16, when calling xt_check_target/match, their proto argument is u8, and will cause truncation, it is harmless to ip packet, since ip proto is u8
if a etable's match/target has proto that is u16, will cause the check failure.
and convert be16 to short in bridge/netfilter/ebtables.c
--- include/linux/netfilter/x_tables.h | 4 ++-- net/bridge/netfilter/ebtables.c | 6 +++--- net/netfilter/x_tables.c | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-)
include/linux/netfilter/x_tables.h +2 -2
@@ -289,9 +289,9 @@ bool xt_find_jump_offset(const unsigned int *offsets,int xt_check_proc_name (const char *name,unsigned int size); -int xt_check_match (struct xt_mtchk_param *,unsigned int size,u_int8_t proto, +int xt_check_match (struct xt_mtchk_param *,unsigned int size,u16 proto,bool inv_proto); -int xt_check_target (struct xt_tgchk_param *,unsigned int size,u_int8_t proto, +int xt_check_target (struct xt_tgchk_param *,unsigned int size,u16 proto,bool inv_proto); int xt_match_to_user(const struct xt_entry_match *m,
net/bridge/netfilter/ebtables.c +3 -3
@@ -381,7 +381,7 @@ ebt_check_match(struct ebt_entry_match *m, struct xt_mtchk_param *par, par->match = match; par->matchinfo = m->data; ret =xt_check_match (par, m->match_size, - e->ethproto, e->invflags &EBT_IPROTO ); +ntohs (e->ethproto), e->invflags &EBT_IPROTO );if (ret <0 ) {module_put (match->me);return ret;
@@ -418,7 +418,7 @@ ebt_check_watcher(struct ebt_entry_watcher *w, struct xt_tgchk_param *par, par->target = watcher; par->targinfo = w->data; ret =xt_check_target (par, w->watcher_size, - e->ethproto, e->invflags &EBT_IPROTO ); +ntohs (e->ethproto), e->invflags &EBT_IPROTO );if (ret <0 ) {module_put (watcher->me);return ret;
@@ -744,7 +744,7 @@ ebt_check_entry(struct ebt_entry *e, struct net *net, tgpar.target = target; tgpar.targinfo = t->data; ret =xt_check_target (&tgpar, t->target_size, - e->ethproto, e->invflags &EBT_IPROTO ); +ntohs (e->ethproto), e->invflags &EBT_IPROTO );if (ret <0 ) {module_put (target->me); goto cleanup_watchers;
net/netfilter/x_tables.c +2 -2
@@ -461,7 +461,7 @@ int xt_check_proc_name(const char *name, unsigned int size)EXPORT_SYMBOL (xt_check_proc_name);int xt_check_match (struct xt_mtchk_param *par, -unsigned int size,u_int8_t proto,bool inv_proto) +unsigned int size,u16 proto,bool inv_proto) {int ret;
@@ -984,7 +984,7 @@ bool xt_find_jump_offset(const unsigned int *offsets,EXPORT_SYMBOL (xt_find_jump_offset);int xt_check_target (struct xt_tgchk_param *par, -unsigned int size,u_int8_t proto,bool inv_proto) +unsigned int size,u16 proto,bool inv_proto) {int ret;
Signature · 1 line
2.11.0
Pablo Neira Ayuso
maintainerPATCH 22/29 ipvs: get sctphdr by sctphoff in sctp_csum_check
In reply to Pablo Neira AyusoFrom: Xin Long <[email protected]>
sctp_csum_check() is called by sctp_s/dnat_handler() where it calls skb_make_writable() to ensure sctphdr to be linearized.
So there's no need to get sctphdr by calling skb_header_pointer() in sctp_csum_check().
--- net/netfilter/ipvs/ip_vs_proto_sctp.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
net/netfilter/ipvs/ip_vs_proto_sctp.c +2 -5
@@ -186,7 +186,7 @@ static int sctp_csum_check(int af, struct sk_buff *skb, struct ip_vs_protocol *pp) { unsigned int sctphoff; -struct sctphdr *sh, _sctph; +struct sctphdr *sh;__le32 cmp, val;#ifdef CONFIG_IP_VS_IPV6
@@ -196,10 +196,7 @@ sctp_csum_check(int af, struct sk_buff *skb, struct ip_vs_protocol *pp)#endif sctphoff =ip_hdrlen (skb); - sh =skb_header_pointer (skb, sctphoff,sizeof (_sctph), &_sctph); -if (sh ==NULL ) -return 0 ; - + sh = (struct sctphdr *)(skb->data + sctphoff); cmp = sh->checksum; val =sctp_compute_cksum (skb, sctphoff);
Signature · 1 line
2.11.0
Pablo Neira Ayuso
maintainerPATCH 23/29 netfilter: bridge: Don't sabotage nf_hook calls for an l3mdev slave
In reply to Pablo Neira AyusoFrom: David Ahern <[email protected]>
Followup to a173f066c7cf ("netfilter: bridge: Don't sabotage nf_hook calls from an l3mdev"). Some packets (e.g., ndisc) do not have the skb device flipped to the l3mdev (e.g., VRF) device. Update ip_sabotage_in to not drop packets for slave devices too. Currently, neighbor solicitation packets for 'dev -> bridge (addr) -> vrf' setups are getting dropped. This patch enables IPv6 communications for bridges with an address that are enslaved to a VRF.
--- net/bridge/br_netfilter_hooks.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/bridge/br_netfilter_hooks.c +2 -1
@@ -831,7 +831,8 @@ static unsigned int ip_sabotage_in(void *priv,struct nf_bridge_info *nf_bridge =nf_bridge_info_get (skb);if (nf_bridge && !nf_bridge->in_prerouting && - !netif_is_l3_master (skb->dev)) { + !netif_is_l3_master (skb->dev) && + !netif_is_l3_slave (skb->dev)) { state->okfn (state->net, state->sk, skb);return NF_STOLEN ; }
Signature · 1 line
2.11.0
Pablo Neira Ayuso
maintainerPATCH 24/29 netfilter: nf_tables: check the result of dereferencing base_chain->stats
In reply to Pablo Neira AyusoFrom: Li RongQing <[email protected]>
Check the result of dereferencing base_chain->stats, instead of result of this_cpu_ptr with NULL.
base_chain->stats maybe be changed to NULL when a chain is updated and a new NULL counter can be attached.
And we do not need to check returning of this_cpu_ptr since base_chain->stats is from percpu allocator if it is non-NULL, this_cpu_ptr returns a valid value.
And fix two sparse error by replacing rcu_access_pointer and rcu_dereference with READ_ONCE under rcu_read_lock.
Thanks for Eric's help to finish this patch.
--- net/netfilter/nf_tables_core.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
net/netfilter/nf_tables_core.c +8 -6
@@ -98,21 +98,23 @@ static noinline void nft_update_chain_stats(const struct nft_chain *chain, const struct nft_pktinfo *pkt) {struct nft_base_chain *base_chain; +struct nft_stats __percpu *pstats;struct nft_stats *stats; base_chain =nft_base_chain (chain); -if (!rcu_access_pointer (base_chain->stats)) -return ; -local_bh_disable (); - stats =this_cpu_ptr (rcu_dereference (base_chain->stats)); -if (stats) { +rcu_read_lock (); + pstats =READ_ONCE (base_chain->stats); +if (pstats) { +local_bh_disable (); + stats =this_cpu_ptr (pstats);u64_stats_update_begin (&stats->syncp); stats->pkts++; stats->bytes += pkt->skb->len;u64_stats_update_end (&stats->syncp); +local_bh_enable (); } -local_bh_enable (); +rcu_read_unlock (); }struct nft_jumpstack {
Signature · 1 line
2.11.0
Pablo Neira Ayuso
maintainerPATCH 25/29 netfilter: nf_conntrack: ensure that CONNTRACK_LOCKS is power of 2
In reply to Pablo Neira AyusoFrom: Li RongQing <[email protected]>
CONNTRACK_LOCKS is divisor when computer array index, if it is power of 2, compiler will optimize modulo operation as bitwise AND, or else modulo will lower performance.
--- net/netfilter/nf_conntrack_core.c | 1 + 1 file changed, 1 insertion(+)
net/netfilter/nf_conntrack_core.c +1 -0
@@ -2480,6 +2480,7 @@ int nf_conntrack_init_net(struct net *net)int cpu;BUILD_BUG_ON (IP_CT_UNTRACKED ==IP_CT_NUMBER ); +BUILD_BUG_ON_NOT_POWER_OF_2 (CONNTRACK_LOCKS );atomic_set (&net->ct.count,0 ); net->ct.pcpu_lists = alloc_percpu(struct ct_pcpu);
Signature · 1 line
2.11.0
Re: [PATCH 25/29] netfilter: nf_conntrack: ensure that CONNTRACK_LOCKS is power of 2
Hello!
Quoted 3 lines · Pablo Neira Ayuso
From: Li RongQing <[email protected]>
CONNTRACK_LOCKSis divisor when computer array index, if it is power of
Computing?
Quoted 6 lines
2, compiler will optimize modulo operation as bitwise AND, or else modulo will lower performance.
Suggested-by Florian Westphal <[email protected]>Signed-off-by Li RongQing <[email protected]>Signed-off-by Pablo Neira Ayuso <[email protected]>
[...]
MBR, Sergei
Pablo Neira Ayuso
maintainerPATCH 26/29 netfilter: xt_IDLETIMER: fix sysfs callback function type
In reply to Pablo Neira AyusoFrom: Sami Tolvanen <[email protected]>
Use struct device_attribute instead of struct idletimer_tg_attr, and the correct callback function type to avoid indirect call mismatches with Control Flow Integrity checking.
--- net/netfilter/xt_IDLETIMER.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)
net/netfilter/xt_IDLETIMER.c +4 -10
@@ -41,19 +41,13 @@#include <linux/workqueue.h> #include <linux/sysfs.h> -struct idletimer_tg_attr { -struct attribute attr; -ssize_t (*show)(struct kobject *kobj, -struct attribute *attr,char *buf); -}; -struct idletimer_tg {struct list_head entry;struct timer_list timer;struct work_struct work;struct kobject *kobj; -struct idletimer_tg_attr attr; +struct device_attribute attr;unsigned int refcnt; };
@@ -76,15 +70,15 @@ struct idletimer_tg *__idletimer_tg_find_by_label(const char *label)return NULL ; } -static ssize_t idletimer_tg_show (struct kobject *kobj,struct attribute *attr, -char *buf) +static ssize_t idletimer_tg_show (struct device *dev, +struct device_attribute *attr,char *buf) {struct idletimer_tg *timer;unsigned long expires =0 ;mutex_lock (&list_mutex); - timer =__idletimer_tg_find_by_label (attr->name); + timer =__idletimer_tg_find_by_label (attr->attr.name);if (timer) expires = timer->timer.expires;
Signature · 1 line
2.11.0
Pablo Neira Ayuso
maintainerPATCH 27/29 netfilter: nf_tables: nat: merge nft_redir protocol specific modules
In reply to Pablo Neira AyusoFrom: Florian Westphal <[email protected]>
before:
text data bss dec hex filename 990 832 0 1822 71e nft_redir.ko 697 896 0 1593 639 nft_redir_ipv4.ko 713 896 0 1609 649 nft_redir_ipv6.ko
after:
text data bss dec hex filename
1910 960 0 2870 b36 nft_redir.ko
size is reduced, all helpers from nft_redir.ko can be made static.
--- include/net/netfilter/nft_redir.h | 22 ------ net/ipv4/netfilter/Kconfig | 8 -- net/ipv4/netfilter/Makefile | 1 - net/ipv4/netfilter/nft_redir_ipv4.c | 82 ------------------- net/ipv6/netfilter/Kconfig | 8 -- net/ipv6/netfilter/Makefile | 1 - net/ipv6/netfilter/nft_redir_ipv6.c | 83 ------------------- net/netfilter/Kconfig | 1 + net/netfilter/nft_redir.c | 154 +++++++++++++++++++++++++++++++++--- 9 files changed, 143 insertions(+), 217 deletions(-) delete mode 100644 include/net/netfilter/nft_redir.h delete mode 100644 net/ipv4/netfilter/nft_redir_ipv4.c delete mode 100644 net/ipv6/netfilter/nft_redir_ipv6.c
include/net/netfilter/nft_redir.h deleted +0 -22
@@ -1,22 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _NFT_REDIR_H_ -#define _NFT_REDIR_H_ - -struct nft_redir { -enum nft_registers sreg_proto_min:8 ; -enum nft_registers sreg_proto_max:8 ; -u16 flags; -}; - -extern const struct nla_policy nft_redir_policy[]; - -int nft_redir_init (const struct nft_ctx *ctx, -const struct nft_expr *expr, -const struct nlattr *const tb[]); - -int nft_redir_dump (struct sk_buff *skb,const struct nft_expr *expr); - -int nft_redir_validate (const struct nft_ctx *ctx,const struct nft_expr *expr, -const struct nft_data **data); - -#endif /* _NFT_REDIR_H_ */
net/ipv4/netfilter/Kconfig +0 -8
@@ -115,14 +115,6 @@ config NFT_MASQ_IPV4 This is the expression that provides IPv4 masquerading support for nf_tables. -config NFT_REDIR_IPV4 - tristate "IPv4 redirect support for nf_tables" - depends on NF_TABLES_IPV4 - depends on NFT_REDIR - select NF_NAT_REDIRECT - help - This is the expression that provides IPv4 redirect support for - nf_tables. endif # NF_TABLES config NF_NAT_SNMP_BASIC
net/ipv4/netfilter/Makefile +0 -1
@@ -29,7 +29,6 @@ obj-$(CONFIG_NFT_CHAIN_NAT_IPV4) += nft_chain_nat_ipv4.o obj-$(CONFIG_NFT_REJECT_IPV4) += nft_reject_ipv4.o obj-$(CONFIG_NFT_FIB_IPV4) += nft_fib_ipv4.o obj-$(CONFIG_NFT_MASQ_IPV4) += nft_masq_ipv4.o -obj-$(CONFIG_NFT_REDIR_IPV4) += nft_redir_ipv4.o obj-$(CONFIG_NFT_DUP_IPV4) += nft_dup_ipv4.o # flow table support
net/ipv4/netfilter/nft_redir_ipv4.c deleted +0 -82
82 lines not on this page · raw message
net/ipv6/netfilter/Kconfig +0 -8
@@ -49,14 +49,6 @@ config NFT_MASQ_IPV6 This is the expression that provides IPv4 masquerading support for nf_tables. -config NFT_REDIR_IPV6 - tristate "IPv6 redirect support for nf_tables" - depends on NFT_REDIR - select NF_NAT_REDIRECT - help - This is the expression that provides IPv4 redirect support for - nf_tables. - endif # NF_NAT config NFT_REJECT_IPV6
net/ipv6/netfilter/Makefile +0 -1
@@ -31,7 +31,6 @@ obj-$(CONFIG_NFT_CHAIN_ROUTE_IPV6) += nft_chain_route_ipv6.o obj-$(CONFIG_NFT_CHAIN_NAT_IPV6) += nft_chain_nat_ipv6.o obj-$(CONFIG_NFT_REJECT_IPV6) += nft_reject_ipv6.o obj-$(CONFIG_NFT_MASQ_IPV6) += nft_masq_ipv6.o -obj-$(CONFIG_NFT_REDIR_IPV6) += nft_redir_ipv6.o obj-$(CONFIG_NFT_DUP_IPV6) += nft_dup_ipv6.o obj-$(CONFIG_NFT_FIB_IPV6) += nft_fib_ipv6.o
net/ipv6/netfilter/nft_redir_ipv6.c deleted +0 -83
83 lines not on this page · raw message
net/netfilter/Kconfig +1 -0
@@ -541,6 +541,7 @@ config NFT_REDIR depends on NF_CONNTRACK depends on NF_NAT tristate "Netfilter nf_tables redirect support" + select NF_NAT_REDIRECT help This options adds the "redirect" expression that you can use to perform NAT in the redirect flavour.
net/netfilter/nft_redir.c +142 -12
186 lines not on this page · raw message
Signature · 1 line
2.11.0
Pablo Neira Ayuso
maintainerPATCH 28/29 netfilter: nf_tables: nat: merge nft_masq protocol specific modules
In reply to Pablo Neira AyusoFrom: Florian Westphal <[email protected]>
The family specific masq modules are way too small to warrant an extra module, just place all of them in nft_masq.
before:
text data bss dec hex filename
1001 832 0 1833 729 nft_masq.ko
766 896 0 1662 67e nft_masq_ipv4.ko
764 896 0 1660 67c nft_masq_ipv6.koafter:
2010 960 0 2970 b9a nft_masq.ko
--- include/net/netfilter/nft_masq.h | 22 ----- net/ipv4/netfilter/Kconfig | 9 -- net/ipv4/netfilter/Makefile | 1 - net/ipv4/netfilter/nft_masq_ipv4.c | 90 ------------------- net/ipv6/netfilter/Kconfig | 9 -- net/ipv6/netfilter/Makefile | 1 - net/ipv6/netfilter/nft_masq_ipv6.c | 91 ------------------- net/netfilter/Kconfig | 1 + net/netfilter/nft_masq.c | 180 ++++++++++++++++++++++++++++++++++--- 9 files changed, 168 insertions(+), 236 deletions(-) delete mode 100644 include/net/netfilter/nft_masq.h delete mode 100644 net/ipv4/netfilter/nft_masq_ipv4.c delete mode 100644 net/ipv6/netfilter/nft_masq_ipv6.c
include/net/netfilter/nft_masq.h deleted +0 -22
@@ -1,22 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _NFT_MASQ_H_ -#define _NFT_MASQ_H_ - -struct nft_masq { -u32 flags; -enum nft_registers sreg_proto_min:8 ; -enum nft_registers sreg_proto_max:8 ; -}; - -extern const struct nla_policy nft_masq_policy[]; - -int nft_masq_init (const struct nft_ctx *ctx, -const struct nft_expr *expr, -const struct nlattr *const tb[]); - -int nft_masq_dump (struct sk_buff *skb,const struct nft_expr *expr); - -int nft_masq_validate (const struct nft_ctx *ctx,const struct nft_expr *expr, -const struct nft_data **data); - -#endif /* _NFT_MASQ_H_ */
net/ipv4/netfilter/Kconfig +0 -9
@@ -106,15 +106,6 @@ config NFT_CHAIN_NAT_IPV4 packet transformations such as the source, destination address and source and destination ports. -config NFT_MASQ_IPV4 - tristate "IPv4 masquerading support for nf_tables" - depends on NF_TABLES_IPV4 - depends on NFT_MASQ - select NF_NAT_MASQUERADE - help - This is the expression that provides IPv4 masquerading support for - nf_tables. - endif # NF_TABLES config NF_NAT_SNMP_BASIC
net/ipv4/netfilter/Makefile +0 -1
@@ -28,7 +28,6 @@ obj-$(CONFIG_NFT_CHAIN_ROUTE_IPV4) += nft_chain_route_ipv4.o obj-$(CONFIG_NFT_CHAIN_NAT_IPV4) += nft_chain_nat_ipv4.o obj-$(CONFIG_NFT_REJECT_IPV4) += nft_reject_ipv4.o obj-$(CONFIG_NFT_FIB_IPV4) += nft_fib_ipv4.o -obj-$(CONFIG_NFT_MASQ_IPV4) += nft_masq_ipv4.o obj-$(CONFIG_NFT_DUP_IPV4) += nft_dup_ipv4.o # flow table support
net/ipv4/netfilter/nft_masq_ipv4.c deleted +0 -90
90 lines not on this page · raw message
net/ipv6/netfilter/Kconfig +0 -9
@@ -40,15 +40,6 @@ config NFT_CHAIN_NAT_IPV6 chain type is used to perform Network Address Translation (NAT) packet transformations such as the source, destination address and source and destination ports. - -config NFT_MASQ_IPV6 - tristate "IPv6 masquerade support for nf_tables" - depends on NFT_MASQ - select NF_NAT_MASQUERADE - help - This is the expression that provides IPv4 masquerading support for - nf_tables. - endif # NF_NAT config NFT_REJECT_IPV6
net/ipv6/netfilter/Makefile +0 -1
@@ -30,7 +30,6 @@ obj-$(CONFIG_NF_DUP_IPV6) += nf_dup_ipv6.o obj-$(CONFIG_NFT_CHAIN_ROUTE_IPV6) += nft_chain_route_ipv6.o obj-$(CONFIG_NFT_CHAIN_NAT_IPV6) += nft_chain_nat_ipv6.o obj-$(CONFIG_NFT_REJECT_IPV6) += nft_reject_ipv6.o -obj-$(CONFIG_NFT_MASQ_IPV6) += nft_masq_ipv6.o obj-$(CONFIG_NFT_DUP_IPV6) += nft_dup_ipv6.o obj-$(CONFIG_NFT_FIB_IPV6) += nft_fib_ipv6.o
net/ipv6/netfilter/nft_masq_ipv6.c deleted +0 -91
91 lines not on this page · raw message
net/netfilter/Kconfig +1 -0
@@ -532,6 +532,7 @@ config NFT_LIMIT config NFT_MASQ depends on NF_CONNTRACK depends on NF_NAT + select NF_NAT_MASQUERADE tristate "Netfilter nf_tables masquerade support" help This option adds the "masquerade" expression that you can use
net/netfilter/nft_masq.c +167 -13
212 lines not on this page · raw message
Signature · 1 line
2.11.0
Pablo Neira Ayuso
maintainerPATCH 29/29 netfilter: nf_tables: merge ipv4 and ipv6 nat chain types
In reply to Pablo Neira AyusoFrom: Florian Westphal <[email protected]>
Merge the ipv4 and ipv6 nat chain type. This is the last missing piece which allows to provide inet family support for nat in a follow patch.
The kconfig knobs for ipv4/ipv6 nat chain are removed, the nat chain type will be built unconditionally if NFT_NAT expression is enabled.
Before:
text data bss dec hex filename 1576 896 0 2472 9a8 nft_chain_nat_ipv4.ko 1697 896 0 2593 a21 nft_chain_nat_ipv6.ko
After:
text data bss dec hex filename
1832 896 0 2728 aa8 nft_chain_nat.ko
--- net/ipv4/netfilter/Kconfig | 13 ---- net/ipv4/netfilter/Makefile | 1 - net/ipv4/netfilter/nft_chain_nat_ipv4.c | 85 ------------------------- net/ipv6/netfilter/Kconfig | 11 ---- net/ipv6/netfilter/Makefile | 1 - net/ipv6/netfilter/nft_chain_nat_ipv6.c | 83 ------------------------ net/netfilter/Kconfig | 1 + net/netfilter/Makefile | 2 + net/netfilter/nft_chain_nat.c | 108 ++++++++++++++++++++++++++++++++ 9 files changed, 111 insertions(+), 194 deletions(-) delete mode 100644 net/ipv4/netfilter/nft_chain_nat_ipv4.c delete mode 100644 net/ipv6/netfilter/nft_chain_nat_ipv6.c create mode 100644 net/netfilter/nft_chain_nat.c
net/ipv4/netfilter/Kconfig +0 -13
@@ -95,19 +95,6 @@ config NF_REJECT_IPV4 default m if NETFILTER_ADVANCED=n if NF_NAT - -if NF_TABLES -config NFT_CHAIN_NAT_IPV4 - depends on NF_TABLES_IPV4 - tristate "IPv4 nf_tables nat chain support" - help - This option enables the "nat" chain for IPv4 in nf_tables. This - chain type is used to perform Network Address Translation (NAT) - packet transformations such as the source, destination address and - source and destination ports. - -endif # NF_TABLES - config NF_NAT_SNMP_BASIC tristate "Basic SNMP-ALG support" depends on NF_CONNTRACK_SNMP
net/ipv4/netfilter/Makefile +0 -1
@@ -25,7 +25,6 @@ $(obj)/nf_nat_snmp_basic_main.o: $(obj)/nf_nat_snmp_basic.asn1.h obj-$(CONFIG_NF_NAT_SNMP_BASIC) += nf_nat_snmp_basic.o obj-$(CONFIG_NFT_CHAIN_ROUTE_IPV4) += nft_chain_route_ipv4.o -obj-$(CONFIG_NFT_CHAIN_NAT_IPV4) += nft_chain_nat_ipv4.o obj-$(CONFIG_NFT_REJECT_IPV4) += nft_reject_ipv4.o obj-$(CONFIG_NFT_FIB_IPV4) += nft_fib_ipv4.o obj-$(CONFIG_NFT_DUP_IPV4) += nft_dup_ipv4.o
net/ipv4/netfilter/nft_chain_nat_ipv4.c deleted +0 -85
85 lines not on this page · raw message
net/ipv6/netfilter/Kconfig +0 -11
@@ -31,17 +31,6 @@ config NFT_CHAIN_ROUTE_IPV6 fields such as the source, destination, flowlabel, hop-limit and the packet mark. -if NF_NAT - -config NFT_CHAIN_NAT_IPV6 - tristate "IPv6 nf_tables nat chain support" - help - This option enables the "nat" chain for IPv6 in nf_tables. This - chain type is used to perform Network Address Translation (NAT) - packet transformations such as the source, destination address and - source and destination ports. -endif # NF_NAT - config NFT_REJECT_IPV6 select NF_REJECT_IPV6 default NFT_REJECT
net/ipv6/netfilter/Makefile +0 -1
@@ -28,7 +28,6 @@ obj-$(CONFIG_NF_DUP_IPV6) += nf_dup_ipv6.o # nf_tables obj-$(CONFIG_NFT_CHAIN_ROUTE_IPV6) += nft_chain_route_ipv6.o -obj-$(CONFIG_NFT_CHAIN_NAT_IPV6) += nft_chain_nat_ipv6.o obj-$(CONFIG_NFT_REJECT_IPV6) += nft_reject_ipv6.o obj-$(CONFIG_NFT_DUP_IPV6) += nft_dup_ipv6.o obj-$(CONFIG_NFT_FIB_IPV6) += nft_fib_ipv6.o
net/ipv6/netfilter/nft_chain_nat_ipv6.c deleted +0 -83
83 lines not on this page · raw message
net/netfilter/Kconfig +1 -0
@@ -550,6 +550,7 @@ config NFT_REDIR config NFT_NAT depends on NF_CONNTRACK select NF_NAT + depends on NF_TABLES_IPV4 || NF_TABLES_IPV6 tristate "Netfilter nf_tables nat module" help This option adds the "nat" expression that you can use to perform
net/netfilter/Makefile +2 -0
@@ -110,6 +110,8 @@ obj-$(CONFIG_NFT_OSF) += nft_osf.o obj-$(CONFIG_NFT_TPROXY) += nft_tproxy.o obj-$(CONFIG_NFT_XFRM) += nft_xfrm.o +obj-$(CONFIG_NFT_NAT) += nft_chain_nat.o + # nf_tables netdev obj-$(CONFIG_NFT_DUP_NETDEV) += nft_dup_netdev.o obj-$(CONFIG_NFT_FWD_NETDEV) += nft_fwd_netdev.o
net/netfilter/nft_chain_nat.c new file +108 -0
108 lines not on this page · raw message
Signature · 1 line
2.11.0
Re: [PATCH 29/29] netfilter: nf_tables: merge ipv4 and ipv6 nat chain types
Am 02.03.19 um 19:37 schrieb Pablo Neira Ayuso:
Quoted 10 lines
From: Florian Westphal <[email protected]>
Merge the ipv4 and ipv6 nat chain type. This is the last missing piece which allows to provide inet family support for nat in a follow patch.
The kconfig knobs for ipv4/ipv6 nat chain are removed, the nat chain type will be built unconditionally if
NFT_NATexpression is enabled.
Quoted 8 lines
Before:
text data bss dec hex filename 1576 896 0 2472 9a8 nft_chain_nat_ipv4.ko 1697 896 0 2593 a21 nft_chain_nat_ipv6.koAfter:
text data bss dec hex filename
1832 896 0 2728 aa8 nft_chain_nat.ko
there are similar *probably* low hanging fruits with 5.7
"ip6_udp_tunnel" and "nf_defrag_ipv6" are unconditionally loaded even on pure ipv4 setups and the two ipv6 sepcific rehect modules only when ipv6 is in use
3,5K udp_tunnel.ko.xz
2,5K ip6_udp_tunnel.ko.xz
2,4K nf_defrag_ipv4.ko.xz
6,7K nf_defrag_ipv6.ko.xz
2.3K ipt_REJECT.ko.xz
2.3K ip6t_REJECT.ko.xz
3.1K nf_reject_ipv4.ko.xz
4.1K nf_reject_ipv6.ko.x