From patchwork Mon Jul 18 17:00:21 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: 649642 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 3rtTvg4R9Xz9s6r for ; Tue, 19 Jul 2016 03:00:47 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 4507110974; Mon, 18 Jul 2016 10:00:44 -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 8B42B10973 for ; Mon, 18 Jul 2016 10:00:43 -0700 (PDT) Received: from bar6.cudamail.com (localhost [127.0.0.1]) by mx3v3.cudamail.com (Postfix) with ESMTPS id 23D2C163132 for ; Mon, 18 Jul 2016 11:00:43 -0600 (MDT) X-ASG-Debug-ID: 1468861241-0b3237544003620001-byXFYA Received: from mx3-pf3.cudamail.com ([192.168.14.3]) by bar6.cudamail.com with ESMTP id xgSxwTVmC1NdtYvv (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 18 Jul 2016 11:00:41 -0600 (MDT) X-Barracuda-Envelope-From: cascardo@redhat.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.14.3 Received: from unknown (HELO mx1.redhat.com) (209.132.183.28) by mx3-pf3.cudamail.com with ESMTPS (DHE-RSA-AES256-SHA encrypted); 18 Jul 2016 17:00:41 -0000 Received-SPF: pass (mx3-pf3.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-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (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 3E9557EA85 for ; Mon, 18 Jul 2016 17:00:40 +0000 (UTC) Received: from indiana.gru.redhat.com (ovpn-116-31.phx2.redhat.com [10.3.116.31]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6IH0YQA005099 for ; Mon, 18 Jul 2016 13:00:39 -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-V3-717027448 X-CudaMail-DTE: 071816 X-CudaMail-Originating-IP: 209.132.183.28 Date: Mon, 18 Jul 2016 14:00:21 -0300 X-ASG-Orig-Subj: [##CM-V3-717027448##][RFC 1/5] in-band: use open_type when opening internal device Message-Id: <1468861225-8569-2-git-send-email-cascardo@redhat.com> In-Reply-To: <1468861225-8569-1-git-send-email-cascardo@redhat.com> References: <1468861225-8569-1-git-send-email-cascardo@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 18 Jul 2016 17:00:40 +0000 (UTC) X-Barracuda-Connect: UNKNOWN[192.168.14.3] X-Barracuda-Start-Time: 1468861241 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] [RFC 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. --- 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,