浏览代码

netfilter: ctnetlink: fix incorrect NAT expectation dumping

nf_ct_expect_alloc leaves unset the expectation NAT fields. However,
ctnetlink_exp_dump_expect expects them to be zeroed in case they are
not used, which may not be the case. This results in dumping the NAT
tuple of the expectation when it should not.

Fix it by zeroing the NAT fields of the expectation.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso 12 年之前
父节点
当前提交
f09eca8db0
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. 5 0
      net/netfilter/nf_conntrack_expect.c

+ 5 - 0
net/netfilter/nf_conntrack_expect.c

@@ -293,6 +293,11 @@ void nf_ct_expect_init(struct nf_conntrack_expect *exp, unsigned int class,
 		       sizeof(exp->tuple.dst.u3) - len);
 		       sizeof(exp->tuple.dst.u3) - len);
 
 
 	exp->tuple.dst.u.all = *dst;
 	exp->tuple.dst.u.all = *dst;
+
+#ifdef CONFIG_NF_NAT_NEEDED
+	memset(&exp->saved_addr, 0, sizeof(exp->saved_addr));
+	memset(&exp->saved_proto, 0, sizeof(exp->saved_proto));
+#endif
 }
 }
 EXPORT_SYMBOL_GPL(nf_ct_expect_init);
 EXPORT_SYMBOL_GPL(nf_ct_expect_init);