From patchwork Fri Jan 31 20:34:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Conole X-Patchwork-Id: 1232108 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=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=APXqiwyp; dkim-atps=neutral Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 488TTf39sWz9s1x for ; Sat, 1 Feb 2020 07:34:13 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id EB973882E0; Fri, 31 Jan 2020 20:34:11 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RNarQbn-LmA5; Fri, 31 Jan 2020 20:34:11 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id 328B7880F9; Fri, 31 Jan 2020 20:34:11 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 20E2AC0176; Fri, 31 Jan 2020 20:34:11 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 737BBC0171 for ; Fri, 31 Jan 2020 20:34:09 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 6ED2D86B00 for ; Fri, 31 Jan 2020 20:34:09 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id A1n_-StnZYSd for ; Fri, 31 Jan 2020 20:34:08 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 7E6D786AFB for ; Fri, 31 Jan 2020 20:34:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580502846; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=w+mcJG5QwYE7CXNXyit+A7X01Oo2mB4Qadiplj+xkdY=; b=APXqiwypp+DphISz8TCNBewnOKsCfVgRl6gBUlMeLDgiy4vJZGXRF5x3Cr6n6uPeAba8CL YtxQdONz5pdKZYplRfWAhqX3xGP5L19GUNYozjFSjfO9TLE/D2/jnkntoJoWNmp5fGgs5M 1oRS20+CmA1NCWDXw3VhesEic1a9ED8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-70-tr0jXngdMauskVVVXmTg7g-1; Fri, 31 Jan 2020 15:34:04 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8277B18A6EC0; Fri, 31 Jan 2020 20:34:03 +0000 (UTC) Received: from dhcp-25.97.bos.redhat.com (unknown [10.18.25.126]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 130FD89E94; Fri, 31 Jan 2020 20:34:02 +0000 (UTC) From: Aaron Conole To: dev@openvswitch.org Date: Fri, 31 Jan 2020 15:34:02 -0500 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: tr0jXngdMauskVVVXmTg7g-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Cc: Jakub Libosvar Subject: [ovs-dev] [PATCH RFC] connmgr: support changing openflow versions without restarting 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 commit a0baa7dfa4fe ("connmgr: Make treatment of active and passive connections more uniform") was applied, it didn't take into account that a reconfiguration of the allowed_versions setting needs to propagate to the rconn and pvconn (and lower connection) elements. This change inelegantly deletes and recreates these pvconn and rconn elements. There's probably better ways of doing this (like maybe adding the knob to rconn/vconn and kicking off a resync?) but I don't know the openflow spec well enough to know whether it's possible or supported. A new test is added to ensure we don't break the behavior again. Fixes: a0baa7dfa4fe ("connmgr: Make treatment of active and passive connections more uniform") Signed-off-by: Aaron Conole --- --- 2.21.0 diff --git a/ofproto/connmgr.c b/ofproto/connmgr.c index 51d656cba..37c616691 100644 --- a/ofproto/connmgr.c +++ b/ofproto/connmgr.c @@ -2021,6 +2021,26 @@ ofservice_reconfigure(struct ofservice *ofservice, * version. */ if (ofservice->s.allowed_versions != settings->allowed_versions) { ofservice_close_all(ofservice); + if (ofservice->pvconn) { + struct pvconn *pvconn = NULL; + pvconn_close(ofservice->pvconn); + /* there is a potentially squelched error here */ + pvconn_open(ofservice->target, settings->allowed_versions, + settings->dscp, &pvconn); + ofservice->pvconn = pvconn; + } + + if (ofservice->rconn) { + struct rconn *rconn = NULL; + rconn_destroy(ofservice->rconn); + + char *name = ofconn_make_name(ofservice->connmgr, ofservice->target); + rconn = rconn_create(5, 8, settings->dscp, settings->allowed_versions); + rconn_connect(rconn, ofservice->target, name); + free(name); + ofservice->rconn = rconn; + } + } ofservice->s = *settings; diff --git a/tests/bridge.at b/tests/bridge.at index d48463e26..904f1381c 100644 --- a/tests/bridge.at +++ b/tests/bridge.at @@ -103,3 +103,20 @@ AT_CHECK([ovs-appctl -t ovs-vswitchd version], [0], [ignore]) OVS_APP_EXIT_AND_WAIT([ovs-vswitchd]) OVS_APP_EXIT_AND_WAIT([ovsdb-server]) AT_CLEANUP + +AT_SETUP([bridge - change ofproto versions]) +dnl Start vswitch and add a version test bridge +OVS_VSWITCHD_START( + [add-br vr_test0 -- \ + set bridge vr_test0 datapath-type=dummy \ + protocols=OpenFlow10]) + +dnl set the version to include, say, OpenFlow14 +AT_CHECK([ovs-vsctl set bridge vr_test0 protocols=OpenFlow10,OpenFlow14]) + +dnl now try to use bundle action on a flow +AT_CHECK([ovs-ofctl add-flow vr_test0 --bundle actions=normal]) + +OVS_APP_EXIT_AND_WAIT([ovs-vswitchd]) +OVS_APP_EXIT_AND_WAIT([ovsdb-server]) +AT_CLEANUP