Skip to content

Commit 9a08ecf

Browse files
Florian Westphalummakynes
authored andcommitted
netfilter: don't attach a nat extension by default
nowadays the NAT extension only stores the interface index (used to purge connections that got masqueraded when interface goes down) and pptp nat information. Previous patches moved nf_ct_nat_ext_add to those places that need it. Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
1 parent 2fe7c32 commit 9a08ecf

4 files changed

Lines changed: 3 additions & 13 deletions

File tree

‎include/net/netfilter/nf_nat.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ static inline bool nf_nat_oif_changed(unsigned int hooknum,
6767
{
6868
#if IS_ENABLED(CONFIG_NF_NAT_MASQUERADE_IPV4) || \
6969
IS_ENABLED(CONFIG_NF_NAT_MASQUERADE_IPV6)
70-
return nat->masq_index && hooknum == NF_INET_POST_ROUTING &&
70+
return nat && nat->masq_index && hooknum == NF_INET_POST_ROUTING &&
7171
CTINFO2DIR(ctinfo) == IP_CT_DIR_ORIGINAL &&
7272
nat->masq_index != out->ifindex;
7373
#else

‎net/ipv4/netfilter/nf_nat_l3proto_ipv4.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,7 @@ nf_nat_ipv4_fn(void *priv, struct sk_buff *skb,
264264
if (!ct)
265265
return NF_ACCEPT;
266266

267-
nat = nf_ct_nat_ext_add(ct);
268-
if (nat == NULL)
269-
return NF_ACCEPT;
267+
nat = nfct_nat(ct);
270268

271269
switch (ctinfo) {
272270
case IP_CT_RELATED:

‎net/ipv6/netfilter/nf_nat_l3proto_ipv6.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,9 +273,7 @@ nf_nat_ipv6_fn(void *priv, struct sk_buff *skb,
273273
if (!ct)
274274
return NF_ACCEPT;
275275

276-
nat = nf_ct_nat_ext_add(ct);
277-
if (nat == NULL)
278-
return NF_ACCEPT;
276+
nat = nfct_nat(ct);
279277

280278
switch (ctinfo) {
281279
case IP_CT_RELATED:

‎net/netfilter/nf_nat_core.c‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -408,12 +408,6 @@ nf_nat_setup_info(struct nf_conn *ct,
408408
enum nf_nat_manip_type maniptype)
409409
{
410410
struct nf_conntrack_tuple curr_tuple, new_tuple;
411-
struct nf_conn_nat *nat;
412-
413-
/* nat helper or nfctnetlink also setup binding */
414-
nat = nf_ct_nat_ext_add(ct);
415-
if (nat == NULL)
416-
return NF_ACCEPT;
417411

418412
NF_CT_ASSERT(maniptype == NF_NAT_MANIP_SRC ||
419413
maniptype == NF_NAT_MANIP_DST);

0 commit comments

Comments
 (0)