diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2007-10-20 07:35:42 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-22 05:59:40 -0400 |
commit | 876d9484edf77d228adb42aecd4debd58d7739d6 (patch) | |
tree | 7812471a62fe26a8cf86d2b8fe5584396527de40 /net/bluetooth | |
parent | a9de9248064bfc8eb0a183a6a951a4e7b5ca10a4 (diff) |
[Bluetooth] Finish L2CAP configuration only with acceptable settings
The parameters of the L2CAP output configuration might not be accepted
after the first configuration round. So only indicate a finished output
configuration when acceptable settings are provided.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/l2cap.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c index 36ef27b625db..6ce693d2e5b9 100644 --- a/net/bluetooth/l2cap.c +++ b/net/bluetooth/l2cap.c | |||
@@ -1370,8 +1370,10 @@ static int l2cap_parse_conf_req(struct sock *sk, void *data) | |||
1370 | 1370 | ||
1371 | if (pi->conf_mtu < pi->omtu) | 1371 | if (pi->conf_mtu < pi->omtu) |
1372 | result = L2CAP_CONF_UNACCEPT; | 1372 | result = L2CAP_CONF_UNACCEPT; |
1373 | else | 1373 | else { |
1374 | pi->omtu = pi->conf_mtu; | 1374 | pi->omtu = pi->conf_mtu; |
1375 | pi->conf_state |= L2CAP_CONF_OUTPUT_DONE; | ||
1376 | } | ||
1375 | 1377 | ||
1376 | l2cap_add_conf_opt(&ptr, L2CAP_CONF_MTU, 2, pi->omtu); | 1378 | l2cap_add_conf_opt(&ptr, L2CAP_CONF_MTU, 2, pi->omtu); |
1377 | } | 1379 | } |
@@ -1577,16 +1579,19 @@ static inline int l2cap_config_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr | |||
1577 | 1579 | ||
1578 | l2cap_send_cmd(conn, cmd->ident, L2CAP_CONF_RSP, len, rsp); | 1580 | l2cap_send_cmd(conn, cmd->ident, L2CAP_CONF_RSP, len, rsp); |
1579 | 1581 | ||
1580 | /* Output config done. */ | ||
1581 | l2cap_pi(sk)->conf_state |= L2CAP_CONF_OUTPUT_DONE; | ||
1582 | |||
1583 | /* Reset config buffer. */ | 1582 | /* Reset config buffer. */ |
1584 | l2cap_pi(sk)->conf_len = 0; | 1583 | l2cap_pi(sk)->conf_len = 0; |
1585 | 1584 | ||
1585 | if (!(l2cap_pi(sk)->conf_state & L2CAP_CONF_OUTPUT_DONE)) | ||
1586 | goto unlock; | ||
1587 | |||
1586 | if (l2cap_pi(sk)->conf_state & L2CAP_CONF_INPUT_DONE) { | 1588 | if (l2cap_pi(sk)->conf_state & L2CAP_CONF_INPUT_DONE) { |
1587 | sk->sk_state = BT_CONNECTED; | 1589 | sk->sk_state = BT_CONNECTED; |
1588 | l2cap_chan_ready(sk); | 1590 | l2cap_chan_ready(sk); |
1589 | } else if (!(l2cap_pi(sk)->conf_state & L2CAP_CONF_REQ_SENT)) { | 1591 | goto unlock; |
1592 | } | ||
1593 | |||
1594 | if (!(l2cap_pi(sk)->conf_state & L2CAP_CONF_REQ_SENT)) { | ||
1590 | u8 req[64]; | 1595 | u8 req[64]; |
1591 | l2cap_send_cmd(conn, l2cap_get_ident(conn), L2CAP_CONF_REQ, | 1596 | l2cap_send_cmd(conn, l2cap_get_ident(conn), L2CAP_CONF_REQ, |
1592 | l2cap_build_conf_req(sk, req), req); | 1597 | l2cap_build_conf_req(sk, req), req); |
@@ -1646,7 +1651,6 @@ static inline int l2cap_config_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hdr | |||
1646 | if (flags & 0x01) | 1651 | if (flags & 0x01) |
1647 | goto done; | 1652 | goto done; |
1648 | 1653 | ||
1649 | /* Input config done */ | ||
1650 | l2cap_pi(sk)->conf_state |= L2CAP_CONF_INPUT_DONE; | 1654 | l2cap_pi(sk)->conf_state |= L2CAP_CONF_INPUT_DONE; |
1651 | 1655 | ||
1652 | if (l2cap_pi(sk)->conf_state & L2CAP_CONF_OUTPUT_DONE) { | 1656 | if (l2cap_pi(sk)->conf_state & L2CAP_CONF_OUTPUT_DONE) { |