[ovs-dev] [PATCH] ovn: Use constants for conntrack state bits.

Joe Stringer joe at ovn.org
Fri Dec 11 21:29:10 UTC 2015


On 10 December 2015 at 09:12, Russell Bryant <russell at ovn.org> wrote:
> 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 at ovn.org>
> Requested-by: Joe Stringer <joe at ovn.org>

Thanks, minor comment below.

>  lib/packets.h          | 25 +++++++++++++++++--------
>  ovn/controller/lflow.c | 22 +++++++++++++++-------
>  2 files changed, 32 insertions(+), 15 deletions(-)
>
> diff --git a/lib/packets.h b/lib/packets.h
> index edf140b..c50e316 100644
> --- a/lib/packets.h
> +++ b/lib/packets.h
> @@ -733,14 +733,23 @@ 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
> +#define CS_NEW_BIT           0
> +#define CS_ESTABLISHED_BIT   1
> +#define CS_RELATED_BIT       2
> +#define CS_REPLY_DIR_BIT     3
> +#define CS_INVALID_BIT       4
> +#define CS_TRACKED_BIT       5
> +#define CS_SRC_NAT_BIT       6
> +#define CS_DST_NAT_BIT       7

Would these be appropriate to be an enum instead?

Minor style thing, so:
Acked-by: Joe Stringer <joe at ovn.org>



More information about the dev mailing list