From owner-svn-src-head@freebsd.org Tue Jun 7 16:57:15 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3C94BB6EB1E; Tue, 7 Jun 2016 16:57:15 +0000 (UTC) (envelope-from takawata@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E94C01963; Tue, 7 Jun 2016 16:57:14 +0000 (UTC) (envelope-from takawata@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u57GvEwl057568; Tue, 7 Jun 2016 16:57:14 GMT (envelope-from takawata@FreeBSD.org) Received: (from takawata@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u57GvD1I057564; Tue, 7 Jun 2016 16:57:13 GMT (envelope-from takawata@FreeBSD.org) Message-Id: <201606071657.u57GvD1I057564@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: takawata set sender to takawata@FreeBSD.org using -f From: Takanori Watanabe Date: Tue, 7 Jun 2016 16:57:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r301558 - in head/sys/netgraph/bluetooth: l2cap socket X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Jun 2016 16:57:15 -0000 Author: takawata Date: Tue Jun 7 16:57:13 2016 New Revision: 301558 URL: https://svnweb.freebsd.org/changeset/base/301558 Log: Disconnect LE socket when the HCI connection associated is disconnected. Modified: head/sys/netgraph/bluetooth/l2cap/ng_l2cap_misc.c head/sys/netgraph/bluetooth/l2cap/ng_l2cap_ulpi.c head/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c Modified: head/sys/netgraph/bluetooth/l2cap/ng_l2cap_misc.c ============================================================================== --- head/sys/netgraph/bluetooth/l2cap/ng_l2cap_misc.c Tue Jun 7 16:56:15 2016 (r301557) +++ head/sys/netgraph/bluetooth/l2cap/ng_l2cap_misc.c Tue Jun 7 16:57:13 2016 (r301558) @@ -346,7 +346,8 @@ ng_l2cap_new_chan(ng_l2cap_p l2cap, ng_l ch->scid = ng_l2cap_get_cid(l2cap, (con->linktype!= NG_HCI_LINK_ACL)); } - + + ch->idtype = idtype; if (ch->scid != NG_L2CAP_NULL_CID) { /* Initialize channel */ ch->psm = psm; Modified: head/sys/netgraph/bluetooth/l2cap/ng_l2cap_ulpi.c ============================================================================== --- head/sys/netgraph/bluetooth/l2cap/ng_l2cap_ulpi.c Tue Jun 7 16:56:15 2016 (r301557) +++ head/sys/netgraph/bluetooth/l2cap/ng_l2cap_ulpi.c Tue Jun 7 16:57:13 2016 (r301558) @@ -1389,7 +1389,13 @@ ng_l2cap_l2ca_discon_ind(ng_l2cap_chan_p error = ENOMEM; else { ip = (ng_l2cap_l2ca_discon_ind_ip *)(msg->data); - ip->lcid = ch->scid; + ip->idtype = ch->idtype; + if(ch->idtype == NG_L2CAP_L2CA_IDTYPE_ATT|| + ch->idtype == NG_L2CAP_L2CA_IDTYPE_SMP) + ip->lcid = ch->con->con_handle; + else + ip->lcid = ch->scid; + NG_SEND_MSG_HOOK(error, l2cap->node, msg, l2cap->l2c, 0); } Modified: head/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c ============================================================================== --- head/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c Tue Jun 7 16:56:15 2016 (r301557) +++ head/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c Tue Jun 7 16:57:13 2016 (r301558) @@ -1115,7 +1115,7 @@ ng_btsocket_l2cap_process_l2ca_discon_in /* Look for the socket with given channel ID */ pcb = ng_btsocket_l2cap_pcb_by_cid(&rt->src, ip->lcid, - NG_L2CAP_L2CA_IDTYPE_BREDR); + ip->idtype); if (pcb == NULL) { mtx_unlock(&ng_btsocket_l2cap_sockets_mtx); return (0);