Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752676AbdHNJaF convert rfc822-to-8bit (ORCPT ); Mon, 14 Aug 2017 05:30:05 -0400 Received: from coyote.holtmann.net ([212.227.132.17]:43874 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752381AbdHNJaE (ORCPT ); Mon, 14 Aug 2017 05:30:04 -0400 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: [PATCH] net/bluetooth: make bluetooth socket can be created in net namespace From: Marcel Holtmann In-Reply-To: <20170814071640.289327-1-fupan.li@windriver.com> Date: Mon, 14 Aug 2017 11:30:02 +0200 Cc: "Gustavo F. Padovan" , Johan Hedberg , linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8BIT Message-Id: <6EC96C1E-CE98-4CF1-B1B2-1CEC9DBC36EA@holtmann.org> References: <20170814071640.289327-1-fupan.li@windriver.com> To: fupan.li@windriver.com X-Mailer: Apple Mail (2.3273) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1415 Lines: 37 Hi Fupan, > By now kernel only supported creating bluetooth socket in init_net > net namespace, which made bluetooth device cannot be accessed in > containers, this patch made bluetooth socket can be created in > net namespaces to fix this issue. > > Signed-off-by: Fupan Li > --- > net/bluetooth/af_bluetooth.c | 2 +- > net/bluetooth/bnep/sock.c | 4 ++-- > net/bluetooth/cmtp/sock.c | 4 ++-- > net/bluetooth/hci_sock.c | 4 ++-- > net/bluetooth/hidp/sock.c | 4 ++-- > net/bluetooth/l2cap_sock.c | 4 ++-- > net/bluetooth/rfcomm/core.c | 2 +- > net/bluetooth/rfcomm/sock.c | 4 ++-- > net/bluetooth/sco.c | 4 ++-- > 9 files changed, 16 insertions(+), 16 deletions(-) > > diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c > index 91e3ba280706..eec5ac17faee 100644 > --- a/net/bluetooth/af_bluetooth.c > +++ b/net/bluetooth/af_bluetooth.c > @@ -113,7 +113,7 @@ static int bt_sock_create(struct net *net, struct socket *sock, int proto, > { > int err; > > - if (net != &init_net) > + if (!net_eq(net, current->nsproxy->net_ns)) > return -EAFNOSUPPORT; before I apply such a patch, what is the actual change here. What impact does this have? Are things like Bluetooth mgmt sockets still operating correctly after this? We have no support for move a Bluetooth controller into a container. The Bluetooth hardware is global. Regards Marcel