From patchwork Thu Oct 15 21:28:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarno Rajahalme X-Patchwork-Id: 530916 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (li376-54.members.linode.com [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id A9AD914012C for ; Fri, 16 Oct 2015 08:28:32 +1100 (AEDT) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id A2C1610B27; Thu, 15 Oct 2015 14:28:30 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx3v1.cudamail.com (mx3.cudamail.com [64.34.241.5]) by archives.nicira.com (Postfix) with ESMTPS id B9C0610B21 for ; Thu, 15 Oct 2015 14:28:27 -0700 (PDT) Received: from bar3.cudamail.com (bar1 [192.168.15.1]) by mx3v1.cudamail.com (Postfix) with ESMTP id 21A69618103 for ; Thu, 15 Oct 2015 15:28:27 -0600 (MDT) X-ASG-Debug-ID: 1444944506-03dd7b105e2b2a0001-byXFYA Received: from mx3-pf3.cudamail.com ([192.168.14.3]) by bar3.cudamail.com with ESMTP id JSRACizVu1u05ga7 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 15 Oct 2015 15:28:26 -0600 (MDT) X-Barracuda-Envelope-From: jrajahalme@nicira.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.14.3 Received: from unknown (HELO mail-lf0-f49.google.com) (209.85.215.49) by mx3-pf3.cudamail.com with ESMTPS (RC4-SHA encrypted); 15 Oct 2015 21:28:24 -0000 Received-SPF: unknown (mx3-pf3.cudamail.com: Multiple SPF records returned) X-Barracuda-Apparent-Source-IP: 209.85.215.49 X-Barracuda-RBL-IP: 209.85.215.49 Received: by lfaz124 with SMTP id z124so49809108lfa.1 for ; Thu, 15 Oct 2015 14:28:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=C4+tGvHKoCJQqQ69V+fJeLAheyIAkGLmioN9+DucCIk=; b=a656oWvnG+8NFb4Orm50VtatTdi7OV3q1Ik2iua4P8wkgoaBSK/kQCes8oytO2Xcd1 AHzCaPkNeac5fjDMTiG0qy1b4XPrstuytR9XdHgWhe+r2+Ejoa1/pWo9jOZyUkmn7ed7 CRSM3X1KMcZjg3kHv+0jVdAjW2kvxbJMIORr9Zx8gRl4f4hsZEjyXvGbiUp9Rp0iFpVf k/wonNJ+pL1p0dz8IzuzDCHRpuGFhln9J8J5VAJPOjqKbROXohOSnkFi8U9NUPjuRyvy 3PQhK3/MM5BnvxDtXPfHiyus4jQKPNU6Sh1QEm9ysSFZDX6f/YhlSd5Qf5EZgwwoG1uj fICA== X-Gm-Message-State: ALoCoQnshUGC7S3K0RwujtKP0M4jWGJT7pbPTERoClVAtXssDb5Sd9iY+QDTO2sFNUvtbO1u92NO X-Received: by 10.180.9.74 with SMTP id x10mr851183wia.61.1444944503840; Thu, 15 Oct 2015 14:28:23 -0700 (PDT) Received: from sc9-mailhost1.vmware.com ([208.91.1.34]) by smtp.gmail.com with ESMTPSA id gt4sm629339wib.21.2015.10.15.14.28.22 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 15 Oct 2015 14:28:23 -0700 (PDT) X-CudaMail-Envelope-Sender: jrajahalme@nicira.com From: Jarno Rajahalme To: dev@openvswitch.org X-CudaMail-Whitelist-To: dev@openvswitch.org X-CudaMail-MID: CM-V3-1014070389 X-CudaMail-DTE: 101515 X-CudaMail-Originating-IP: 209.85.215.49 Date: Thu, 15 Oct 2015 14:28:02 -0700 X-ASG-Orig-Subj: [##CM-V3-1014070389##][PATCH 2/4] ovs-ofctl: Fix OpenFlow versions with '--bundle' Message-Id: <1444944484-117214-2-git-send-email-jrajahalme@nicira.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1444944484-117214-1-git-send-email-jrajahalme@nicira.com> References: <1444944484-117214-1-git-send-email-jrajahalme@nicira.com> X-Barracuda-Connect: UNKNOWN[192.168.14.3] X-Barracuda-Start-Time: 1444944506 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-ASG-Whitelist: Header =?UTF-8?B?eFwtY3VkYW1haWxcLXdoaXRlbGlzdFwtdG8=?= X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 Subject: [ovs-dev] [PATCH 2/4] ovs-ofctl: Fix OpenFlow versions with '--bundle' X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dev-bounces@openvswitch.org Sender: "dev" While the presence of the '--bundle' option implicitly added the OpenFlow 1.4 to the allowed protocols, it failed to remove OpenFlow 1.0 from the allowed protocols. This is changed so that '--bundle' option now also implicitly removes versions lesser than 1.4 from the allowed protocols. This has no behavioral difference when ovs-ofctl is paired with OVS that supports OpenFlow 1.4, as the greatest common version is negotiated, but prevents negotiation of OpenFlow 1.0 when OVS does not support OpenFlow 1.4. Found by inspection. Signed-off-by: Jarno Rajahalme Acked-by: YAMAMOTO Takashi --- tests/ofproto.at | 12 ++++++------ tests/ovs-ofctl.at | 8 ++++---- utilities/ovs-ofctl.c | 3 +++ 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/tests/ofproto.at b/tests/ofproto.at index 5e4441c..4c6dd29 100644 --- a/tests/ofproto.at +++ b/tests/ofproto.at @@ -3962,8 +3962,8 @@ vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY: vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5): version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 vconn|DBG|unix: received: OFPT_HELLO (OF1.4): - version bitmap: 0x01, 0x05 -vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 and earlier, peer supports versions 0x01, 0x05) + version bitmap: 0x05 +vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 and earlier, peer supports version 0x05) vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4): bundle_id=0 type=OPEN_REQUEST flags=atomic ordered vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4): @@ -4014,8 +4014,8 @@ vconn|DBG|unix: sent (Success): NXST_FLOW reply: vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5): version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 vconn|DBG|unix: received: OFPT_HELLO (OF1.4): - version bitmap: 0x01, 0x05 -vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 and earlier, peer supports versions 0x01, 0x05) + version bitmap: 0x05 +vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 and earlier, peer supports version 0x05) vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4): bundle_id=0 type=OPEN_REQUEST flags=atomic ordered vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4): @@ -4045,8 +4045,8 @@ vconn|DBG|unix: sent (Success): NXST_FLOW reply: vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5): version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 vconn|DBG|unix: received: OFPT_HELLO (OF1.4): - version bitmap: 0x01, 0x05 -vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 and earlier, peer supports versions 0x01, 0x05) + version bitmap: 0x05 +vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 and earlier, peer supports version 0x05) vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4): bundle_id=0 type=OPEN_REQUEST flags=atomic ordered vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4): diff --git a/tests/ovs-ofctl.at b/tests/ovs-ofctl.at index 6f03adb..7375cad 100644 --- a/tests/ovs-ofctl.at +++ b/tests/ovs-ofctl.at @@ -2889,8 +2889,8 @@ AT_CHECK([print_vconn_debug | vconn_windows_sub | ofctl_strip], [0], [dnl vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5): version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 vconn|DBG|unix: received: OFPT_HELLO (OF1.4): - version bitmap: 0x01, 0x05 -vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 and earlier, peer supports versions 0x01, 0x05) + version bitmap: 0x05 +vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 and earlier, peer supports version 0x05) vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4): bundle_id=0 type=OPEN_REQUEST flags=atomic ordered vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4): @@ -2926,8 +2926,8 @@ vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4): vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5): version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 vconn|DBG|unix: received: OFPT_HELLO (OF1.4): - version bitmap: 0x01, 0x05 -vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 and earlier, peer supports versions 0x01, 0x05) + version bitmap: 0x05 +vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 and earlier, peer supports version 0x05) vconn|DBG|unix: received: OFPST_FLOW request (OF1.4): vconn|DBG|unix: sent (Success): OFPST_FLOW reply (OF1.4): importance=1, dl_vlan=1 actions=drop diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c index fbc9da4..ee15e1a 100644 --- a/utilities/ovs-ofctl.c +++ b/utilities/ovs-ofctl.c @@ -312,6 +312,9 @@ parse_options(int argc, char *argv[]) /* Add implicit allowance for OpenFlow 1.4. */ add_allowed_ofp_versions(ofputil_protocols_to_version_bitmap( OFPUTIL_P_OF14_OXM)); + /* Remove all prior versions. */ + mask_allowed_ofp_versions(ofputil_protocols_to_version_bitmap( + OFPUTIL_P_OF14_UP)); } versions = get_allowed_ofp_versions(); version_protocols = ofputil_protocols_from_version_bitmap(versions);