summaryrefslogtreecommitdiff
path: root/src/sync-ftfw.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2011-11-16 02:10:31 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2012-01-10 01:54:45 +0100
commit75a7cd3c722e1abca14fc375bec8ab30c34ab284 (patch)
tree34b33b726bbba606ec77b98340331e026ce781a3 /src/sync-ftfw.c
parent79ab299bfb20b7fc1982ca90d77d8b908b824fea (diff)
downloadconntrack-tools-75a7cd3c722e1abca14fc375bec8ab30c34ab284.tar.gz
conntrack-tools-75a7cd3c722e1abca14fc375bec8ab30c34ab284.zip
conntrackd: remove cache_data_get_object and replace by direct pointer
We now include one pointer to the object in the extra section. This is required to generalize this code for the expectation support. We consume 4-8 bytes extra, but we will not need more changes to support expectations which is a good idea.
Diffstat (limited to 'src/sync-ftfw.c')
-rw-r--r--src/sync-ftfw.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/sync-ftfw.c b/src/sync-ftfw.c
index c7cc4aa..fa76c0c 100644
--- a/src/sync-ftfw.c
+++ b/src/sync-ftfw.c
@@ -55,12 +55,14 @@ static int say_hello_back;
struct cache_ftfw {
struct queue_node qnode;
+ struct cache_object *obj;
uint32_t seq;
};
static void cache_ftfw_add(struct cache_object *obj, void *data)
{
struct cache_ftfw *cn = data;
+ cn->obj = obj;
/* These nodes are not inserted in the list */
queue_node_init(&cn->qnode, Q_ELEM_OBJ);
}
@@ -302,13 +304,11 @@ static int rs_queue_empty(struct queue_node *n, const void *data)
}
case Q_ELEM_OBJ: {
struct cache_ftfw *cn;
- struct cache_object *obj;
cn = (struct cache_ftfw *) n;
if (h == NULL) {
queue_del(n);
- obj = cache_data_get_object(STATE(mode)->internal->ct.data, cn);
- cache_object_put(obj);
+ cache_object_put(cn->obj);
return 0;
}
if (before(cn->seq, h->from))
@@ -318,8 +318,7 @@ static int rs_queue_empty(struct queue_node *n, const void *data)
dp("queue: deleting from queue (seq=%u)\n", cn->seq);
queue_del(n);
- obj = cache_data_get_object(STATE(mode)->internal->ct.data, cn);
- cache_object_put(obj);
+ cache_object_put(cn->obj);
break;
}
}
@@ -465,11 +464,9 @@ static void rs_queue_purge_full(void)
}
case Q_ELEM_OBJ: {
struct cache_ftfw *cn;
- struct cache_object *obj;
cn = (struct cache_ftfw *)n;
- obj = cache_data_get_object(STATE(mode)->internal->ct.data, cn);
- cache_object_put(obj);
+ cache_object_put(cn->obj);
break;
}
}
@@ -511,14 +508,12 @@ static int tx_queue_xmit(struct queue_node *n, const void *data)
}
case Q_ELEM_OBJ: {
struct cache_ftfw *cn;
- struct cache_object *obj;
int type;
struct nethdr *net;
cn = (struct cache_ftfw *)n;
- obj = cache_data_get_object(STATE(mode)->internal->ct.data, cn);
- type = object_status_to_network_type(obj);
- net = obj->cache->ops->build_msg(obj, type);
+ type = object_status_to_network_type(cn->obj);
+ net = cn->obj->cache->ops->build_msg(cn->obj, type);
nethdr_set_hello(net);
dp("tx_list sq: %u fl:%u len:%u\n",