From patchwork Wed Jul 27 15:06:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thadeu Lima de Souza Cascardo X-Patchwork-Id: 653388 X-Patchwork-Delegate: diproiettod@vmware.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (archives.nicira.com [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id 3rzyyG6VD1z9t1w for ; Thu, 28 Jul 2016 01:07:02 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id E88EB10E26; Wed, 27 Jul 2016 08:07:01 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx3v3.cudamail.com (mx3.cudamail.com [64.34.241.5]) by archives.nicira.com (Postfix) with ESMTPS id 09E8F10E0C for ; Wed, 27 Jul 2016 08:07:01 -0700 (PDT) Received: from bar6.cudamail.com (localhost [127.0.0.1]) by mx3v3.cudamail.com (Postfix) with ESMTPS id 97C2E16272E for ; Wed, 27 Jul 2016 09:07:00 -0600 (MDT) X-ASG-Debug-ID: 1469632019-0b32374772121910001-byXFYA Received: from mx1-pf2.cudamail.com ([192.168.24.2]) by bar6.cudamail.com with ESMTP id 20TuAJBk7yZRnsKj (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 27 Jul 2016 09:06:59 -0600 (MDT) X-Barracuda-Envelope-From: cascardo@redhat.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.2 Received: from unknown (HELO mx1.redhat.com) (209.132.183.28) by mx1-pf2.cudamail.com with ESMTPS (DHE-RSA-AES256-SHA encrypted); 27 Jul 2016 15:06:59 -0000 Received-SPF: pass (mx1-pf2.cudamail.com: SPF record at _spf1.redhat.com designates 209.132.183.28 as permitted sender) X-Barracuda-Apparent-Source-IP: 209.132.183.28 X-Barracuda-RBL-IP: 209.132.183.28 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CD828445D5 for ; Wed, 27 Jul 2016 15:06:57 +0000 (UTC) Received: from indiana.gru.redhat.com (ovpn-116-130.phx2.redhat.com [10.3.116.130]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6RF6rWv020124 for ; Wed, 27 Jul 2016 11:06:57 -0400 X-CudaMail-Envelope-Sender: cascardo@redhat.com From: Thadeu Lima de Souza Cascardo To: dev@openvswitch.org X-CudaMail-Whitelist-To: dev@openvswitch.org X-CudaMail-MID: CM-E2-726028614 X-CudaMail-DTE: 072716 X-CudaMail-Originating-IP: 209.132.183.28 Date: Wed, 27 Jul 2016 12:06:41 -0300 X-ASG-Orig-Subj: [##CM-E2-726028614##][PATCH 1/5] in-band: use open_type when opening internal device Message-Id: <1469632005-16490-2-git-send-email-cascardo@redhat.com> In-Reply-To: <1469632005-16490-1-git-send-email-cascardo@redhat.com> References: <1469632005-16490-1-git-send-email-cascardo@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 27 Jul 2016 15:06:57 +0000 (UTC) X-Barracuda-Connect: UNKNOWN[192.168.24.2] X-Barracuda-Start-Time: 1469632019 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 1/5] in-band: use open_type when opening internal device 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" in-band code will open a device that it expects to be the main internal port of the bridge. However, it's possible that the correct type is a different one. For dpif-netdev, it might be a tap device, or a dummy device for dummy datapaths. ofproto_port_open_type will give the correct type. While this doesn't cause any problems right now, as the needed type would be opened already, a later patch assumes netdev with different types cannot be opened. Signed-off-by: Thadeu Lima de Souza Cascardo --- ofproto/in-band.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ofproto/in-band.c b/ofproto/in-band.c index 36e80f4..e3ee41a 100644 --- a/ofproto/in-band.c +++ b/ofproto/in-band.c @@ -422,9 +422,10 @@ in_band_create(struct ofproto *ofproto, const char *local_name, struct in_band *in_band; struct netdev *local_netdev; int error; + const char *type = ofproto_port_open_type(ofproto->type, "internal"); *in_bandp = NULL; - error = netdev_open(local_name, "internal", &local_netdev); + error = netdev_open(local_name, type, &local_netdev); if (error) { VLOG_ERR("%s: failed to initialize in-band control: cannot open " "datapath local port %s (%s)", ofproto->name,