From patchwork Wed Apr 19 00:10:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Stringer X-Patchwork-Id: 752057 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 3w72fr0sZ3z9s2P for ; Wed, 19 Apr 2017 10:18:59 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 37E7CC34; Wed, 19 Apr 2017 00:10:35 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp2.linuxfoundation.org (smtp2.linux-foundation.org [172.17.192.36]) by mail.linuxfoundation.org (Postfix) with ESMTPS id CE00CC3B for ; Wed, 19 Apr 2017 00:10:30 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by smtp2.linuxfoundation.org (Postfix) with ESMTPS id 4DE3D1DABE for ; Wed, 19 Apr 2017 00:10:30 +0000 (UTC) Received: from mfilter21-d.gandi.net (mfilter21-d.gandi.net [217.70.178.149]) by relay2-d.mail.gandi.net (Postfix) with ESMTP id BE5D8C5A54; Wed, 19 Apr 2017 02:10:28 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mfilter21-d.gandi.net Received: from relay2-d.mail.gandi.net ([IPv6:::ffff:217.70.183.194]) by mfilter21-d.gandi.net (mfilter21-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id jmqJf4K8qY1A; Wed, 19 Apr 2017 02:10:27 +0200 (CEST) X-Originating-IP: 208.91.1.34 Received: from carno.eng.vmware.com (unknown [208.91.1.34]) (Authenticated sender: joe@ovn.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 69F9EC5A5F; Wed, 19 Apr 2017 02:10:26 +0200 (CEST) From: Joe Stringer To: dev@openvswitch.org Date: Tue, 18 Apr 2017 17:10:02 -0700 Message-Id: <20170419001002.4353-15-joe@ovn.org> X-Mailer: git-send-email 2.11.1 In-Reply-To: <20170419001002.4353-1-joe@ovn.org> References: <20170419001002.4353-1-joe@ovn.org> 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 smtp2.linux-foundation.org Subject: [ovs-dev] [PATCH branch-2.7 14/14] nx-match: Fix oxm decode. 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 From: Yi-Hung Wei decode_nx_packet_in2() may be used by the switch to parse NXT_RESUME messages, where we need exact match on the oxm header. Therefore, change oxm_decode_loose() to oxm_decode() that takes an extra argument to indicate whether we want strict or loose match. Fixes: 5a18e1055b88 ("ofp-util: Ignore unknown fields in ofputil_decode_packet_in2().") Signed-off-by: Yi-Hung Wei Signed-off-by: Joe Stringer --- lib/nx-match.c | 10 +++++----- lib/nx-match.h | 4 ++-- lib/ofp-util.c | 5 ++--- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/lib/nx-match.c b/lib/nx-match.c index 2e62e99c0098..43672cb4becf 100644 --- a/lib/nx-match.c +++ b/lib/nx-match.c @@ -683,14 +683,14 @@ oxm_pull_match_loose(struct ofpbuf *b, const struct tun_table *tun_table, * * Returns 0 if successful, otherwise an OpenFlow error code. * - * Encountering unknown OXM headers or missing field prerequisites are not - * considered as error conditions. + * If 'loose' is true, encountering unknown OXM headers or missing field + * prerequisites are not considered as error conditions. */ enum ofperr -oxm_decode_match_loose(const void *oxm, size_t oxm_len, - const struct tun_table *tun_table, struct match *match) +oxm_decode_match(const void *oxm, size_t oxm_len, bool loose, + const struct tun_table *tun_table, struct match *match) { - return nx_pull_raw(oxm, oxm_len, false, match, NULL, NULL, tun_table); + return nx_pull_raw(oxm, oxm_len, !loose, match, NULL, NULL, tun_table); } /* Verify an array of OXM TLVs treating value of each TLV as a mask, diff --git a/lib/nx-match.h b/lib/nx-match.h index cee9e65e84b9..e103dd5fa74d 100644 --- a/lib/nx-match.h +++ b/lib/nx-match.h @@ -61,8 +61,8 @@ enum ofperr oxm_pull_match(struct ofpbuf *, const struct tun_table *, struct match *); enum ofperr oxm_pull_match_loose(struct ofpbuf *, const struct tun_table *, struct match *); -enum ofperr oxm_decode_match_loose(const void *, size_t, - const struct tun_table *, struct match *); +enum ofperr oxm_decode_match(const void *, size_t, bool, + const struct tun_table *, struct match *); enum ofperr oxm_pull_field_array(const void *, size_t fields_len, struct field_array *); diff --git a/lib/ofp-util.c b/lib/ofp-util.c index 9e8d4d25f114..d3153370f2e6 100644 --- a/lib/ofp-util.c +++ b/lib/ofp-util.c @@ -3397,9 +3397,8 @@ decode_nx_packet_in2(const struct ofp_header *oh, bool loose, } case NXPINT_METADATA: - error = oxm_decode_match_loose(payload.msg, - ofpbuf_msgsize(&payload), - tun_table, &pin->flow_metadata); + error = oxm_decode_match(payload.msg, ofpbuf_msgsize(&payload), + loose, tun_table, &pin->flow_metadata); break; case NXPINT_USERDATA: