Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
gsplhtlxg
clone-Linux
提交
fd9ec7d3
C
clone-Linux
项目概览
gsplhtlxg
/
clone-Linux
通知
2
Star
0
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
clone-Linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
fd9ec7d3
编写于
9月 09, 2008
作者:
D
David S. Miller
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of
git://git.kernel.org/pub/scm/linux/kernel/git/holtmann/bluetooth-2.6
上级
82a28c79
e7c29cb1
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
54 addition
and
19 deletion
+54
-19
include/net/bluetooth/hci_core.h
include/net/bluetooth/hci_core.h
+2
-1
net/bluetooth/af_bluetooth.c
net/bluetooth/af_bluetooth.c
+1
-1
net/bluetooth/hci_conn.c
net/bluetooth/hci_conn.c
+18
-3
net/bluetooth/hci_event.c
net/bluetooth/hci_event.c
+4
-7
net/bluetooth/l2cap.c
net/bluetooth/l2cap.c
+28
-6
net/bluetooth/sco.c
net/bluetooth/sco.c
+1
-1
未找到文件。
include/net/bluetooth/hci_core.h
浏览文件 @
fd9ec7d3
...
...
@@ -325,7 +325,8 @@ 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_check_link_mode
(
struct
hci_conn
*
conn
);
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
);
...
...
net/bluetooth/af_bluetooth.c
浏览文件 @
fd9ec7d3
...
...
@@ -49,7 +49,7 @@
#define BT_DBG(D...)
#endif
#define VERSION "2.1
2
"
#define VERSION "2.1
3
"
/* Bluetooth sockets */
#define BT_MAX_PROTO 8
...
...
net/bluetooth/hci_conn.c
浏览文件 @
fd9ec7d3
...
...
@@ -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
;
...
...
@@ -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
;
...
...
@@ -374,6 +376,19 @@ struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst)
}
EXPORT_SYMBOL
(
hci_connect
);
/* Check link security requirement */
int
hci_conn_check_link_mode
(
struct
hci_conn
*
conn
)
{
BT_DBG
(
"conn %p"
,
conn
);
if
(
conn
->
ssp_mode
>
0
&&
conn
->
hdev
->
ssp_mode
>
0
&&
!
(
conn
->
link_mode
&
HCI_LM_ENCRYPT
))
return
0
;
return
1
;
}
EXPORT_SYMBOL
(
hci_conn_check_link_mode
);
/* Authenticate remote device */
int
hci_conn_auth
(
struct
hci_conn
*
conn
)
{
...
...
@@ -381,7 +396,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
;
}
}
...
...
net/bluetooth/hci_event.c
浏览文件 @
fd9ec7d3
...
...
@@ -1605,14 +1605,11 @@ static inline void hci_remote_ext_features_evt(struct hci_dev *hdev, struct sk_b
if
(
conn
->
state
==
BT_CONFIG
)
{
if
(
!
ev
->
status
&&
hdev
->
ssp_mode
>
0
&&
conn
->
ssp_mode
>
0
)
{
if
(
conn
->
out
)
{
struct
hci_cp_auth_requested
cp
;
cp
.
handle
=
ev
->
handle
;
hci_send_cmd
(
hdev
,
HCI_OP_AUTH_REQUESTED
,
conn
->
ssp_mode
>
0
&&
conn
->
out
)
{
struct
hci_cp_auth_requested
cp
;
cp
.
handle
=
ev
->
handle
;
hci_send_cmd
(
hdev
,
HCI_OP_AUTH_REQUESTED
,
sizeof
(
cp
),
&
cp
);
}
}
else
{
conn
->
state
=
BT_CONNECTED
;
hci_proto_connect_cfm
(
conn
,
ev
->
status
);
...
...
net/bluetooth/l2cap.c
浏览文件 @
fd9ec7d3
...
...
@@ -55,7 +55,7 @@
#define BT_DBG(D...)
#endif
#define VERSION "2.1
0
"
#define VERSION "2.1
1
"
static
u32
l2cap_feat_mask
=
0x0000
;
...
...
@@ -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
);
...
...
@@ -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
;
...
...
@@ -1553,10 +1568,10 @@ static inline int l2cap_connect_req(struct l2cap_conn *conn, struct l2cap_cmd_hd
struct
l2cap_conn_req
*
req
=
(
struct
l2cap_conn_req
*
)
data
;
struct
l2cap_conn_rsp
rsp
;
struct
sock
*
sk
,
*
parent
;
int
result
,
status
=
0
;
int
result
,
status
=
L2CAP_CS_NO_INFO
;
u16
dcid
=
0
,
scid
=
__le16_to_cpu
(
req
->
scid
);
__le16
psm
=
req
->
psm
;
__le16
psm
=
req
->
psm
;
BT_DBG
(
"psm 0x%2.2x scid 0x%4.4x"
,
psm
,
scid
);
...
...
@@ -1567,6 +1582,13 @@ static inline int l2cap_connect_req(struct l2cap_conn *conn, struct l2cap_cmd_hd
goto
sendresp
;
}
/* Check if the ACL is secure enough (if not SDP) */
if
(
psm
!=
cpu_to_le16
(
0x0001
)
&&
!
hci_conn_check_link_mode
(
conn
->
hcon
))
{
result
=
L2CAP_CR_SEC_BLOCK
;
goto
response
;
}
result
=
L2CAP_CR_NO_MEM
;
/* Check for backlog size */
...
...
@@ -2224,7 +2246,7 @@ static int l2cap_auth_cfm(struct hci_conn *hcon, u8 status)
rsp
.
scid
=
cpu_to_le16
(
l2cap_pi
(
sk
)
->
dcid
);
rsp
.
dcid
=
cpu_to_le16
(
l2cap_pi
(
sk
)
->
scid
);
rsp
.
result
=
cpu_to_le16
(
result
);
rsp
.
status
=
cpu_to_le16
(
0
);
rsp
.
status
=
cpu_to_le16
(
L2CAP_CS_NO_INFO
);
l2cap_send_cmd
(
conn
,
l2cap_pi
(
sk
)
->
ident
,
L2CAP_CONN_RSP
,
sizeof
(
rsp
),
&
rsp
);
}
...
...
@@ -2296,7 +2318,7 @@ static int l2cap_encrypt_cfm(struct hci_conn *hcon, u8 status, u8 encrypt)
rsp
.
scid
=
cpu_to_le16
(
l2cap_pi
(
sk
)
->
dcid
);
rsp
.
dcid
=
cpu_to_le16
(
l2cap_pi
(
sk
)
->
scid
);
rsp
.
result
=
cpu_to_le16
(
result
);
rsp
.
status
=
cpu_to_le16
(
0
);
rsp
.
status
=
cpu_to_le16
(
L2CAP_CS_NO_INFO
);
l2cap_send_cmd
(
conn
,
l2cap_pi
(
sk
)
->
ident
,
L2CAP_CONN_RSP
,
sizeof
(
rsp
),
&
rsp
);
}
...
...
net/bluetooth/sco.c
浏览文件 @
fd9ec7d3
...
...
@@ -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
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录