From 64ce47955778805afceb6ced58b63839763541ad Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Sun, 2 Nov 2008 21:29:04 +0100 Subject: 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 --- include/network.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'include/network.h') 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 #include +#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); \ }) -- cgit v1.2.3