Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
3b4a39af
cloud-kernel
项目概览
openanolis
/
cloud-kernel
大约 1 年 前同步成功
通知
158
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3b4a39af
编写于
6月 11, 2012
作者:
J
John W. Linville
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'for-upstream' of
git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth
上级
b0fd49b7
1c2e0041
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
85 addition
and
5 deletion
+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
未找到文件。
include/net/bluetooth/hci.h
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录