From owner-svn-src-head@freebsd.org Fri Jul 17 15:50:04 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ACC113682C9; Fri, 17 Jul 2020 15:50:04 +0000 (UTC) (envelope-from takawata@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B7bDD48wcz4D0q; Fri, 17 Jul 2020 15:50:04 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 71FF51BBC6; Fri, 17 Jul 2020 15:50:04 +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 06HFo4pK094176; Fri, 17 Jul 2020 15:50:04 GMT (envelope-from takawata@FreeBSD.org) Received: (from takawata@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 06HFo4Vl094174; Fri, 17 Jul 2020 15:50:04 GMT (envelope-from takawata@FreeBSD.org) Message-Id: <202007171550.06HFo4Vl094174@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: takawata set sender to takawata@FreeBSD.org using -f From: Takanori Watanabe Date: Fri, 17 Jul 2020 15:50:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r363276 - in head/sys/netgraph/bluetooth: include l2cap X-SVN-Group: head X-SVN-Commit-Author: takawata X-SVN-Commit-Paths: in head/sys/netgraph/bluetooth: include l2cap X-SVN-Commit-Revision: 363276 X-SVN-Commit-Repository: base 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.33 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: Fri, 17 Jul 2020 15:50:04 -0000 Author: takawata Date: Fri Jul 17 15:50:03 2020 New Revision: 363276 URL: https://svnweb.freebsd.org/changeset/base/363276 Log: Fix L2CAP ACL packet PB(Packet Boundary) flag for LE PDU. ACL packet boundary flag should be 0 instead of 2 for LE PDU. Some HCI will drop LE packet with PB flag is 2, and if sent, some target may reject the packet. PR: 248024 Reported by: Greg V Reviewed by: Greg V, emax Differential Revision: https://reviews.freebsd.org/D25704 Modified: head/sys/netgraph/bluetooth/include/ng_hci.h head/sys/netgraph/bluetooth/l2cap/ng_l2cap_llpi.c Modified: head/sys/netgraph/bluetooth/include/ng_hci.h ============================================================================== --- head/sys/netgraph/bluetooth/include/ng_hci.h Fri Jul 17 15:09:49 2020 (r363275) +++ head/sys/netgraph/bluetooth/include/ng_hci.h Fri Jul 17 15:50:03 2020 (r363276) @@ -393,10 +393,10 @@ (((h) & 0x0fff) | (((pb) & 3) << 12) | (((bc) & 3) << 14)) /* PB flag values */ - /* 00 - reserved for future use */ +#define NG_HCI_LE_PACKET_START 0x0 #define NG_HCI_PACKET_FRAGMENT 0x1 #define NG_HCI_PACKET_START 0x2 - /* 11 - reserved for future use */ + /* 11 for AMP packet, not supported */ /* BC flag values */ #define NG_HCI_POINT2POINT 0x0 /* only Host controller to Host */ Modified: head/sys/netgraph/bluetooth/l2cap/ng_l2cap_llpi.c ============================================================================== --- head/sys/netgraph/bluetooth/l2cap/ng_l2cap_llpi.c Fri Jul 17 15:09:49 2020 (r363275) +++ head/sys/netgraph/bluetooth/l2cap/ng_l2cap_llpi.c Fri Jul 17 15:50:03 2020 (r363276) @@ -547,7 +547,7 @@ ng_l2cap_lp_send(ng_l2cap_con_p con, u_int16_t dcid, s ng_l2cap_hdr_t *l2cap_hdr = NULL; ng_hci_acldata_pkt_t *acl_hdr = NULL; struct mbuf *m_last = NULL, *m = NULL; - int len, flag = NG_HCI_PACKET_START; + int len, flag = (con->linktype == NG_HCI_LINK_ACL) ? NG_HCI_PACKET_START : NG_HCI_LE_PACKET_START; KASSERT((con->tx_pkt == NULL), ("%s: %s - another packet pending?!\n", __func__, NG_NODE_NAME(l2cap->node))); @@ -713,7 +713,8 @@ ng_l2cap_lp_receive(ng_l2cap_p l2cap, struct mbuf *m) } /* Process packet */ - if (pb == NG_HCI_PACKET_START) { + if ((pb == NG_HCI_PACKET_START) || (pb == NG_HCI_LE_PACKET_START)) + { if (con->rx_pkt != NULL) { NG_L2CAP_ERR( "%s: %s - dropping incomplete L2CAP packet, got %d bytes, want %d bytes\n",