Changeset View
Changeset View
Standalone View
Standalone View
head/sys/netgraph/bluetooth/hci/ng_hci_main.c
Show First 20 Lines • Show All 769 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
ng_hci_unit_p unit = (ng_hci_unit_p) NG_NODE_PRIVATE(NG_HOOK_NODE(hook)); | ng_hci_unit_p unit = (ng_hci_unit_p) NG_NODE_PRIVATE(NG_HOOK_NODE(hook)); | ||||
struct mbuf *m = NULL; | struct mbuf *m = NULL; | ||||
ng_hci_unit_con_p con = NULL; | ng_hci_unit_con_p con = NULL; | ||||
u_int16_t con_handle; | u_int16_t con_handle; | ||||
int size, error = 0; | int size, error = 0; | ||||
NG_HCI_BUFF_ACL_SIZE(unit->buffer, size); | NG_HCI_BUFF_ACL_SIZE(unit->buffer, size); | ||||
/* Check packet */ | /* Check packet */ | ||||
NGI_GET_M(item, m); | NGI_GET_M(item, m); | ||||
if (*mtod(m, u_int8_t *) != NG_HCI_ACL_DATA_PKT) { | if (*mtod(m, u_int8_t *) != NG_HCI_ACL_DATA_PKT) { | ||||
NG_HCI_ALERT( | NG_HCI_ALERT( | ||||
"%s: %s - invalid HCI data packet type=%#x\n", | "%s: %s - invalid HCI data packet type=%#x\n", | ||||
__func__, NG_NODE_NAME(unit->node), | __func__, NG_NODE_NAME(unit->node), | ||||
*mtod(m, u_int8_t *)); | *mtod(m, u_int8_t *)); | ||||
error = EINVAL; | error = EINVAL; | ||||
goto drop; | goto drop; | ||||
} | } | ||||
if (m->m_pkthdr.len < sizeof(ng_hci_acldata_pkt_t) || | if (m->m_pkthdr.len < sizeof(ng_hci_acldata_pkt_t) || | ||||
m->m_pkthdr.len > sizeof(ng_hci_acldata_pkt_t) + size) { | m->m_pkthdr.len > sizeof(ng_hci_acldata_pkt_t) + size) { | ||||
NG_HCI_ALERT( | NG_HCI_ALERT( | ||||
"%s: %s - invalid HCI ACL data packet, len=%d, mtu=%d\n", | "%s: %s - invalid HCI ACL data packet, len=%d, mtu=%d\n", | ||||
__func__, NG_NODE_NAME(unit->node), | __func__, NG_NODE_NAME(unit->node), | ||||
m->m_pkthdr.len, size); | m->m_pkthdr.len, size); | ||||
error = EMSGSIZE; | error = EMSGSIZE; | ||||
Show All 26 Lines | if (con == NULL) { | ||||
NG_HCI_ERR( | NG_HCI_ERR( | ||||
"%s: %s - unexpected HCI ACL data packet. Connection does not exists, " \ | "%s: %s - unexpected HCI ACL data packet. Connection does not exists, " \ | ||||
"con_handle=%d\n", __func__, NG_NODE_NAME(unit->node), con_handle); | "con_handle=%d\n", __func__, NG_NODE_NAME(unit->node), con_handle); | ||||
error = ENOENT; | error = ENOENT; | ||||
goto drop; | goto drop; | ||||
} | } | ||||
if (con->link_type != NG_HCI_LINK_ACL) { | if (con->link_type == NG_HCI_LINK_SCO) { | ||||
NG_HCI_ERR( | NG_HCI_ERR( | ||||
"%s: %s - unexpected HCI ACL data packet. Not ACL link, con_handle=%d, " \ | "%s: %s - unexpected HCI ACL data packet. Not ACL link, con_handle=%d, " \ | ||||
"link_type=%d\n", __func__, NG_NODE_NAME(unit->node), | "link_type=%d\n", __func__, NG_NODE_NAME(unit->node), | ||||
con_handle, con->link_type); | con_handle, con->link_type); | ||||
error = EINVAL; | error = EINVAL; | ||||
goto drop; | goto drop; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 243 Lines • Show Last 20 Lines |