From patchwork Fri Feb 16 22:54:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 874693 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) 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 3zjpRR4syHz9t1t for ; Sat, 17 Feb 2018 09:56:35 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 929D710E6; Fri, 16 Feb 2018 22:54:59 +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 99CDE1051 for ; Fri, 16 Feb 2018 22:54:57 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 2694E124 for ; Fri, 16 Feb 2018 22:54:57 +0000 (UTC) X-Originating-IP: 208.91.3.26 Received: from sigabrt.benpfaff.org (unknown [208.91.3.26]) (Authenticated sender: blp@ovn.org) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 0862617209C; Fri, 16 Feb 2018 23:54:54 +0100 (CET) From: Ben Pfaff To: dev@openvswitch.org Date: Fri, 16 Feb 2018 14:54:43 -0800 Message-Id: <20180216225445.28688-4-blp@ovn.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180216225445.28688-1-blp@ovn.org> References: <20180216225445.28688-1-blp@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 smtp1.linux-foundation.org Cc: Ben Pfaff Subject: [ovs-dev] [PATCH 4/6] ofp-flow: Move parse_ofp_flow_mod_str() into correct file. 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 This function was left behind by accident in the patch that split up ofp-parse. Signed-off-by: Ben Pfaff Acked-by: Justin Pettit --- lib/ofp-flow.c | 30 ++++++++++++++++++++++++++++++ lib/ofp-parse.c | 30 ------------------------------ 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/lib/ofp-flow.c b/lib/ofp-flow.c index af6be74909e6..10d6825991f6 100644 --- a/lib/ofp-flow.c +++ b/lib/ofp-flow.c @@ -1377,6 +1377,36 @@ parse_ofp_str(struct ofputil_flow_mod *fm, int command, const char *str_, return error; } +/* Parses 'string' as an OFPT_FLOW_MOD or NXT_FLOW_MOD with command 'command' + * (one of OFPFC_*) into 'fm'. + * + * If 'command' is given as -2, 'string' may begin with a command name ("add", + * "modify", "delete", "modify_strict", or "delete_strict"). A missing command + * name is treated as "add". + * + * Returns NULL if successful, otherwise a malloc()'d string describing the + * error. The caller is responsible for freeing the returned string. */ +char * OVS_WARN_UNUSED_RESULT +parse_ofp_flow_mod_str(struct ofputil_flow_mod *fm, const char *string, + const struct ofputil_port_map *port_map, + const struct ofputil_table_map *table_map, + int command, + enum ofputil_protocol *usable_protocols) +{ + char *error = parse_ofp_str(fm, command, string, port_map, table_map, + usable_protocols); + + if (!error) { + /* Normalize a copy of the match. This ensures that non-normalized + * flows get logged but doesn't affect what gets sent to the switch, so + * that the switch can do whatever it likes with the flow. */ + struct match match_copy = fm->match; + ofputil_normalize_match(&match_copy); + } + + return error; +} + /* Opens file 'file_name' and reads each line as a flow_mod of the specified * type (one of OFPFC_*). Stores each flow_mod in '*fm', an array allocated * on the caller's behalf, and the number of flow_mods in '*n_fms'. diff --git a/lib/ofp-parse.c b/lib/ofp-parse.c index 3e8b553f9e1b..9fbfe76639f0 100644 --- a/lib/ofp-parse.c +++ b/lib/ofp-parse.c @@ -248,36 +248,6 @@ ofp_extract_actions(char *s) return NULL; } } - -/* Parses 'string' as an OFPT_FLOW_MOD or NXT_FLOW_MOD with command 'command' - * (one of OFPFC_*) into 'fm'. - * - * If 'command' is given as -2, 'string' may begin with a command name ("add", - * "modify", "delete", "modify_strict", or "delete_strict"). A missing command - * name is treated as "add". - * - * Returns NULL if successful, otherwise a malloc()'d string describing the - * error. The caller is responsible for freeing the returned string. */ -char * OVS_WARN_UNUSED_RESULT -parse_ofp_flow_mod_str(struct ofputil_flow_mod *fm, const char *string, - const struct ofputil_port_map *port_map, - const struct ofputil_table_map *table_map, - int command, - enum ofputil_protocol *usable_protocols) -{ - char *error = parse_ofp_str(fm, command, string, port_map, table_map, - usable_protocols); - - if (!error) { - /* Normalize a copy of the match. This ensures that non-normalized - * flows get logged but doesn't affect what gets sent to the switch, so - * that the switch can do whatever it likes with the flow. */ - struct match match_copy = fm->match; - ofputil_normalize_match(&match_copy); - } - - return error; -} static size_t parse_value(const char *s, const char *delimiters)