diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2008-11-02 21:29:04 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2008-11-02 21:29:04 +0100 |
commit | 64ce47955778805afceb6ced58b63839763541ad (patch) | |
tree | bf67f80a47e7d46d3d8649f4a6e8b73a9e53d599 /src/sync-mode.c | |
parent | 43694a92f5521537109f14ec5fb9c8f4b2a821f6 (diff) | |
download | conntrack-tools-64ce47955778805afceb6ced58b63839763541ad.tar.gz conntrack-tools-64ce47955778805afceb6ced58b63839763541ad.zip |
network: add protocol version field (breaks backward compatibility)
This patch adds the version field (8-bits long) to the nethdr
structure. This fields can be used to indicate the protocol version
in case that we detect an incompatibility between two conntrackd
daemons working with different protocol versions.
Unfortunately, this patch breaks backward compatibility, ie.
conntrackd <= 0.9.8 protocol is not compatible with the upcoming
conntrackd >= 0.9.9. Better do this now than later.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/sync-mode.c')
-rw-r--r-- | src/sync-mode.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/sync-mode.c b/src/sync-mode.c index 4c22745..152a8e2 100644 --- a/src/sync-mode.c +++ b/src/sync-mode.c @@ -41,6 +41,12 @@ static void do_mcast_handler_step(struct nethdr *net, size_t remain) struct nf_conntrack *ct = (struct nf_conntrack *)(void*) __ct; struct us_conntrack *u; + if (net->version != CONNTRACKD_PROTOCOL_VERSION) { + STATE(malformed)++; + dlog(LOG_WARNING, "wrong protocol version `%u'", net->version); + return; + } + switch (STATE_SYNC(sync)->recv(net)) { case MSG_DATA: break; @@ -144,7 +150,7 @@ static void mcast_handler(void) } debug("recv sq: %u fl:%u len:%u (rem:%d)\n", - ntohl(net->seq), ntohs(net->flags), + ntohl(net->seq), net->flags, ntohs(net->len), remain); HDR_NETWORK2HOST(net); |