aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Josefsson <gandalf@wlug.westbo.se>2007-01-04 12:16:54 -0800
committerDavid S. Miller <davem@davemloft.net>2007-01-04 12:16:54 -0800
commitbbdc176a2f39913063aaaf95bc27e4b18fd14953 (patch)
tree99089b7efc4c5c76d7afdc07f82537b9c525a799
parentc9386cfddc11e331fa7c860cccaedc2ae8f459f8 (diff)
[NETFILTER]: nf_nat: fix MASQUERADE crash on device down
Check the return value of nfct_nat() in device_cmp(), we might very well have non NAT conntrack entries as well (Netfilter bugzilla #528). Signed-off-by: Martin Josefsson <gandalf@wlug.westbo.se> Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/ipv4/netfilter/ipt_MASQUERADE.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/net/ipv4/netfilter/ipt_MASQUERADE.c b/net/ipv4/netfilter/ipt_MASQUERADE.c
index 28b9233956b..d669685afd0 100644
--- a/net/ipv4/netfilter/ipt_MASQUERADE.c
+++ b/net/ipv4/netfilter/ipt_MASQUERADE.c
@@ -127,10 +127,13 @@ masquerade_target(struct sk_buff **pskb,
static inline int
device_cmp(struct ip_conntrack *i, void *ifindex)
{
+ int ret;
#ifdef CONFIG_NF_NAT_NEEDED
struct nf_conn_nat *nat = nfct_nat(i);
+
+ if (!nat)
+ return 0;
#endif
- int ret;
read_lock_bh(&masq_lock);
#ifdef CONFIG_NF_NAT_NEEDED