summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2010-06-15 09:56:16 -0700
committerMohit Mehta <mohit.mehta@vyatta.com>2010-06-15 09:56:16 -0700
commitb4d4591734726a7b38a579acf272022caf5a0534 (patch)
treeb90c28304bd2fd7670ae9168f0f7e206b2b28de2 /src
parenteb86746ce29c321a8a8f16b951e894a3eaa4c5a9 (diff)
downloadconntrack-tools-b4d4591734726a7b38a579acf272022caf5a0534.tar.gz
conntrack-tools-b4d4591734726a7b38a579acf272022caf5a0534.zip
fix `conntrack -L --src-nat --dst-nat`
Diffstat (limited to 'src')
-rw-r--r--src/conntrack.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/conntrack.c b/src/conntrack.c
index eec3868..7d413c7 100644
--- a/src/conntrack.c
+++ b/src/conntrack.c
@@ -635,27 +635,23 @@ filter_nat(const struct nf_conntrack *obj, const struct nf_conntrack *ct)
uint32_t ip;
if (options & CT_OPT_SRC_NAT) {
- if (!nfct_getobjopt(ct, NFCT_GOPT_IS_SNAT))
- return 1;
-
if (nfct_attr_is_set(obj, ATTR_SNAT_IPV4)) {
ip = nfct_get_attr_u32(obj, ATTR_SNAT_IPV4);
- if (ip != nfct_get_attr_u32(ct, ATTR_REPL_IPV4_DST))
- return 1;
- }
+ if (ip == nfct_get_attr_u32(ct, ATTR_REPL_IPV4_DST))
+ return 0;
+ } else if (nfct_getobjopt(ct, NFCT_GOPT_IS_SNAT))
+ return 0;
}
if (options & CT_OPT_DST_NAT) {
- if (!nfct_getobjopt(ct, NFCT_GOPT_IS_DNAT))
- return 1;
-
if (nfct_attr_is_set(obj, ATTR_DNAT_IPV4)) {
ip = nfct_get_attr_u32(obj, ATTR_DNAT_IPV4);
- if (ip != nfct_get_attr_u32(ct, ATTR_REPL_IPV4_SRC))
- return 1;
- }
+ if (ip == nfct_get_attr_u32(ct, ATTR_REPL_IPV4_SRC))
+ return 0;
+ } else if (nfct_getobjopt(ct, NFCT_GOPT_IS_DNAT))
+ return 0;
}
- return 0;
+ return 1;
}
static int counter;