From 6c0096535ea7900c190d8456eeb2307a26776141 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Thu, 1 Jul 2010 16:22:52 +0200 Subject: conntrack: fix `conntrack --src-nat 1.1.1.1' if PAT applied This patch fixes another scenario in which the flow has some PAT mangling and we passed the src-nat address that we want to use to perform the filtering. Signed-off-by: Pablo Neira Ayuso --- src/conntrack.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/conntrack.c b/src/conntrack.c index af6adf2..93844c5 100644 --- a/src/conntrack.c +++ b/src/conntrack.c @@ -894,9 +894,9 @@ filter_nat(const struct nf_conntrack *obj, const struct nf_conntrack *ct) port == nfct_get_attr_u16(ct, ATTR_REPL_PORT_DST)) has_srcnat = 1; } - if (!check_address && nfct_getobjopt(ct, NFCT_GOPT_IS_SNAT)) - has_srcnat = 1; - if (!check_port && nfct_getobjopt(ct, NFCT_GOPT_IS_SPAT)) + if (!check_address && !check_port && + (nfct_getobjopt(ct, NFCT_GOPT_IS_SNAT) || + nfct_getobjopt(ct, NFCT_GOPT_IS_SPAT))) has_srcnat = 1; } if (check_dstnat) { @@ -916,9 +916,9 @@ filter_nat(const struct nf_conntrack *obj, const struct nf_conntrack *ct) port == nfct_get_attr_u16(ct, ATTR_REPL_PORT_SRC)) has_dstnat = 1; } - if (!check_address && nfct_getobjopt(ct, NFCT_GOPT_IS_DNAT)) - has_dstnat = 1; - if (!check_port && nfct_getobjopt(ct, NFCT_GOPT_IS_DPAT)) + if (!check_address && !check_port && + (nfct_getobjopt(ct, NFCT_GOPT_IS_DNAT) || + nfct_getobjopt(ct, NFCT_GOPT_IS_DPAT))) has_dstnat = 1; } if (options & CT_OPT_ANY_NAT) -- cgit v1.2.3