diff options
author | Philip Craig <philipc@snapgear.com> | 2007-09-18 01:52:59 (GMT) |
---|---|---|
committer | Thomas Graf <tgraf@suug.ch> | 2007-09-18 10:37:49 (GMT) |
commit | cbe8902265ccc9f6aa6453aeb3a2a4631ed0eb01 (patch) | |
tree | bce908c48f7a1b3a4993e76a8a4bcd785b16816e /lib | |
parent | 104e158bd578bceacf37ba24dd1a1a907fc53d05 (diff) | |
download | libnl-cbe8902265ccc9f6aa6453aeb3a2a4631ed0eb01.zip libnl-cbe8902265ccc9f6aa6453aeb3a2a4631ed0eb01.tar.gz libnl-cbe8902265ccc9f6aa6453aeb3a2a4631ed0eb01.tar.bz2 |
Allow filtering by name for conntrack status flags
Diffstat (limited to 'lib')
-rw-r--r-- | lib/netfilter/ct_obj.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/netfilter/ct_obj.c b/lib/netfilter/ct_obj.c index 81baade..0f5a79e 100644 --- a/lib/netfilter/ct_obj.c +++ b/lib/netfilter/ct_obj.c @@ -204,7 +204,6 @@ static int ct_compare(struct nl_object *_a, struct nl_object *_b, diff |= CT_DIFF_VAL(FAMILY, ct_family); diff |= CT_DIFF_VAL(PROTO, ct_proto); diff |= CT_DIFF_VAL(TCP_STATE, ct_protoinfo.tcp.state); - diff |= CT_DIFF_VAL(STATUS, ct_status); diff |= CT_DIFF_VAL(TIMEOUT, ct_timeout); diff |= CT_DIFF_VAL(MARK, ct_mark); diff |= CT_DIFF_VAL(USE, ct_use); @@ -228,6 +227,12 @@ static int ct_compare(struct nl_object *_a, struct nl_object *_b, diff |= CT_DIFF_VAL(REPL_PACKETS, ct_repl.packets); diff |= CT_DIFF_VAL(REPL_BYTES, ct_repl.bytes); + if (flags & LOOSE_FLAG_COMPARISON) + diff |= CT_DIFF(STATUS, (a->ct_status ^ b->ct_status) & + b->ct_status_mask); + else + diff |= CT_DIFF(STATUS, a->ct_status != b->ct_status); + #undef CT_DIFF #undef CT_DIFF_VAL #undef CT_DIFF_ADDR @@ -367,13 +372,16 @@ int nfnl_ct_str2tcp_state(const char *name) void nfnl_ct_set_status(struct nfnl_ct *ct, uint32_t status) { - ct->ct_status = status; + ct->ct_status_mask |= status; + ct->ct_status |= status; ct->ce_mask |= CT_ATTR_STATUS; } -int nfnl_ct_test_status(const struct nfnl_ct *ct) +void nfnl_ct_unset_status(struct nfnl_ct *ct, uint32_t status) { - return !!(ct->ce_mask & CT_ATTR_STATUS); + ct->ct_status_mask |= status; + ct->ct_status &= ~status; + ct->ce_mask |= CT_ATTR_STATUS; } uint32_t nfnl_ct_get_status(const struct nfnl_ct *ct) |