diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2010-06-17 10:36:05 -0700 |
---|---|---|
committer | Mohit Mehta <mohit.mehta@vyatta.com> | 2010-06-17 10:36:05 -0700 |
commit | f3a946f895ae3b3ab13d666acdbbe8f15099eb87 (patch) | |
tree | 973a6d98aa2993e486908b7fe7c509791c6718a0 | |
parent | fd9fddfe8d1835b42880d860a725b5394401b445 (diff) | |
download | conntrack-tools-f3a946f895ae3b3ab13d666acdbbe8f15099eb87.tar.gz conntrack-tools-f3a946f895ae3b3ab13d666acdbbe8f15099eb87.zip |
conntrack: fix `conntrack -L -n -g` (second try)
-rw-r--r-- | src/conntrack.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/conntrack.c b/src/conntrack.c index eec3868..706fe50 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 (options & (CT_OPT_SRC_NAT | CT_OPT_DST_NAT)) ? 1 : 0; } static int counter; |