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
This commit is contained in:
Takanori Watanabe 2020-07-17 15:50:03 +00:00
parent 7f0ad2274b
commit b8c46d561e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=363276
2 changed files with 5 additions and 4 deletions

View file

@ -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 */

View file

@ -547,7 +547,7 @@ ng_l2cap_lp_send(ng_l2cap_con_p con, u_int16_t dcid, struct mbuf *m0)
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",