diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2009-06-20 21:11:06 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2009-06-20 21:11:06 +0200 |
commit | 4cfc8533743a766db0b2c8ae27b7bba312eb3ec0 (patch) | |
tree | 68c51ca4088b7ae8286d022843e0facd62885fe6 /src | |
parent | faea76e8bc626549f4d338a3bf22e466336264ca (diff) | |
download | conntrack-tools-4cfc8533743a766db0b2c8ae27b7bba312eb3ec0.tar.gz conntrack-tools-4cfc8533743a766db0b2c8ae27b7bba312eb3ec0.zip |
conntrackd: add the name field to queues
This patch adds the name field to identify the queue by means of
a string. This patch is used by the next one that introduces
per-queue statistics.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/queue.c | 5 | ||||
-rw-r--r-- | src/sync-ftfw.c | 2 | ||||
-rw-r--r-- | src/sync-mode.c | 2 |
3 files changed, 6 insertions, 3 deletions
diff --git a/src/queue.c b/src/queue.c index 7b36dc6..e5dc307 100644 --- a/src/queue.c +++ b/src/queue.c @@ -23,7 +23,8 @@ #include <stdlib.h> #include <string.h> -struct queue *queue_create(int max_objects, unsigned int flags) +struct queue * +queue_create(const char *name, int max_objects, unsigned int flags) { struct queue *b; @@ -42,6 +43,8 @@ struct queue *queue_create(int max_objects, unsigned int flags) return NULL; } } + strncpy(b->name, name, QUEUE_NAMELEN); + b->name[QUEUE_NAMELEN-1]='\0'; return b; } diff --git a/src/sync-ftfw.c b/src/sync-ftfw.c index e7c9af2..bf9f4f7 100644 --- a/src/sync-ftfw.c +++ b/src/sync-ftfw.c @@ -143,7 +143,7 @@ static void do_alive_alarm(struct alarm_block *a, void *data) static int ftfw_init(void) { - rs_queue = queue_create(CONFIG(resend_queue_size), 0); + rs_queue = queue_create("rsqueue", CONFIG(resend_queue_size), 0); if (rs_queue == NULL) { dlog(LOG_ERR, "cannot create rs queue"); return -1; diff --git a/src/sync-mode.c b/src/sync-mode.c index dca6eee..308c08b 100644 --- a/src/sync-mode.c +++ b/src/sync-mode.c @@ -289,7 +289,7 @@ static int init_sync(void) if (register_fd(nlif_fd(STATE_SYNC(interface)), STATE(fds)) == -1) return -1; - STATE_SYNC(tx_queue) = queue_create(INT_MAX, QUEUE_F_EVFD); + STATE_SYNC(tx_queue) = queue_create("txqueue", INT_MAX, QUEUE_F_EVFD); if (STATE_SYNC(tx_queue) == NULL) { dlog(LOG_ERR, "cannot create tx queue"); return -1; |