Skip to contentSkip to conversation

netfilter: nf_nat: don't bug when mapping already exists

PATCH Applied Florian Westphal 2 participants 2 messages Aug 31, 2017 – Sep 8, 2017

Subsystems (2)
lore
Share & tools
lore

Florian Westphal

author maintainer
#0 lore raw

PATCH 1/1 netfilter: nf_nat: don't bug when mapping already exists

It seems preferrable to limp along if we have a conflicting mapping, its certainly better than a BUG().

---
This can be triggered with nfqueue and bridge netfilter. So far we found no good way to fix this problem (bridge netfilter violates conntrack assumption wrt. ownership of ct by single cpu).

net/netfilter/nf_nat_core.c +2 -1
index b1d3740ae36a..c1587e8427ef 100644
@@ -416,7 +416,8 @@ nf_nat_setup_info(struct nf_conn *ct,
 
 	NF_CT_ASSERT(maniptype == NF_NAT_MANIP_SRC ||
 		     maniptype == NF_NAT_MANIP_DST);
-	BUG_ON(nf_nat_initialized(ct, maniptype));
+	if (WARN_ON(nf_nat_initialized(ct, maniptype)))
+		return NF_DROP;
 
 	/* What we've got will look like inverse of reply. Normally
 	 * this is what is in the conntrack, except for prior
Signature · 1 line
2.13.0
maintainer Applied
#1 lore raw
Quoted 2 lines · Florian Westphal

It seems preferrable to limp along if we have a conflicting mapping, its certainly better than a BUG().

Applied, thanks.