diff mbox

[ovs-dev,branch-2.7,07/14] lib: Indicate if netlink message had labels.

Message ID 20170419001002.4353-8-joe@ovn.org
State Rejected
Headers show

Commit Message

Joe Stringer April 19, 2017, 12:09 a.m. UTC
From: Jarno Rajahalme <jarno@ovn.org>

Conntrack update events include labels only if they have changed.
Record the presence of labels in the netlink message to OVS internal
representation, so that the user may keep the old labels when an
update does not modify them.

Fixes: 6830a0c0e6bf ("netlink-conntrack: New module.")
Signed-off-by: Jarno Rajahalme <jarno@ovn.org>
Acked-by: Joe Stringer <joe@ovn.org>
---
 lib/ct-dpif.h           | 1 +
 lib/netlink-conntrack.c | 1 +
 2 files changed, 2 insertions(+)

Comments

Joe Stringer April 19, 2017, 9:19 p.m. UTC | #1
On 18 April 2017 at 17:09, Joe Stringer <joe@ovn.org> wrote:
> From: Jarno Rajahalme <jarno@ovn.org>
>
> Conntrack update events include labels only if they have changed.
> Record the presence of labels in the netlink message to OVS internal
> representation, so that the user may keep the old labels when an
> update does not modify them.
>
> Fixes: 6830a0c0e6bf ("netlink-conntrack: New module.")
> Signed-off-by: Jarno Rajahalme <jarno@ovn.org>
> Acked-by: Joe Stringer <joe@ovn.org>
> ---

I opted to drop this library change from the backport.
diff mbox

Patch

diff --git a/lib/ct-dpif.h b/lib/ct-dpif.h
index 5da3c2c8e3d1..e8e159a75f3a 100644
--- a/lib/ct-dpif.h
+++ b/lib/ct-dpif.h
@@ -163,6 +163,7 @@  struct ct_dpif_entry {
     struct ct_dpif_protoinfo protoinfo;
 
     ovs_u128 labels;
+    bool have_labels;
     uint32_t status;
     /* Timeout for this entry in seconds */
     uint32_t timeout;
diff --git a/lib/netlink-conntrack.c b/lib/netlink-conntrack.c
index 2aadb1e16f75..f0e2aeac8e62 100644
--- a/lib/netlink-conntrack.c
+++ b/lib/netlink-conntrack.c
@@ -780,6 +780,7 @@  nl_ct_attrs_to_ct_dpif_entry(struct ct_dpif_entry *entry,
         entry->mark = ntohl(nl_attr_get_be32(attrs[CTA_MARK]));
     }
     if (attrs[CTA_LABELS]) {
+        entry->have_labels = true;
         memcpy(&entry->labels, nl_attr_get(attrs[CTA_LABELS]),
                MIN(sizeof entry->labels, nl_attr_get_size(attrs[CTA_LABELS])));
     }