diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2008-08-07 14:53:29 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2008-08-07 14:53:29 +0200 |
commit | 8a78dda3e6676286f09f5c78cca60a8178186930 (patch) | |
tree | 8b00a9b242e137c1233579bbe500ae123fd65191 /include/netlink.h | |
parent | 6cb33c62c8007593d8a85aa202fa173043877135 (diff) | |
download | conntrack-tools-8a78dda3e6676286f09f5c78cca60a8178186930.tar.gz conntrack-tools-8a78dda3e6676286f09f5c78cca60a8178186930.zip |
cache iterators: commit master entries before related ones
Commit master entries before related ones to avoid ENOENT errors.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'include/netlink.h')
-rw-r--r-- | include/netlink.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/netlink.h b/include/netlink.h index a7b7dda..6d28ac6 100644 --- a/include/netlink.h +++ b/include/netlink.h @@ -1,6 +1,8 @@ #ifndef _NETLINK_H_ #define _NETLINK_H_ +#include <libnetfilter_conntrack/libnetfilter_conntrack.h> + struct nf_conntrack; struct nfct_handle; @@ -30,4 +32,16 @@ int nl_update_conntrack(struct nf_conntrack *ct); int nl_destroy_conntrack(struct nf_conntrack *ct); +static inline int ct_is_related(const struct nf_conntrack *ct) +{ + return (nfct_attr_is_set(ct, ATTR_MASTER_L3PROTO) && + nfct_attr_is_set(ct, ATTR_MASTER_L4PROTO) && + ((nfct_attr_is_set(ct, ATTR_MASTER_IPV4_SRC) && + nfct_attr_is_set(ct, ATTR_MASTER_IPV4_DST)) || + (nfct_attr_is_set(ct, ATTR_MASTER_IPV6_SRC) && + nfct_attr_is_set(ct, ATTR_MASTER_IPV6_DST))) && + nfct_attr_is_set(ct, ATTR_MASTER_PORT_SRC) && + nfct_attr_is_set(ct, ATTR_MASTER_PORT_DST)); +} + #endif |