diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2008-12-13 17:24:47 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2008-12-13 17:24:47 +0100 |
commit | 08f59121eb907802d490601f5e54dcd0fbc1d695 (patch) | |
tree | dcad67050eb09c141feb1429362be02cb1bcd71d /src/sync-ftfw.c | |
parent | 74455dae1d095178b09ea3f1b1e8b005076e7a94 (diff) | |
download | conntrack-tools-08f59121eb907802d490601f5e54dcd0fbc1d695.tar.gz conntrack-tools-08f59121eb907802d490601f5e54dcd0fbc1d695.zip |
ftfw: shrink alive message size
This patch reduces the size of alive messages by removing the
"from" and "to" fields which are not of any help. This patch also
removes the IS_CTL() macro since it does not return true for
the control messages anymore but only for IS_ACK(), IS_NACK() and
IS_RESYNC().
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/sync-ftfw.c')
-rw-r--r-- | src/sync-ftfw.c | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/src/sync-ftfw.c b/src/sync-ftfw.c index 014cebd..4758710 100644 --- a/src/sync-ftfw.c +++ b/src/sync-ftfw.c @@ -121,6 +121,31 @@ static void tx_queue_add_ctlmsg(uint32_t flags, uint32_t from, uint32_t to) write_evfd(STATE_SYNC(evfd)); } +static void tx_queue_add_ctlmsg2(uint32_t flags) +{ + struct nethdr ctl = { + .type = NET_T_CTL, + .flags = flags, + }; + + switch(hello_state) { + case HELLO_INIT: + hello_state = HELLO_SAY; + /* fall through */ + case HELLO_SAY: + ctl.flags |= NET_F_HELLO; + break; + } + + if (say_hello_back) { + ctl.flags |= NET_F_HELLO_BACK; + say_hello_back = 0; + } + + queue_add(tx_queue, &ctl, NETHDR_SIZ); + write_evfd(STATE_SYNC(evfd)); +} + /* this function is called from the alarm framework */ static void do_alive_alarm(struct alarm_block *a, void *data) { @@ -131,7 +156,7 @@ static void do_alive_alarm(struct alarm_block *a, void *data) STATE_SYNC(last_seq_recv)); ack_from_set = 0; } else - tx_queue_add_ctlmsg(NET_F_ALIVE, 0, 0); + tx_queue_add_ctlmsg2(NET_F_ALIVE); } static int ftfw_init(void) @@ -491,7 +516,14 @@ static int tx_queue_xmit(void *data1, const void *data2) { struct nethdr *net = data1; - nethdr_set_ack(net); + if (IS_ACK(net) || IS_NACK(net) || IS_RESYNC(net)) { + nethdr_set_ack(net); + } else if (IS_ALIVE(net)) { + nethdr_set_ctl(net); + } else { + dlog(LOG_ERR, "sending unknown control message?"); + return 0; + } HDR_HOST2NETWORK(net); dp("tx_queue sq: %u fl:%u len:%u\n", |