summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2009-01-17 18:03:52 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2009-01-17 18:03:52 +0100
commitd581381870486687586dea4ebf4b7065ae408cd0 (patch)
treebe948723af8f978bf38a03a61a6437bbd1348bd2
parentb1d00262f999a597fa24af3298195db9cf52b790 (diff)
network: do not re-set the message type in nethdr_set* functions
The network headers already contain the message type set. It is not necessary to set it up again. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r--src/network.c10
-rw-r--r--src/sync-ftfw.c5
2 files changed, 6 insertions, 9 deletions
diff --git a/src/network.c b/src/network.c
index 320cdea..7a106b1 100644
--- a/src/network.c
+++ b/src/network.c
@@ -39,31 +39,31 @@ int nethdr_size(int len)
return NETHDR_SIZ + len;
}
-static inline void __nethdr_set(struct nethdr *net, int len, int type)
+static inline void __nethdr_set(struct nethdr *net, int len)
{
if (!seq_set) {
seq_set = 1;
cur_seq = time(NULL);
}
net->version = CONNTRACKD_PROTOCOL_VERSION;
- net->type = type;
net->len = len;
net->seq = cur_seq++;
}
void nethdr_set(struct nethdr *net, int type)
{
- __nethdr_set(net, NETHDR_SIZ, type);
+ __nethdr_set(net, NETHDR_SIZ);
+ net->type = type;
}
void nethdr_set_ack(struct nethdr *net)
{
- __nethdr_set(net, NETHDR_ACK_SIZ, NET_T_CTL);
+ __nethdr_set(net, NETHDR_ACK_SIZ);
}
void nethdr_set_ctl(struct nethdr *net)
{
- __nethdr_set(net, NETHDR_SIZ, NET_T_CTL);
+ __nethdr_set(net, NETHDR_SIZ);
}
static size_t tx_buflenmax;
diff --git a/src/sync-ftfw.c b/src/sync-ftfw.c
index a287ecd..0d49756 100644
--- a/src/sync-ftfw.c
+++ b/src/sync-ftfw.c
@@ -463,11 +463,8 @@ static int tx_queue_xmit(struct queue_node *n, const void *data)
if (IS_ACK(net) || IS_NACK(net) || IS_RESYNC(net)) {
nethdr_set_ack(net);
- } else if (IS_ALIVE(net)) {
- nethdr_set_ctl(net);
} else {
- STATE_SYNC(error).msg_snd_malformed++;
- return 0;
+ nethdr_set_ctl(net);
}
HDR_HOST2NETWORK(net);