aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorMartin Josefsson <gandalf@wlug.westbo.se>2007-01-04 15:16:54 -0500
committerDavid S. Miller <davem@davemloft.net>2007-01-04 15:16:54 -0500
commitbbdc176a2f39913063aaaf95bc27e4b18fd14953 (patch)
tree99089b7efc4c5c76d7afdc07f82537b9c525a799 /net
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>
Diffstat (limited to '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 28b9233956b5..d669685afd04 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,
127static inline int 127static inline int
128device_cmp(struct ip_conntrack *i, void *ifindex) 128device_cmp(struct ip_conntrack *i, void *ifindex)
129{ 129{
130 int ret;
130#ifdef CONFIG_NF_NAT_NEEDED 131#ifdef CONFIG_NF_NAT_NEEDED
131 struct nf_conn_nat *nat = nfct_nat(i); 132 struct nf_conn_nat *nat = nfct_nat(i);
133
134 if (!nat)
135 return 0;
132#endif 136#endif
133 int ret;
134 137
135 read_lock_bh(&masq_lock); 138 read_lock_bh(&masq_lock);
136#ifdef CONFIG_NF_NAT_NEEDED 139#ifdef CONFIG_NF_NAT_NEEDED