This config flag was not consistently checked. Fix it.

Signed-off-by: Andy Zhou <az...@ovn.org>
---
 datapath/conntrack.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/datapath/conntrack.c b/datapath/conntrack.c
index 4df73528bf69..413095955b1b 100644
--- a/datapath/conntrack.c
+++ b/datapath/conntrack.c
@@ -139,20 +139,23 @@ static u32 ovs_ct_get_mark(const struct nf_conn *ct)
 #endif
 }
 
+static void ovs_ct_get_labels(const struct nf_conn *ct,
+                             struct ovs_key_ct_labels *labels)
+{
+#if IS_ENABLED(CONFIG_NF_CONNTRACK_LABELS)
 /* Guard against conntrack labels max size shrinking below 128 bits. */
 #if NF_CT_LABELS_MAX_SIZE < 16
 #error NF_CT_LABELS_MAX_SIZE must be at least 16 bytes
 #endif
-
-static void ovs_ct_get_labels(const struct nf_conn *ct,
-                             struct ovs_key_ct_labels *labels)
-{
        struct nf_conn_labels *cl = ct ? nf_ct_labels_find(ct) : NULL;
 
-       if (cl)
+       if (cl) {
                memcpy(labels, cl->bits, OVS_CT_LABELS_LEN);
-       else
-               memset(labels, 0, OVS_CT_LABELS_LEN);
+               return;
+       }
+#endif /* IS_ENABLED(CONFIG_NF_CONNTRACK_LABELS). */
+
+       memset(labels, 0, OVS_CT_LABELS_LEN);
 }
 
 static void __ovs_ct_update_key_orig_tp(struct sw_flow_key *key,
-- 
1.8.3.1

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to