diff options
| author | Maksim Krasnyanskiy <maxk@qualcomm.com> | 2003-08-20 07:59:35 -0700 |
|---|---|---|
| committer | Maksim Krasnyanskiy <maxk@qualcomm.com> | 2003-08-20 07:59:35 -0700 |
| commit | a17a125ced08da801ef2a219819b8ebfc6af35b5 (patch) | |
| tree | ed8d024675ea23cda7ee29f3bbeed16002926135 | |
| parent | f699cb6acd8df6e40e4ccb5354e79afb6b08ec06 (diff) | |
[Bluetooth] L2CAP qualification spec mandates sending additional config request
if we receive config response with unacceptable parameters error code.
So we now send dummy request to keep tester happy.
| -rw-r--r-- | include/net/bluetooth/l2cap.h | 2 | ||||
| -rw-r--r-- | net/bluetooth/l2cap.c | 35 |
2 files changed, 28 insertions, 9 deletions
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h index d4e45740b109..ea239a1ff900 100644 --- a/include/net/bluetooth/l2cap.h +++ b/include/net/bluetooth/l2cap.h @@ -220,6 +220,7 @@ struct l2cap_pinfo { __u32 link_mode; __u8 conf_state; + __u8 conf_retry; __u16 conf_mtu; __u8 ident; @@ -234,6 +235,7 @@ struct l2cap_pinfo { #define L2CAP_CONF_REQ_SENT 0x01 #define L2CAP_CONF_INPUT_DONE 0x02 #define L2CAP_CONF_OUTPUT_DONE 0x04 +#define L2CAP_CONF_MAX_RETRIES 2 void l2cap_load(void); diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c index de4f43d76faf..4fe0e74c1e75 100644 --- a/net/bluetooth/l2cap.c +++ b/net/bluetooth/l2cap.c @@ -1526,18 +1526,35 @@ static inline int l2cap_config_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hdr if (!(sk = l2cap_get_chan_by_scid(&conn->chan_list, scid))) return -ENOENT; - if (result) { - struct l2cap_disconn_req req; + switch (result) { + case L2CAP_CONF_SUCCESS: + break; - /* They didn't like our options. Well... we do not negotiate. - * Close channel. - */ + case L2CAP_CONF_UNACCEPT: + if (++l2cap_pi(sk)->conf_retry < L2CAP_CONF_MAX_RETRIES) { + char req[128]; + /* + It does not make sense to adjust L2CAP parameters + that are currently defined in the spec. We simply + resend config request that we sent earlier. It is + stupid :) but it helps qualification testing + which expects at least some response from us. + */ + l2cap_send_req(conn, L2CAP_CONF_REQ, + l2cap_build_conf_req(sk, req), req); + goto done; + } + + default: sk->sk_state = BT_DISCONN; + sk->sk_err = ECONNRESET; l2cap_sock_set_timer(sk, HZ * 5); - - req.dcid = __cpu_to_le16(l2cap_pi(sk)->dcid); - req.scid = __cpu_to_le16(l2cap_pi(sk)->scid); - l2cap_send_req(conn, L2CAP_DISCONN_REQ, sizeof(req), &req); + { + struct l2cap_disconn_req req; + req.dcid = __cpu_to_le16(l2cap_pi(sk)->dcid); + req.scid = __cpu_to_le16(l2cap_pi(sk)->scid); + l2cap_send_req(conn, L2CAP_DISCONN_REQ, sizeof(req), &req); + } goto done; } |
