Return-Path: MIME-Version: 1.0 In-Reply-To: <20120412091832.GA8109@x220.ger.corp.intel.com> References: <1334127438-27617-1-git-send-email-mikel.astiz.oss@gmail.com> <1334127438-27617-2-git-send-email-mikel.astiz.oss@gmail.com> <66BD268F973E3544A665E5F503FB38B71AFB7646BB@DC01.bmw-carit.intra> <20120412091832.GA8109@x220.ger.corp.intel.com> Date: Thu, 12 Apr 2012 17:29:25 +0200 Message-ID: Subject: Re: [PATCH BlueZ v0 1/7] btio: Fix bind SCO socket only if server From: Mikel Astiz To: Mikel Astiz , Luiz Augusto von Dentz , "linux-bluetooth@vger.kernel.org" Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-bluetooth-owner@vger.kernel.org List-ID: Hi Johan, On Thu, Apr 12, 2012 at 11:18 AM, Johan Hedberg wrote: > > Hi Mikel, > > On Thu, Apr 12, 2012, Mikel Astiz wrote: > > If I understand this correctly, this means we need some kernel > > patches. Either (a) we add the source address in sockaddr_sco so we > > can drop the bind() call (because sco_sock_connect would already > > receive both addresses), or (b) we modify sco_sock_bind such that it > > doesn't complain with EADDRINUSE. > > > > I don't have much experience with sockets but the second approach > > seems a workaround to me. > > Actually b) sounds more like a bugfix than a workaround (and a doesn't > sound like a good idea at all). Returning that error only makes sense > for server sockets but we can't know if this is a server socket or not > at the bind stage. What should probably be done is that the EADDRINUSE > isn't returned for bind() but for listen(). > > Johan I will soon send a kernel patch that follows your suggestion. Cheers, Mikel