summaryrefslogtreecommitdiff
path: root/lib/packets.h
diff options
context:
space:
mode:
authorRussell Bryant <russell@ovn.org>2015-12-14 12:54:45 -0500
committerRussell Bryant <russell@ovn.org>2015-12-15 14:48:57 -0500
commitaa68cf38e14d159ae3fef061765d7986b7376f6e (patch)
tree525d2e8c3091f2104e943608515f8ac22723d376 /lib/packets.h
parent9bf924c859478dd6ccb8c6cbc0302b81fb89f9ee (diff)
downloadopenvswitch-aa68cf38e14d159ae3fef061765d7986b7376f6e.tar.gz
ovn: Use constants for conntrack state bits.
A previous commit fixed this code to match changes to the conntrack state bit assignments. This patch further updates the code to use the defined constants to ensure this code adapts automatically to any possible future changes. Signed-off-by: Russell Bryant <russell@ovn.org> Requested-by: Joe Stringer <joe@ovn.org> Acked-by: Joe Stringer <joe@ovn.org>
Diffstat (limited to 'lib/packets.h')
-rw-r--r--lib/packets.h29
1 files changed, 21 insertions, 8 deletions
diff --git a/lib/packets.h b/lib/packets.h
index edf140b9e..36bd759bb 100644
--- a/lib/packets.h
+++ b/lib/packets.h
@@ -733,14 +733,27 @@ struct tcp_header {
BUILD_ASSERT_DECL(TCP_HEADER_LEN == sizeof(struct tcp_header));
/* Connection states */
-#define CS_NEW 0x01
-#define CS_ESTABLISHED 0x02
-#define CS_RELATED 0x04
-#define CS_REPLY_DIR 0x08
-#define CS_INVALID 0x10
-#define CS_TRACKED 0x20
-#define CS_SRC_NAT 0x40
-#define CS_DST_NAT 0x80
+enum {
+ CS_NEW_BIT = 0,
+ CS_ESTABLISHED_BIT = 1,
+ CS_RELATED_BIT = 2,
+ CS_REPLY_DIR_BIT = 3,
+ CS_INVALID_BIT = 4,
+ CS_TRACKED_BIT = 5,
+ CS_SRC_NAT_BIT = 6,
+ CS_DST_NAT_BIT = 7,
+};
+
+enum {
+ CS_NEW = (1 << CS_NEW_BIT),
+ CS_ESTABLISHED = (1 << CS_ESTABLISHED_BIT),
+ CS_RELATED = (1 << CS_RELATED_BIT),
+ CS_REPLY_DIR = (1 << CS_REPLY_DIR_BIT),
+ CS_INVALID = (1 << CS_INVALID_BIT),
+ CS_TRACKED = (1 << CS_TRACKED_BIT),
+ CS_SRC_NAT = (1 << CS_SRC_NAT_BIT),
+ CS_DST_NAT = (1 << CS_DST_NAT_BIT),
+};
/* Undefined connection state bits. */
#define CS_SUPPORTED_MASK (CS_NEW | CS_ESTABLISHED | CS_RELATED \