Bluetooth: Implement deferred sco socket setup
In order to authenticate and configure an incoming SCO connection, the BT_DEFER_SETUP option was added. This option is intended to defer reply to Connect Request on SCO sockets. When a connection is requested, the listening socket is unblocked but the effective connection setup happens only on first recv. Any send between accept and recv fails with -ENOTCONN. Signed-off-by: Frédéric Dalleau <frederic.dalleau@linux.intel.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
This commit is contained in:

committed by
Gustavo Padovan

parent
b96e9c671b
commit
20714bfef8
@@ -376,7 +376,7 @@ extern int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt);
|
||||
extern int l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb,
|
||||
u16 flags);
|
||||
|
||||
extern int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr);
|
||||
extern int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 *flags);
|
||||
extern void sco_connect_cfm(struct hci_conn *hcon, __u8 status);
|
||||
extern void sco_disconn_cfm(struct hci_conn *hcon, __u8 reason);
|
||||
extern int sco_recv_scodata(struct hci_conn *hcon, struct sk_buff *skb);
|
||||
@@ -577,6 +577,7 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst);
|
||||
int hci_conn_del(struct hci_conn *conn);
|
||||
void hci_conn_hash_flush(struct hci_dev *hdev);
|
||||
void hci_conn_check_pending(struct hci_dev *hdev);
|
||||
void hci_conn_accept(struct hci_conn *conn, int mask);
|
||||
|
||||
struct hci_chan *hci_chan_create(struct hci_conn *conn);
|
||||
void hci_chan_del(struct hci_chan *chan);
|
||||
@@ -779,8 +780,10 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
|
||||
#define lmp_host_le_br_capable(dev) ((dev)->host_features[0] & LMP_HOST_LE_BREDR)
|
||||
|
||||
/* ----- HCI protocols ----- */
|
||||
#define HCI_PROTO_DEFER 0x01
|
||||
|
||||
static inline int hci_proto_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr,
|
||||
__u8 type)
|
||||
__u8 type, __u8 *flags)
|
||||
{
|
||||
switch (type) {
|
||||
case ACL_LINK:
|
||||
@@ -788,7 +791,7 @@ static inline int hci_proto_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr,
|
||||
|
||||
case SCO_LINK:
|
||||
case ESCO_LINK:
|
||||
return sco_connect_ind(hdev, bdaddr);
|
||||
return sco_connect_ind(hdev, bdaddr, flags);
|
||||
|
||||
default:
|
||||
BT_ERR("unknown link type %d", type);
|
||||
|
Reference in New Issue
Block a user