diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2011-02-17 18:33:22 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2011-02-17 18:33:22 +0100 |
commit | 9f53603a10aa738d6f5a41a061bc3e1182c42d0c (patch) | |
tree | 0940d6bb8d5d203052496c484b92b883be72ee17 /src/conntrack/api.c | |
parent | 3e6806e7690d0ed79d9aed82dc44d1eaa676d3e8 (diff) |
conntrack: add NFCT_CP_OVERRIDE flag for nfct_copy()
Thus, we have a fast version of nfct_copy() which allows to
copy the destination to the origin. After this call, the
destination is a clone of the origin.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/conntrack/api.c')
-rw-r--r-- | src/conntrack/api.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/conntrack/api.c b/src/conntrack/api.c index 2262974..a35c670 100644 --- a/src/conntrack/api.c +++ b/src/conntrack/api.c @@ -1099,6 +1099,9 @@ int nfct_cmp(const struct nf_conntrack *ct1, * and 4 protocol number. * - NFCT_CP_META: that copies the metainformation * (all the attributes >= ATTR_TCP_STATE) + * - NFCT_CP_OVERRIDE: changes the default behaviour of nfct_copy() since + * it overrides the destination object. After the copy, the destination + * is a clone of the origin. This flag provides faster copying. */ void nfct_copy(struct nf_conntrack *ct1, const struct nf_conntrack *ct2, @@ -1109,6 +1112,10 @@ void nfct_copy(struct nf_conntrack *ct1, assert(ct1 != NULL); assert(ct2 != NULL); + if (flags & NFCT_CP_OVERRIDE) { + __copy_fast(ct1, ct2); + return; + } if (flags == NFCT_CP_ALL) { for (i=0; i<ATTR_MAX; i++) { if (test_bit(i, ct2->set)) { |