Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 109743
b: refs/heads/master
c: 09ab6f4
h: refs/heads/master
i:
  109741: c03cd4a
  109739: c082a06
  109735: 4d79a23
  109727: e8184dd
v: v3
  • Loading branch information
Marcel Holtmann committed Sep 9, 2008
1 parent 0c0324e commit 7b7bfea
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f1c08ca559387ab30992055596d54061dfa022b1
refs/heads/master: 09ab6f4c2376a0fc31abde1e2991513f900ea825
2 changes: 1 addition & 1 deletion trunk/include/net/bluetooth/hci_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ 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);

struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *src);
struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8 auth_type);
int hci_conn_auth(struct hci_conn *conn);
int hci_conn_encrypt(struct hci_conn *conn);
int hci_conn_change_link_key(struct hci_conn *conn);
Expand Down
8 changes: 5 additions & 3 deletions trunk/net/bluetooth/hci_conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ EXPORT_SYMBOL(hci_get_route);

/* Create SCO or ACL connection.
* Device _must_ be locked */
struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst)
struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8 auth_type)
{
struct hci_conn *acl;
struct hci_conn *sco;
Expand All @@ -344,8 +344,10 @@ struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst)

hci_conn_hold(acl);

if (acl->state == BT_OPEN || acl->state == BT_CLOSED)
if (acl->state == BT_OPEN || acl->state == BT_CLOSED) {
acl->auth_type = auth_type;
hci_acl_connect(acl);
}

if (type == ACL_LINK)
return acl;
Expand Down Expand Up @@ -381,7 +383,7 @@ int hci_conn_auth(struct hci_conn *conn)

if (conn->ssp_mode > 0 && conn->hdev->ssp_mode > 0) {
if (!(conn->auth_type & 0x01)) {
conn->auth_type = HCI_AT_GENERAL_BONDING_MITM;
conn->auth_type |= 0x01;
conn->link_mode &= ~HCI_LM_AUTH;
}
}
Expand Down
19 changes: 17 additions & 2 deletions trunk/net/bluetooth/l2cap.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
#define BT_DBG(D...)
#endif

#define VERSION "2.10"
#define VERSION "2.11"

static u32 l2cap_feat_mask = 0x0000;

Expand Down Expand Up @@ -778,6 +778,7 @@ static int l2cap_do_connect(struct sock *sk)
struct l2cap_conn *conn;
struct hci_conn *hcon;
struct hci_dev *hdev;
__u8 auth_type;
int err = 0;

BT_DBG("%s -> %s psm 0x%2.2x", batostr(src), batostr(dst), l2cap_pi(sk)->psm);
Expand All @@ -789,7 +790,21 @@ static int l2cap_do_connect(struct sock *sk)

err = -ENOMEM;

hcon = hci_connect(hdev, ACL_LINK, dst);
if (l2cap_pi(sk)->link_mode & L2CAP_LM_AUTH ||
l2cap_pi(sk)->link_mode & L2CAP_LM_ENCRYPT ||
l2cap_pi(sk)->link_mode & L2CAP_LM_SECURE) {
if (l2cap_pi(sk)->psm == cpu_to_le16(0x0001))
auth_type = HCI_AT_NO_BONDING_MITM;
else
auth_type = HCI_AT_GENERAL_BONDING_MITM;
} else {
if (l2cap_pi(sk)->psm == cpu_to_le16(0x0001))
auth_type = HCI_AT_NO_BONDING;
else
auth_type = HCI_AT_GENERAL_BONDING;
}

hcon = hci_connect(hdev, ACL_LINK, dst, auth_type);
if (!hcon)
goto done;

Expand Down
2 changes: 1 addition & 1 deletion trunk/net/bluetooth/sco.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ static int sco_connect(struct sock *sk)
else
type = SCO_LINK;

hcon = hci_connect(hdev, type, dst);
hcon = hci_connect(hdev, type, dst, HCI_AT_NO_BONDING);
if (!hcon)
goto done;

Expand Down

0 comments on commit 7b7bfea

Please sign in to comment.