From patchwork Mon Apr 18 08:01:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Han Ding X-Patchwork-Id: 1618300 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KhfXb1TdJz9sG2 for ; Mon, 18 Apr 2022 18:01:49 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 346B3415CD; Mon, 18 Apr 2022 08:01:46 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kpOiL2C2ZeM3; Mon, 18 Apr 2022 08:01:45 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTPS id 19414408A4; Mon, 18 Apr 2022 08:01:44 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id EF929C0033; Mon, 18 Apr 2022 08:01:43 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 49377C002C for ; Mon, 18 Apr 2022 08:01:42 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 278F4405D9 for ; Mon, 18 Apr 2022 08:01:42 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GA9bVAi26aIw for ; Mon, 18 Apr 2022 08:01:40 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from chinatelecom.cn (prt-mail.chinatelecom.cn [42.123.76.227]) by smtp2.osuosl.org (Postfix) with ESMTP id 53805400C1 for ; Mon, 18 Apr 2022 08:01:39 +0000 (UTC) HMM_SOURCE_IP: 172.18.0.48:59190.2091825535 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP Received: from clientip-10.133.8.238 (unknown [172.18.0.48]) by chinatelecom.cn (HERMES) with SMTP id AA9E928009D for ; Mon, 18 Apr 2022 16:01:30 +0800 (CST) X-189-SAVE-TO-SEND: handing@chinatelecom.cn Received: from ([172.18.0.48]) by app0024 with ESMTP id 4e0499bd3d2c4ade93bbc2ec6213de18 for dev@openvswitch.org; Mon, 18 Apr 2022 16:01:31 CST X-Transaction-ID: 4e0499bd3d2c4ade93bbc2ec6213de18 X-Real-From: handing@chinatelecom.cn X-Receive-IP: 172.18.0.48 X-MEDUSA-Status: 0 Date: Mon, 18 Apr 2022 16:01:29 +0800 From: handing To: "dev@openvswitch.org" X-Priority: 3 X-GUID: E95594DB-E0E6-445A-9CCE-D16BD630C74F X-Has-Attach: no X-Mailer: Foxmail 7.2.20.269[cn] Mime-Version: 1.0 Message-ID: <202204181601289507739@chinatelecom.cn> X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: [ovs-dev] [PATCH] ovs-save: Get highest ofp version error. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" When setting just one ofp version to protocols of bridge, The function get_highest_ofp_version in ovs-save parse it error. For example: $ ovs-vsctl get bridge br-int protocols [OpenFlow15] $ ovs-vsctl get bridge br-int protocols | sed 's/[][]//g' | sed 's/\ //g' | awk -F ',' '{ print (NF>1)? $(NF) : "OpenFlow14" }' OpenFlow14 Signed-off-by: handing Acked-by: Adrian Moreno --- utilities/ovs-save | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.27.0 handing@chinatelecom.cn diff --git a/utilities/ovs-save b/utilities/ovs-save index fb2025b76..a190902f4 100755 --- a/utilities/ovs-save +++ b/utilities/ovs-save @@ -102,7 +102,7 @@ save_interfaces () { get_highest_ofp_version() { ovs-vsctl get bridge "$1" protocols | \ sed 's/[][]//g' | sed 's/\ //g' | \ - awk -F ',' '{ print (NF>1)? $(NF) : "OpenFlow14" }' + awk -F ',' '{ print (NF>0)? $(NF) : "OpenFlow14" }' } save_flows () {