Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 134737
b: refs/heads/master
c: 2950f21
h: refs/heads/master
i:
  134735: e15031c
v: v3
  • Loading branch information
Marcel Holtmann committed Feb 27, 2009
1 parent 16cc53e commit c7d6720
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 11 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: f29972de8e7476706ab3c01304a505e7c95d9040
refs/heads/master: 2950f21acb0f6b8fcd964485c2ebf1e06545ac20
25 changes: 21 additions & 4 deletions trunk/include/net/bluetooth/hci_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,8 @@ struct hci_proto {

int (*connect_ind) (struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 type);
int (*connect_cfm) (struct hci_conn *conn, __u8 status);
int (*disconn_ind) (struct hci_conn *conn, __u8 reason);
int (*disconn_ind) (struct hci_conn *conn);
int (*disconn_cfm) (struct hci_conn *conn, __u8 reason);
int (*recv_acldata) (struct hci_conn *conn, struct sk_buff *skb, __u16 flags);
int (*recv_scodata) (struct hci_conn *conn, struct sk_buff *skb);
int (*security_cfm) (struct hci_conn *conn, __u8 status, __u8 encrypt);
Expand Down Expand Up @@ -513,17 +514,33 @@ static inline void hci_proto_connect_cfm(struct hci_conn *conn, __u8 status)
hp->connect_cfm(conn, status);
}

static inline void hci_proto_disconn_ind(struct hci_conn *conn, __u8 reason)
static inline int hci_proto_disconn_ind(struct hci_conn *conn)
{
register struct hci_proto *hp;
int reason = 0x13;

hp = hci_proto[HCI_PROTO_L2CAP];
if (hp && hp->disconn_ind)
hp->disconn_ind(conn, reason);
reason = hp->disconn_ind(conn);

hp = hci_proto[HCI_PROTO_SCO];
if (hp && hp->disconn_ind)
hp->disconn_ind(conn, reason);
reason = hp->disconn_ind(conn);

return reason;
}

static inline void hci_proto_disconn_cfm(struct hci_conn *conn, __u8 reason)
{
register struct hci_proto *hp;

hp = hci_proto[HCI_PROTO_L2CAP];
if (hp && hp->disconn_cfm)
hp->disconn_cfm(conn, reason);

hp = hci_proto[HCI_PROTO_SCO];
if (hp && hp->disconn_cfm)
hp->disconn_cfm(conn, reason);
}

static inline void hci_proto_auth_cfm(struct hci_conn *conn, __u8 status)
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/net/bluetooth/l2cap.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@ struct l2cap_conn {
__u8 rx_ident;
__u8 tx_ident;

__u8 disc_reason;

struct l2cap_chan_list chan_list;
};

Expand Down
6 changes: 4 additions & 2 deletions trunk/net/bluetooth/hci_conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ static void hci_conn_timeout(unsigned long arg)
{
struct hci_conn *conn = (void *) arg;
struct hci_dev *hdev = conn->hdev;
__u8 reason;

BT_DBG("conn %p state %d", conn, conn->state);

Expand All @@ -177,7 +178,8 @@ static void hci_conn_timeout(unsigned long arg)
break;
case BT_CONFIG:
case BT_CONNECTED:
hci_acl_disconn(conn, 0x13);
reason = hci_proto_disconn_ind(conn);
hci_acl_disconn(conn, reason);
break;
default:
conn->state = BT_CLOSED;
Expand Down Expand Up @@ -562,7 +564,7 @@ void hci_conn_hash_flush(struct hci_dev *hdev)

hci_conn_del_sysfs(c);

hci_proto_disconn_ind(c, 0x16);
hci_proto_disconn_cfm(c, 0x16);
hci_conn_del(c);
}
}
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/bluetooth/hci_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,7 @@ static inline void hci_disconn_complete_evt(struct hci_dev *hdev, struct sk_buff

hci_conn_del_sysfs(conn);

hci_proto_disconn_ind(conn, ev->reason);
hci_proto_disconn_cfm(conn, ev->reason);
hci_conn_del(conn);
}

Expand Down
20 changes: 19 additions & 1 deletion trunk/net/bluetooth/l2cap.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ static void __l2cap_chan_add(struct l2cap_conn *conn, struct sock *sk, struct so

BT_DBG("conn %p, psm 0x%2.2x, dcid 0x%4.4x", conn, l2cap_pi(sk)->psm, l2cap_pi(sk)->dcid);

conn->disc_reason = 0x13;

l2cap_pi(sk)->conn = conn;

if (sk->sk_type == SOCK_SEQPACKET) {
Expand Down Expand Up @@ -491,6 +493,8 @@ static struct l2cap_conn *l2cap_conn_add(struct hci_conn *hcon, u8 status)
spin_lock_init(&conn->lock);
rwlock_init(&conn->chan_list.lock);

conn->disc_reason = 0x13;

return conn;
}

Expand Down Expand Up @@ -1840,6 +1844,7 @@ static inline int l2cap_connect_req(struct l2cap_conn *conn, struct l2cap_cmd_hd
/* Check if the ACL is secure enough (if not SDP) */
if (psm != cpu_to_le16(0x0001) &&
!hci_conn_check_link_mode(conn->hcon)) {
conn->disc_reason = 0x05;
result = L2CAP_CR_SEC_BLOCK;
goto response;
}
Expand Down Expand Up @@ -2472,7 +2477,19 @@ static int l2cap_connect_cfm(struct hci_conn *hcon, u8 status)
return 0;
}

static int l2cap_disconn_ind(struct hci_conn *hcon, u8 reason)
static int l2cap_disconn_ind(struct hci_conn *hcon)
{
struct l2cap_conn *conn = hcon->l2cap_data;

BT_DBG("hcon %p", hcon);

if (hcon->type != ACL_LINK || !conn)
return 0x13;

return conn->disc_reason;
}

static int l2cap_disconn_cfm(struct hci_conn *hcon, u8 reason)
{
BT_DBG("hcon %p reason %d", hcon, reason);

Expand Down Expand Up @@ -2717,6 +2734,7 @@ static struct hci_proto l2cap_hci_proto = {
.connect_ind = l2cap_connect_ind,
.connect_cfm = l2cap_connect_cfm,
.disconn_ind = l2cap_disconn_ind,
.disconn_cfm = l2cap_disconn_cfm,
.security_cfm = l2cap_security_cfm,
.recv_acldata = l2cap_recv_acldata
};
Expand Down
4 changes: 2 additions & 2 deletions trunk/net/bluetooth/sco.c
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,7 @@ static int sco_connect_cfm(struct hci_conn *hcon, __u8 status)
return 0;
}

static int sco_disconn_ind(struct hci_conn *hcon, __u8 reason)
static int sco_disconn_cfm(struct hci_conn *hcon, __u8 reason)
{
BT_DBG("hcon %p reason %d", hcon, reason);

Expand Down Expand Up @@ -985,7 +985,7 @@ static struct hci_proto sco_hci_proto = {
.id = HCI_PROTO_SCO,
.connect_ind = sco_connect_ind,
.connect_cfm = sco_connect_cfm,
.disconn_ind = sco_disconn_ind,
.disconn_cfm = sco_disconn_cfm,
.recv_scodata = sco_recv_scodata
};

Expand Down

0 comments on commit c7d6720

Please sign in to comment.