Changeset View
Changeset View
Standalone View
Standalone View
sys/netgraph/bluetooth/hci/ng_hci_evnt.c
Show First 20 Lines • Show All 411 Lines • ▼ Show 20 Lines | if (n == NULL) { | ||||
} | } | ||||
bcopy(&bdaddr, &n->bdaddr, sizeof(n->bdaddr)); | bcopy(&bdaddr, &n->bdaddr, sizeof(n->bdaddr)); | ||||
n->addrtype = (addr_type)? NG_HCI_LINK_LE_RANDOM : | n->addrtype = (addr_type)? NG_HCI_LINK_LE_RANDOM : | ||||
NG_HCI_LINK_LE_PUBLIC; | NG_HCI_LINK_LE_PUBLIC; | ||||
} else | } else | ||||
getmicrotime(&n->updated); | getmicrotime(&n->updated); | ||||
#if 0 | |||||
{ | { | ||||
/* | /* | ||||
* TODO: Make these information | * TODO: Make these information | ||||
* Available from userland. | * Available from userland. | ||||
*/ | */ | ||||
u_int8_t length_data; | u_int8_t length_data; | ||||
char *rssi; | event = m_pullup(event, sizeof(u_int8_t)); | ||||
if(event == NULL){ | |||||
NG_HCI_M_PULLUP(event, sizeof(u_int8_t)); | NG_HCI_WARN("%s: Event datasize Pullup Failed\n", __func__); | ||||
goto out; | |||||
} | |||||
length_data = *mtod(event, u_int8_t *); | length_data = *mtod(event, u_int8_t *); | ||||
m_adj(event, sizeof(u_int8_t)); | m_adj(event, sizeof(u_int8_t)); | ||||
n->extinq_size = (length_data < NG_HCI_EXTINQ_MAX)? | |||||
length_data : NG_HCI_EXTINQ_MAX; | |||||
/*Advertizement data*/ | /*Advertizement data*/ | ||||
NG_HCI_M_PULLUP(event, length_data); | event = m_pullup(event, n->extinq_size); | ||||
emax: do we need to make sure that mbuf really has n->extinq_data bytes available? what if actual… | |||||
m_adj(event, length_data); | if(event == NULL){ | ||||
Not Done Inline ActionsNG_HCI_M_PULLUP() alerts on result being NULL already. also, i think, we still need to check if mbuf actually has enough data. emax: NG_HCI_M_PULLUP() alerts on result being NULL already. also, i think, we still need to check if… | |||||
Not Done Inline ActionsOk. I'll simply use m_pullup instead. takawata: Ok. I'll simply use m_pullup instead. | |||||
NG_HCI_M_PULLUP(event, sizeof(char )); | NG_HCI_WARN("%s: Event data pullup Failed\n", __func__); | ||||
goto out; | |||||
} | |||||
m_copydata(event, 0, n->extinq_size, n->extinq_data); | |||||
m_adj(event, n->extinq_size); | |||||
event = m_pullup(event, sizeof(char )); | |||||
/*Get RSSI*/ | /*Get RSSI*/ | ||||
rssi = mtod(event, char *); | if(event == NULL){ | ||||
NG_HCI_WARN("%s: Event rssi pull up Failed\n", __func__); | |||||
Not Done Inline Actionssame comment as above, i.e. NG_HCI_M_PULLUP() warns, and, please check length to make sure data are present emax: same comment as above, i.e. NG_HCI_M_PULLUP() warns, and, please check length to make sure data… | |||||
goto out; | |||||
} | |||||
n->page_scan_mode = *mtod(event, char *); | |||||
m_adj(event, sizeof(u_int8_t)); | m_adj(event, sizeof(u_int8_t)); | ||||
} | } | ||||
#endif | |||||
} | } | ||||
out: | |||||
NG_FREE_M(event); | NG_FREE_M(event); | ||||
return (error); | return (error); | ||||
} /* inquiry_result */ | } /* inquiry_result */ | ||||
static int le_connection_complete(ng_hci_unit_p unit, struct mbuf *event) | static int le_connection_complete(ng_hci_unit_p unit, struct mbuf *event) | ||||
{ | { | ||||
int error = 0; | int error = 0; | ||||
▲ Show 20 Lines • Show All 926 Lines • Show Last 20 Lines |
do we need to make sure that mbuf really has n->extinq_data bytes available? what if actual data size is less than header says?