diff mbox

[ovs-dev,v2] config: Define OVS_CT_EVENT_* mask macros.

Message ID 1493426767-33651-1-git-send-email-jarno@ovn.org
State Accepted
Headers show

Commit Message

Jarno Rajahalme April 29, 2017, 12:46 a.m. UTC
Unconditionally define OVS_CT_EVENT_* macros for the datapath netlink
interface so that we do not need to include platform dependent files.
This fixes the build on non-Linux (and non-Windows) platforms.

Also define a macro for the default set of events set by OVS userspace.

Reported-by: Joe Stringer <joe@ovn.org>
Signed-off-by: Jarno Rajahalme <jarno@ovn.org>
---
 build-aux/extract-odp-netlink-h | 19 +++++++++++++++++--
 ofproto/ofproto-dpif-xlate.c    |  4 +---
 2 files changed, 18 insertions(+), 5 deletions(-)

Comments

Joe Stringer April 29, 2017, 12:56 a.m. UTC | #1
On 28 April 2017 at 17:46, Jarno Rajahalme <jarno@ovn.org> wrote:
> Unconditionally define OVS_CT_EVENT_* macros for the datapath netlink
> interface so that we do not need to include platform dependent files.
> This fixes the build on non-Linux (and non-Windows) platforms.
>
> Also define a macro for the default set of events set by OVS userspace.
>
> Reported-by: Joe Stringer <joe@ovn.org>
> Signed-off-by: Jarno Rajahalme <jarno@ovn.org>
> ---

Thanks, this approach looks more robust, and it fixes the current
breakage on travis:
https://travis-ci.org/joestringer/openvswitch/builds/227028848

Acked-by: Joe Stringer <joe@ovn.org>
Jarno Rajahalme April 29, 2017, 1:16 a.m. UTC | #2
> On Apr 28, 2017, at 5:56 PM, Joe Stringer <joe@ovn.org> wrote:
> 
> On 28 April 2017 at 17:46, Jarno Rajahalme <jarno@ovn.org> wrote:
>> Unconditionally define OVS_CT_EVENT_* macros for the datapath netlink
>> interface so that we do not need to include platform dependent files.
>> This fixes the build on non-Linux (and non-Windows) platforms.
>> 
>> Also define a macro for the default set of events set by OVS userspace.
>> 
>> Reported-by: Joe Stringer <joe@ovn.org>
>> Signed-off-by: Jarno Rajahalme <jarno@ovn.org>
>> ---
> 
> Thanks, this approach looks more robust, and it fixes the current
> breakage on travis:
> https://travis-ci.org/joestringer/openvswitch/builds/227028848
> 
> Acked-by: Joe Stringer <joe@ovn.org>

Thanks, pushed to master,

  Jarno
diff mbox

Patch

diff --git a/build-aux/extract-odp-netlink-h b/build-aux/extract-odp-netlink-h
index 7fb6ce8..a509adb 100755
--- a/build-aux/extract-odp-netlink-h
+++ b/build-aux/extract-odp-netlink-h
@@ -19,9 +19,24 @@  $i\
 #ifdef _WIN32\
 #include "OvsDpInterfaceExt.h"\
 #include "OvsDpInterfaceCtExt.h"\
-#else\
-#include "linux/netfilter/nf_conntrack_common.h"\
 #endif\
+\
+/* IPCT_* enums may not be defined in all platforms, so do not use them. */\
+#define OVS_CT_EVENT_NEW	(1 << 0)   /* 1 << IPCT_NEW */\
+#define OVS_CT_EVENT_RELATED	(1 << 1)   /* 1 << IPCT_RELATED */\
+#define OVS_CT_EVENT_DESTROY	(1 << 2)   /* 1 << IPCT_DESTROY */\
+#define OVS_CT_EVENT_REPLY	(1 << 3)   /* 1 << IPCT_REPLY */\
+#define OVS_CT_EVENT_ASSURED	(1 << 4)   /* 1 << IPCT_ASSURED */\
+#define OVS_CT_EVENT_PROTOINFO	(1 << 5)   /* 1 << IPCT_PROTOINFO */\
+#define OVS_CT_EVENT_HELPER	(1 << 6)   /* 1 << IPCT_HELPER */\
+#define OVS_CT_EVENT_MARK	(1 << 7)   /* 1 << IPCT_MARK */\
+#define OVS_CT_EVENT_SEQADJ	(1 << 8)   /* 1 << IPCT_SEQADJ */\
+#define OVS_CT_EVENT_SECMARK	(1 << 9)   /* 1 << IPCT_SECMARK */\
+#define OVS_CT_EVENT_LABEL	(1 << 10)  /* 1 << IPCT_LABEL */\
+\
+#define OVS_CT_EVENTMASK_DEFAULT \\\
+  (OVS_CT_EVENT_NEW | OVS_CT_EVENT_RELATED | OVS_CT_EVENT_DESTROY |\\\
+   OVS_CT_EVENT_MARK | OVS_CT_EVENT_LABEL)\
 
 # Use OVS's own struct eth_addr instead of a 6-byte char array.
 s,<linux/types\.h>,"openvswitch/types.h"\
diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index 32cb022..16dae15 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -5363,9 +5363,7 @@  compose_conntrack_action(struct xlate_ctx *ctx, struct ofpact_conntrack *ofc)
                         OVS_CT_ATTR_FORCE_COMMIT : OVS_CT_ATTR_COMMIT);
         if (ctx->xbridge->support.ct_eventmask) {
             nl_msg_put_u32(ctx->odp_actions, OVS_CT_ATTR_EVENTMASK,
-                           1 << IPCT_NEW | 1 << IPCT_RELATED |
-                           1 << IPCT_DESTROY | 1 << IPCT_MARK |
-                           1 << IPCT_LABEL);
+                           OVS_CT_EVENTMASK_DEFAULT);
         }
     }
     nl_msg_put_u16(ctx->odp_actions, OVS_CT_ATTR_ZONE, zone);