summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2008-11-02 21:29:04 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2008-11-02 21:29:04 +0100
commit64ce47955778805afceb6ced58b63839763541ad (patch)
treebf67f80a47e7d46d3d8649f4a6e8b73a9e53d599 /include
parent43694a92f5521537109f14ec5fb9c8f4b2a821f6 (diff)
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 'include')
-rw-r--r--include/network.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/include/network.h b/include/network.h
index d2e4edd..d2431f9 100644
--- a/include/network.h
+++ b/include/network.h
@@ -4,10 +4,13 @@
#include <stdint.h>
#include <sys/types.h>
+#define CONNTRACKD_PROTOCOL_VERSION 0
+
struct nf_conntrack;
struct nethdr {
- uint16_t flags;
+ uint8_t version;
+ uint8_t flags;
uint16_t len;
uint32_t seq;
};
@@ -17,7 +20,8 @@ struct nethdr {
(struct netpld *)(((char *)x) + sizeof(struct nethdr))
struct nethdr_ack {
- uint16_t flags;
+ uint8_t version;
+ uint8_t flags;
uint16_t len;
uint32_t seq;
uint32_t from;
@@ -87,7 +91,6 @@ ssize_t mcast_buffered_pending_netmsg(struct mcast_sock *m);
#define HDR_NETWORK2HOST(x) \
({ \
- x->flags = ntohs(x->flags); \
x->len = ntohs(x->len); \
x->seq = ntohl(x->seq); \
if (IS_CTL(x)) { \
@@ -104,7 +107,6 @@ ssize_t mcast_buffered_pending_netmsg(struct mcast_sock *m);
__ack->from = htonl(__ack->from); \
__ack->to = htonl(__ack->to); \
} \
- x->flags = htons(x->flags); \
x->len = htons(x->len); \
x->seq = htonl(x->seq); \
})