From patchwork Thu Mar 9 01:17:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarno Rajahalme X-Patchwork-Id: 736809 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vdsw12Q8xz9sNS for ; Thu, 9 Mar 2017 12:18:09 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 0D568CAC; Thu, 9 Mar 2017 01:18:06 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 8B461BDA for ; Thu, 9 Mar 2017 01:18:04 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id E2EF6147 for ; Thu, 9 Mar 2017 01:18:03 +0000 (UTC) Received: from mfilter16-d.gandi.net (mfilter16-d.gandi.net [217.70.178.144]) by relay5-d.mail.gandi.net (Postfix) with ESMTP id ADD1E41C08A; Thu, 9 Mar 2017 02:18:02 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mfilter16-d.gandi.net Received: from relay5-d.mail.gandi.net ([IPv6:::ffff:217.70.183.197]) by mfilter16-d.gandi.net (mfilter16-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id fgbfxJXKNp7P; Thu, 9 Mar 2017 02:18:01 +0100 (CET) X-Originating-IP: 208.91.1.34 Received: from sc9-mailhost2.vmware.com (unknown [208.91.1.34]) (Authenticated sender: jarno@ovn.org) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 749B741C080; Thu, 9 Mar 2017 02:18:00 +0100 (CET) From: Jarno Rajahalme To: dev@openvswitch.org Date: Wed, 8 Mar 2017 17:17:50 -0800 Message-Id: <1489022270-116348-1-git-send-email-jarno@ovn.org> X-Mailer: git-send-email 2.1.4 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH] lib: Indicate if netlink message had labels. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.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. Signed-off-by: Jarno Rajahalme Acked-by: Joe Stringer --- lib/ct-dpif.h | 1 + lib/netlink-conntrack.c | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/ct-dpif.h b/lib/ct-dpif.h index 5da3c2c..e8e159a 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 aab5b1f..8b82db2 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]))); }