diff options
author | /C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org </C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org> | 2007-06-04 17:02:36 +0000 |
---|---|---|
committer | /C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org </C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org> | 2007-06-04 17:02:36 +0000 |
commit | 96e24fbed8e9e45c82e500eb4d34293696dced23 (patch) | |
tree | 535a10994c792fd7944e4fce99c23dbc9384fda2 /src/conntrack.c | |
parent | cea33148e4ccf108f587e5796c026600aba35ab1 (diff) | |
download | conntrack-tools-96e24fbed8e9e45c82e500eb4d34293696dced23.tar.gz conntrack-tools-96e24fbed8e9e45c82e500eb4d34293696dced23.zip |
o use NFCT_SOPT_SETUP_* facilities: nfct_setobjopt
o remove bogus option to get a conntrack in test.sh example file
Diffstat (limited to 'src/conntrack.c')
-rw-r--r-- | src/conntrack.c | 110 |
1 files changed, 8 insertions, 102 deletions
diff --git a/src/conntrack.c b/src/conntrack.c index 18baf96..2555f2e 100644 --- a/src/conntrack.c +++ b/src/conntrack.c @@ -1024,57 +1024,10 @@ int main(int argc, char *argv[]) break; case CT_CREATE: - if ((options & CT_OPT_ORIG) - && !(options & CT_OPT_REPL)) { - nfct_set_attr_u8(obj, - ATTR_REPL_L3PROTO, - nfct_get_attr_u8(obj, - ATTR_ORIG_L3PROTO)); - if (family == AF_INET) { - nfct_set_attr_u32(obj, - ATTR_REPL_IPV4_SRC, - nfct_get_attr_u32(obj, - ATTR_ORIG_IPV4_DST)); - nfct_set_attr_u32(obj, - ATTR_REPL_IPV4_DST, - nfct_get_attr_u32(obj, - ATTR_ORIG_IPV4_SRC)); - } else if (family == AF_INET6) { - nfct_set_attr(obj, - ATTR_REPL_IPV6_SRC, - nfct_get_attr(obj, - ATTR_ORIG_IPV6_DST)); - nfct_set_attr(obj, - ATTR_REPL_IPV6_DST, - nfct_get_attr(obj, - ATTR_ORIG_IPV6_SRC)); - } - } else if (!(options & CT_OPT_ORIG) - && (options & CT_OPT_REPL)) { - nfct_set_attr_u8(obj, - ATTR_ORIG_L3PROTO, - nfct_get_attr_u8(obj, - ATTR_REPL_L3PROTO)); - if (family == AF_INET) { - nfct_set_attr_u32(obj, - ATTR_ORIG_IPV4_SRC, - nfct_get_attr_u32(obj, - ATTR_REPL_IPV4_DST)); - nfct_set_attr_u32(obj, - ATTR_ORIG_IPV4_DST, - nfct_get_attr_u32(obj, - ATTR_REPL_IPV4_SRC)); - } else if (family == AF_INET6) { - nfct_set_attr(obj, - ATTR_ORIG_IPV6_SRC, - nfct_get_attr(obj, - ATTR_REPL_IPV6_DST)); - nfct_set_attr(obj, - ATTR_ORIG_IPV6_DST, - nfct_get_attr(obj, - ATTR_REPL_IPV6_SRC)); - } - } + if ((options & CT_OPT_ORIG) && !(options & CT_OPT_REPL)) + nfct_setobjopt(obj, NFCT_SOPT_SETUP_REPLY); + else if (!(options & CT_OPT_ORIG) && (options & CT_OPT_REPL)) + nfct_setobjopt(obj, NFCT_SOPT_SETUP_ORIGINAL); cth = nfct_open(CONNTRACK, 0); if (!cth) @@ -1098,57 +1051,10 @@ int main(int argc, char *argv[]) break; case CT_UPDATE: - if ((options & CT_OPT_ORIG) - && !(options & CT_OPT_REPL)) { - nfct_set_attr_u8(obj, - ATTR_REPL_L3PROTO, - nfct_get_attr_u8(obj, - ATTR_ORIG_L3PROTO)); - if (family == AF_INET) { - nfct_set_attr_u32(obj, - ATTR_REPL_IPV4_SRC, - nfct_get_attr_u32(obj, - ATTR_ORIG_IPV4_DST)); - nfct_set_attr_u32(obj, - ATTR_REPL_IPV4_DST, - nfct_get_attr_u32(obj, - ATTR_ORIG_IPV4_SRC)); - } else if (family == AF_INET6) { - nfct_set_attr(obj, - ATTR_REPL_IPV6_SRC, - nfct_get_attr(obj, - ATTR_ORIG_IPV6_DST)); - nfct_set_attr(obj, - ATTR_REPL_IPV6_DST, - nfct_get_attr(obj, - ATTR_ORIG_IPV6_SRC)); - } - } else if (!(options & CT_OPT_ORIG) - && (options & CT_OPT_REPL)) { - nfct_set_attr_u8(obj, - ATTR_ORIG_L3PROTO, - nfct_get_attr_u8(obj, - ATTR_REPL_L3PROTO)); - if (family == AF_INET) { - nfct_set_attr_u32(obj, - ATTR_ORIG_IPV4_SRC, - nfct_get_attr_u32(obj, - ATTR_REPL_IPV4_DST)); - nfct_set_attr_u32(obj, - ATTR_ORIG_IPV4_DST, - nfct_get_attr_u32(obj, - ATTR_REPL_IPV4_SRC)); - } else if (family == AF_INET6) { - nfct_set_attr(obj, - ATTR_ORIG_IPV6_SRC, - nfct_get_attr(obj, - ATTR_REPL_IPV6_DST)); - nfct_set_attr(obj, - ATTR_ORIG_IPV6_DST, - nfct_get_attr(obj, - ATTR_REPL_IPV6_SRC)); - } - } + if ((options & CT_OPT_ORIG) && !(options & CT_OPT_REPL)) + nfct_setobjopt(obj, NFCT_SOPT_SETUP_REPLY); + else if (!(options & CT_OPT_ORIG) && (options & CT_OPT_REPL)) + nfct_setobjopt(obj, NFCT_SOPT_SETUP_ORIGINAL); cth = nfct_open(CONNTRACK, 0); if (!cth) |