Received: by 10.223.176.46 with SMTP id f43csp3328782wra; Mon, 22 Jan 2018 12:12:32 -0800 (PST) X-Google-Smtp-Source: AH8x226OgiUXAdtucib7akHA8EaiEUBe4DNpLUCeGYSs1P2YfB1dwdl8YVw9KfPuDzJvQ57PVEiF X-Received: by 10.107.142.147 with SMTP id q141mr90938iod.15.1516651952709; Mon, 22 Jan 2018 12:12:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516651952; cv=none; d=google.com; s=arc-20160816; b=x1gfcIZFvjkSnB7la/epRPnT2tcDWbaZ4MVnz9i2xg5RNso0mXqRQKZGZJHAPtedSd noXwYO8uYZ3XaDf5Er8Y3IRUjEgUxGj29X7BIfHkie4I4y9dWPBd36bYcjrTMGpzwNkW zw7GEAE/Q6ynrxy6CGGlc6RWEwQt7rnl1e6TbK3eyet2q2VEa/ulLcCbphZX/pbKKUmv zyABJXSP6tp5xqxVfNKQSieNkk1i1QJfwYHE1srI5AwlvIT+ZtwCNYUNhMdud2OLfRIZ j15geEt+p4v3ghXWw6C50VXeRfbPzNg+cczEKRO2ue4Uuz7FCg34+7jjwZ50GSnBqrOj Zzmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=ld5/rCP1TvWQg8n2U02nBsiGgDYBsSwBrRSusb5f0oc=; b=CSucKiGBkfqiLgbUIjeEz8coD2QNtWx1sMUSmUYFibO9E426z+QZR3onfoMDC8+Vl+ cp1AEPnd8coJrm0/3U6X9sxPaSvZsPnYDLcNSestasMNYuryP6BlAqd/JYr/QopQlv/z Ho3PVqO4UfHZPnlhFR6LYTc+Wxh9ubb5mMH4wpl5RG0r7G8wMR+6/IC5xIqwKEwl0Mzf ZOr8De+p3B1JxcGNodfg/NPvzaNKV/HAZrVlsJX/zUnMauPmuCdneXVpZG+NnGs6XiAt fFuVPCUCQ7fq5buNgpy1hM6lJRky6ao0gdqbank1mvnSfRrKxj10J21ll3hE3Gl4+fu2 PRdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JOtmKf5k; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t1si6773369itg.140.2018.01.22.12.12.20; Mon, 22 Jan 2018 12:12:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JOtmKf5k; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751137AbeAVULZ (ORCPT + 99 others); Mon, 22 Jan 2018 15:11:25 -0500 Received: from mail-qt0-f170.google.com ([209.85.216.170]:41478 "EHLO mail-qt0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750891AbeAVULV (ORCPT ); Mon, 22 Jan 2018 15:11:21 -0500 Received: by mail-qt0-f170.google.com with SMTP id i1so24094432qtj.8; Mon, 22 Jan 2018 12:11:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=ld5/rCP1TvWQg8n2U02nBsiGgDYBsSwBrRSusb5f0oc=; b=JOtmKf5kjGZk5UvP5ly0JC0LBdxgqVk9l+MC+Sk5N5opP/SLXYKeNlNvA4cWyg7KHU T4B4nF+Mdz3RgdZNcwKoCxrynHLyxfhMNXp3UJpfn5lCtJLJFT2eL4N3+FYhdKsTaDzt TqPNHGVAd3UyQAaPmSeMG44mEZxgC42paCPYSwHuuXUPZRjqzzwUV1uFwF5ThibO9pIN I7l/7mkalRVFbeOrmH8ymag/4ZjOlJ3MsQ5oh3zJL2Z0P2eFSc0WoYxaRxCn6l5GBxdN ZwsWAOQvp3joDzORrZYVRVlfBIyYZjVJHEGw6jcHFezf+PoV1jmitvdH8oRuVmPAPP84 4P2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=ld5/rCP1TvWQg8n2U02nBsiGgDYBsSwBrRSusb5f0oc=; b=J2SG5ywQi/7k6KYAWNzJVbfEzyHlEjCSXFK+S6bwFD16tolH6IyzER7oEeMoKQnq2f Ht4hQX31cP1h7sotnqybIQ8fxpCSyPgJtP9H9+bqLTYPtW+LOKavqlpfFzwiYg98ZfUl oxTdTmqzND634NC3u+6x3DgtwiZfyQsDOfEUnkXizoDwQQ0BOeOFFPtoLuKa0RrikdAE b0WWKvsTUB9Gi/3AN97t0icLb/j3XSaxk/M0KGLN07jk/gzhLhGfhCAS9fWb1VbCcXWu 1bc242cCYB3jwFuctyS92dpkRmrWBH6vg6KYl4xOZbh9rc4/dCuiFFF+cp7Edg4s1kmz wHeQ== X-Gm-Message-State: AKwxytdo7x4sMtpHLiygRKirNyfohg6wwap0LHCnzyIQR0djnGBSzkuM 31VjlAzxdh5SHifS46q7Xtsueu6pzdaUquVlj/g= X-Received: by 10.200.57.228 with SMTP id v91mr19832qte.121.1516651880774; Mon, 22 Jan 2018 12:11:20 -0800 (PST) MIME-Version: 1.0 Received: by 10.140.81.52 with HTTP; Mon, 22 Jan 2018 12:11:19 -0800 (PST) In-Reply-To: References: <1516160848-471-1-git-send-email-yi2010.guo@samsung.com> From: Luiz Augusto von Dentz Date: Mon, 22 Jan 2018 18:11:19 -0200 Message-ID: Subject: Re: [PATCH] Bluetooth: 6lowpan: Fix disconnect bug in 6lowpan To: Alexander Aring Cc: Guo Yi , "linux-bluetooth@vger.kernel.org" , "open list:NETWORKING [GENERAL]" , Linux Kernel Mailing List , Marcel Holtmann , "Gustavo F. Padovan" , Johan Hedberg , David Miller Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Alex, On Mon, Jan 22, 2018 at 5:33 PM, Alexander Aring wrote: > Hi, > > 2018-01-22 8:00 GMT-05:00 Luiz Augusto von Dentz : >> Hi Alex, >> > ... >>> >>> or is there a special bluetooth API call needed, like the current case >>> with debugfs. >>> I know hcis are not netdevs, but it bothers me that we running into >>> two different worlds on how to deal with that and it just requires >>> "more" special bluetooth specific handling in user space applications. >>> Later more "netdev" capable link layers will maybe support 6LoWPAN and >>> then bluetooth might the only subsystem where different handling is >>> needed to do such job like that. >> >> Keep in mind that the transport on Bluetooth happens to be in a >> different layer, so you are basically suggesting that the kernel >> maintain a L2CAP connection, similar to TCP, which has several >> security implications. >> > > no, I didn't said to change something in protocol handling etc. > I just wanted to say that I am aware that hci is not netdev and it's > hard to use net core api on these "interface types", because net core > knows netdevs only. > >>> We maybe need to support a special handling in "ip link add" to map to >>> bluetooth instead moving that to people in user space? >> >> Afaik ip tool cannot support any tunnel interface since the kernel >> cleanup any socket opened when the tool exit. Btw, with the patches >> above bluetoothd would take care of adding/removing the links >> automatically so at least this step will not be necessary. Other ip >> commands should work though. >> > > not tunneling, etc. I just want to know how you create a netdev > capable 6LoWPAN interface, it is not done by net core API so far I see > and it will never be done? > You say bluetoothd will care about it, but then bluetoothd will call > the right bluetooth API (not net core API, e.g. netlink (what iproute > uses)) > Example: > > ip link add link hci0 name 6lo0 type 6lowpan Again this wouldn't work since hci0 is not the transport, it has to go via L2CAP which is already maintained at userspace. Maintaining the L2CAP connection at kernel level is not an option, the cover letter should be clear about it. > This cannot work because the net core API will not work on HCI > "devices", I see..., but it highly bothers me that we cannot use > similar API to add or delete such interfaces with netlink API and > iproute2 -> you are forced to use bluetooth API with everything behind > it. At least a delete should work... (I am currently not sure if "ip > link del" would work with bluetooth 6LoWPAN). Bluetooth has its own management interface, it doesn't use netlink and I don't think we will be changing this anytime soon, that said the link add/remove would not work like that anyway since one would have to specify the L2CAP scid/dcid of connection or make the ip tool create a L2CAP connection itself, so lets stop right here and not continue since it would probably mess up the ip tool so bad no one would accept this upstream. > According to adding a 6LoWPAN interface, so far I see it will never be > handled by net core API and creating a mapping from net core API to > bluetooth sounds fragile... We are proposing the introducing of tunnel like interface using 6lo adaptation, this obviously would require a proper driver that deal interface with net core using the 6lowpan internals which has advantages over doing it completely on userspace for handling contexts, etc, since icmpv6 implementation happens to be already in the kernel, not to mention it would further fragment the community working on 6lowpan. > At least there is some command "create an 6LoWPAN interface for my > link layer hci device" or it's still magically created/removed by if > there exists a connection or not (I highly don't recommend it, because > user space applications cannot simple deal with dynamically creation > and removal of netdevs (and at the end it should be act like the > removed one again)), ifup/ifdown -> that's okay... > We already had this discussion once if I remember correctly. The interfaces are _not_ dynamically created, bluetoothd plugin creates one interface per adapter at startup and manages the up status, that is it. Perhaps you should check how it is working before assuming such things, there is nothing magical or anything, there are plenty of daemons using TUN/TAP for tunnels for the exact same reason. I will refrain to repeat myself next time, so if you have comments around the code please comment on the patches themselves so we keep this more productive. -- Luiz Augusto von Dentz