Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
3b4a39af
Commit
3b4a39af
authored
Jun 11, 2012
by
John W. Linville
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'for-upstream' of
git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth
parents
b0fd49b7
1c2e0041
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
85 additions
and
5 deletions
+85
-5
include/net/bluetooth/hci.h
include/net/bluetooth/hci.h
+6
-0
net/bluetooth/hci_event.c
net/bluetooth/hci_event.c
+48
-0
net/bluetooth/l2cap_core.c
net/bluetooth/l2cap_core.c
+6
-1
net/bluetooth/mgmt.c
net/bluetooth/mgmt.c
+18
-0
net/bluetooth/smp.c
net/bluetooth/smp.c
+7
-4
No files found.
include/net/bluetooth/hci.h
View file @
3b4a39af
...
...
@@ -1144,6 +1144,12 @@ struct extended_inquiry_info {
__u8
data
[
240
];
}
__packed
;
#define HCI_EV_KEY_REFRESH_COMPLETE 0x30
struct
hci_ev_key_refresh_complete
{
__u8
status
;
__le16
handle
;
}
__packed
;
#define HCI_EV_IO_CAPA_REQUEST 0x31
struct
hci_ev_io_capa_request
{
bdaddr_t
bdaddr
;
...
...
net/bluetooth/hci_event.c
View file @
3b4a39af
...
...
@@ -3043,6 +3043,50 @@ static inline void hci_extended_inquiry_result_evt(struct hci_dev *hdev, struct
hci_dev_unlock
(
hdev
);
}
static
void
hci_key_refresh_complete_evt
(
struct
hci_dev
*
hdev
,
struct
sk_buff
*
skb
)
{
struct
hci_ev_key_refresh_complete
*
ev
=
(
void
*
)
skb
->
data
;
struct
hci_conn
*
conn
;
BT_DBG
(
"%s status %u handle %u"
,
hdev
->
name
,
ev
->
status
,
__le16_to_cpu
(
ev
->
handle
));
hci_dev_lock
(
hdev
);
conn
=
hci_conn_hash_lookup_handle
(
hdev
,
__le16_to_cpu
(
ev
->
handle
));
if
(
!
conn
)
goto
unlock
;
if
(
!
ev
->
status
)
conn
->
sec_level
=
conn
->
pending_sec_level
;
clear_bit
(
HCI_CONN_ENCRYPT_PEND
,
&
conn
->
flags
);
if
(
ev
->
status
&&
conn
->
state
==
BT_CONNECTED
)
{
hci_acl_disconn
(
conn
,
HCI_ERROR_AUTH_FAILURE
);
hci_conn_put
(
conn
);
goto
unlock
;
}
if
(
conn
->
state
==
BT_CONFIG
)
{
if
(
!
ev
->
status
)
conn
->
state
=
BT_CONNECTED
;
hci_proto_connect_cfm
(
conn
,
ev
->
status
);
hci_conn_put
(
conn
);
}
else
{
hci_auth_cfm
(
conn
,
ev
->
status
);
hci_conn_hold
(
conn
);
conn
->
disc_timeout
=
HCI_DISCONN_TIMEOUT
;
hci_conn_put
(
conn
);
}
unlock:
hci_dev_unlock
(
hdev
);
}
static
inline
u8
hci_get_auth_req
(
struct
hci_conn
*
conn
)
{
/* If remote requests dedicated bonding follow that lead */
...
...
@@ -3559,6 +3603,10 @@ void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb)
hci_extended_inquiry_result_evt
(
hdev
,
skb
);
break
;
case
HCI_EV_KEY_REFRESH_COMPLETE
:
hci_key_refresh_complete_evt
(
hdev
,
skb
);
break
;
case
HCI_EV_IO_CAPA_REQUEST
:
hci_io_capa_request_evt
(
hdev
,
skb
);
break
;
...
...
net/bluetooth/l2cap_core.c
View file @
3b4a39af
...
...
@@ -1295,7 +1295,12 @@ static void security_timeout(struct work_struct *work)
struct
l2cap_conn
*
conn
=
container_of
(
work
,
struct
l2cap_conn
,
security_timer
.
work
);
l2cap_conn_del
(
conn
->
hcon
,
ETIMEDOUT
);
BT_DBG
(
"conn %p"
,
conn
);
if
(
test_and_clear_bit
(
HCI_CONN_LE_SMP_PEND
,
&
conn
->
hcon
->
flags
))
{
smp_chan_destroy
(
conn
);
l2cap_conn_del
(
conn
->
hcon
,
ETIMEDOUT
);
}
}
static
struct
l2cap_conn
*
l2cap_conn_add
(
struct
hci_conn
*
hcon
,
u8
status
)
...
...
net/bluetooth/mgmt.c
View file @
3b4a39af
...
...
@@ -1873,6 +1873,22 @@ static void pairing_complete_cb(struct hci_conn *conn, u8 status)
pairing_complete
(
cmd
,
mgmt_status
(
status
));
}
static
void
le_connect_complete_cb
(
struct
hci_conn
*
conn
,
u8
status
)
{
struct
pending_cmd
*
cmd
;
BT_DBG
(
"status %u"
,
status
);
if
(
!
status
)
return
;
cmd
=
find_pairing
(
conn
);
if
(
!
cmd
)
BT_DBG
(
"Unable to find a pending command"
);
else
pairing_complete
(
cmd
,
mgmt_status
(
status
));
}
static
int
pair_device
(
struct
sock
*
sk
,
struct
hci_dev
*
hdev
,
void
*
data
,
u16
len
)
{
...
...
@@ -1934,6 +1950,8 @@ static int pair_device(struct sock *sk, struct hci_dev *hdev, void *data,
/* For LE, just connecting isn't a proof that the pairing finished */
if
(
cp
->
addr
.
type
==
BDADDR_BREDR
)
conn
->
connect_cfm_cb
=
pairing_complete_cb
;
else
conn
->
connect_cfm_cb
=
le_connect_complete_cb
;
conn
->
security_cfm_cb
=
pairing_complete_cb
;
conn
->
disconn_cfm_cb
=
pairing_complete_cb
;
...
...
net/bluetooth/smp.c
View file @
3b4a39af
...
...
@@ -648,7 +648,7 @@ static u8 smp_cmd_pairing_rsp(struct l2cap_conn *conn, struct sk_buff *skb)
auth
|=
(
req
->
auth_req
|
rsp
->
auth_req
)
&
SMP_AUTH_MITM
;
ret
=
tk_request
(
conn
,
0
,
auth
,
r
sp
->
io_capability
,
req
->
io_capability
);
ret
=
tk_request
(
conn
,
0
,
auth
,
r
eq
->
io_capability
,
rsp
->
io_capability
);
if
(
ret
)
return
SMP_UNSPECIFIED
;
...
...
@@ -703,7 +703,7 @@ static u8 smp_cmd_pairing_random(struct l2cap_conn *conn, struct sk_buff *skb)
return
0
;
}
static
u8
smp_ltk_encrypt
(
struct
l2cap_conn
*
conn
)
static
u8
smp_ltk_encrypt
(
struct
l2cap_conn
*
conn
,
u8
sec_level
)
{
struct
smp_ltk
*
key
;
struct
hci_conn
*
hcon
=
conn
->
hcon
;
...
...
@@ -712,6 +712,9 @@ static u8 smp_ltk_encrypt(struct l2cap_conn *conn)
if
(
!
key
)
return
0
;
if
(
sec_level
>
BT_SECURITY_MEDIUM
&&
!
key
->
authenticated
)
return
0
;
if
(
test_and_set_bit
(
HCI_CONN_ENCRYPT_PEND
,
&
hcon
->
flags
))
return
1
;
...
...
@@ -732,7 +735,7 @@ static u8 smp_cmd_security_req(struct l2cap_conn *conn, struct sk_buff *skb)
hcon
->
pending_sec_level
=
authreq_to_seclevel
(
rp
->
auth_req
);
if
(
smp_ltk_encrypt
(
conn
))
if
(
smp_ltk_encrypt
(
conn
,
hcon
->
pending_sec_level
))
return
0
;
if
(
test_and_set_bit
(
HCI_CONN_LE_SMP_PEND
,
&
hcon
->
flags
))
...
...
@@ -771,7 +774,7 @@ int smp_conn_security(struct l2cap_conn *conn, __u8 sec_level)
return
1
;
if
(
hcon
->
link_mode
&
HCI_LM_MASTER
)
if
(
smp_ltk_encrypt
(
conn
))
if
(
smp_ltk_encrypt
(
conn
,
sec_level
))
goto
done
;
if
(
test_and_set_bit
(
HCI_CONN_LE_SMP_PEND
,
&
hcon
->
flags
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment