Changeset View
Changeset View
Standalone View
Standalone View
head/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c
Show First 20 Lines • Show All 608 Lines • ▼ Show 20 Lines | "dst bdaddr=%x:%x:%x:%x:%x:%x, psm=%d, lcid=%d, ident=%d\n", | ||||
ip->bdaddr.b[5], ip->bdaddr.b[4], ip->bdaddr.b[3], | ip->bdaddr.b[5], ip->bdaddr.b[4], ip->bdaddr.b[3], | ||||
ip->bdaddr.b[2], ip->bdaddr.b[1], ip->bdaddr.b[0], | ip->bdaddr.b[2], ip->bdaddr.b[1], ip->bdaddr.b[0], | ||||
ip->psm, ip->lcid, ip->ident); | ip->psm, ip->lcid, ip->ident); | ||||
mtx_lock(&ng_btsocket_l2cap_sockets_mtx); | mtx_lock(&ng_btsocket_l2cap_sockets_mtx); | ||||
pcb = ng_btsocket_l2cap_pcb_by_addr(&rt->src, ip->psm); | pcb = ng_btsocket_l2cap_pcb_by_addr(&rt->src, ip->psm); | ||||
if (pcb != NULL) { | if (pcb != NULL) { | ||||
struct socket *so1 = NULL; | struct socket *so1; | ||||
mtx_lock(&pcb->pcb_mtx); | mtx_lock(&pcb->pcb_mtx); | ||||
/* | |||||
* First check the pending connections queue and if we have | |||||
* space then create new socket and set proper source address. | |||||
*/ | |||||
if (pcb->so->so_qlen <= pcb->so->so_qlimit) { | |||||
CURVNET_SET(pcb->so->so_vnet); | CURVNET_SET(pcb->so->so_vnet); | ||||
so1 = sonewconn(pcb->so, 0); | so1 = sonewconn(pcb->so, 0); | ||||
CURVNET_RESTORE(); | CURVNET_RESTORE(); | ||||
} | |||||
if (so1 == NULL) { | if (so1 == NULL) { | ||||
result = NG_L2CAP_NO_RESOURCES; | result = NG_L2CAP_NO_RESOURCES; | ||||
goto respond; | goto respond; | ||||
} | } | ||||
/* | /* | ||||
* If we got here than we have created new socket. So complete | * If we got here than we have created new socket. So complete | ||||
* connection. If we we listening on specific address then copy | * connection. If we we listening on specific address then copy | ||||
▲ Show 20 Lines • Show All 2,340 Lines • Show Last 20 Lines |