Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 256418
b: refs/heads/master
c: e2fd318
h: refs/heads/master
v: v3
  • Loading branch information
Ilia Kolomisnky authored and Gustavo F. Padovan committed Jul 11, 2011
1 parent 06a6dd3 commit 43c61a1
Show file tree
Hide file tree
Showing 3 changed files with 28 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: 8f360119243c214eb5c5549c61981d51a276154a
refs/heads/master: e2fd318e3a9208245ee1041f6d413c8593fba29d
19 changes: 18 additions & 1 deletion trunk/include/net/bluetooth/l2cap.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@ struct l2cap_conninfo {
#define L2CAP_SDU_END 0x8000
#define L2CAP_SDU_CONTINUE 0xC000

/* L2CAP Command rej. reasons */
#define L2CAP_REJ_NOT_UNDERSTOOD 0x0000
#define L2CAP_REJ_MTU_EXCEEDED 0x0001
#define L2CAP_REJ_INVALID_CID 0x0002


/* L2CAP structures */
struct l2cap_hdr {
__le16 len;
Expand All @@ -143,8 +149,19 @@ struct l2cap_cmd_hdr {
} __packed;
#define L2CAP_CMD_HDR_SIZE 4

struct l2cap_cmd_rej {
struct l2cap_cmd_rej_unk {
__le16 reason;
} __packed;

struct l2cap_cmd_rej_mtu {
__le16 reason;
__le16 max_mtu;
} __packed;

struct l2cap_cmd_rej_cid {
__le16 reason;
__le16 scid;
__le16 dcid;
} __packed;

struct l2cap_conn_req {
Expand Down
15 changes: 9 additions & 6 deletions trunk/net/bluetooth/l2cap_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2277,9 +2277,9 @@ static void l2cap_conf_rfc_get(struct l2cap_chan *chan, void *rsp, int len)

static inline int l2cap_command_rej(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd, u8 *data)
{
struct l2cap_cmd_rej *rej = (struct l2cap_cmd_rej *) data;
struct l2cap_cmd_rej_unk *rej = (struct l2cap_cmd_rej_unk *) data;

if (rej->reason != 0x0000)
if (rej->reason != L2CAP_REJ_NOT_UNDERSTOOD)
return 0;

if ((conn->info_state & L2CAP_INFO_FEAT_MASK_REQ_SENT) &&
Expand Down Expand Up @@ -2524,9 +2524,12 @@ static inline int l2cap_config_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr
sk = chan->sk;

if (chan->state != BT_CONFIG) {
struct l2cap_cmd_rej rej;
struct l2cap_cmd_rej_cid rej;

rej.reason = cpu_to_le16(L2CAP_REJ_INVALID_CID);
rej.scid = cpu_to_le16(chan->scid);
rej.dcid = cpu_to_le16(chan->dcid);

rej.reason = cpu_to_le16(0x0002);
l2cap_send_cmd(conn, cmd->ident, L2CAP_COMMAND_REJ,
sizeof(rej), &rej);
goto unlock;
Expand Down Expand Up @@ -3017,12 +3020,12 @@ static inline void l2cap_sig_channel(struct l2cap_conn *conn,
err = l2cap_bredr_sig_cmd(conn, &cmd, cmd_len, data);

if (err) {
struct l2cap_cmd_rej rej;
struct l2cap_cmd_rej_unk rej;

BT_ERR("Wrong link type (%d)", err);

/* FIXME: Map err to a valid reason */
rej.reason = cpu_to_le16(0);
rej.reason = cpu_to_le16(L2CAP_REJ_NOT_UNDERSTOOD);
l2cap_send_cmd(conn, cmd.ident, L2CAP_COMMAND_REJ, sizeof(rej), &rej);
}

Expand Down

0 comments on commit 43c61a1

Please sign in to comment.