All of lore.kernel.org
 help / color / mirror / Atom feed
From: Emeltchenko Andrei <Andrei.Emeltchenko.news@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [RFCv2 7/7] Bluetooth: EFS: parse l2cap config rsp pending
Date: Thu,  1 Sep 2011 14:07:36 +0300	[thread overview]
Message-ID: <1314875256-6904-8-git-send-email-Andrei.Emeltchenko.news@gmail.com> (raw)
In-Reply-To: <1314875256-6904-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

Add parsing for L2CAP pending response for EFS. Currently
respond with success when we receive both configuration responses
pending.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
 net/bluetooth/l2cap_core.c |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index c2c5eb7..cb5ddbf 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -2757,6 +2757,15 @@ static inline int l2cap_config_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr
 		chan->num_conf_req++;
 	}
 
+	if (test_bit(CONF_REMOTE_PEND, &chan->conf_state)) {
+		/* check compatibility */
+		clear_bit(CONF_LOCAL_PEND, &chan->conf_state);
+		set_bit(CONF_OUTPUT_DONE, &chan->conf_state);
+		l2cap_send_cmd(conn, cmd->ident, L2CAP_CONF_RSP,
+				l2cap_build_conf_rsp(chan, rsp,
+					L2CAP_CONF_SUCCESS, 0x0000), rsp);
+	}
+
 unlock:
 	bh_unlock_sock(sk);
 	return 0;
@@ -2786,8 +2795,31 @@ static inline int l2cap_config_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hdr
 	switch (result) {
 	case L2CAP_CONF_SUCCESS:
 		l2cap_conf_rfc_get(chan, rsp->data, len);
+		clear_bit(CONF_REMOTE_PEND, &chan->conf_state);
 		break;
 
+	case L2CAP_CONF_PENDING:
+		set_bit(CONF_REMOTE_PEND, &chan->conf_state);
+
+		if (test_bit(CONF_LOCAL_PEND, &chan->conf_state)) {
+			char buf[64];
+
+			len = l2cap_parse_conf_rsp(chan, rsp->data, len,
+					buf, &result);
+			if (len < 0) {
+				l2cap_send_disconn_req(conn, chan, ECONNRESET);
+				goto done;
+			}
+
+			/* check compatibility */
+			clear_bit(CONF_LOCAL_PEND, &chan->conf_state);
+			set_bit(CONF_OUTPUT_DONE, &chan->conf_state);
+			l2cap_send_cmd(conn, cmd->ident, L2CAP_CONF_RSP,
+					l2cap_build_conf_rsp(chan, buf,
+						L2CAP_CONF_SUCCESS, 0x0000), buf);
+		}
+		goto done;
+
 	case L2CAP_CONF_UNACCEPT:
 		if (chan->num_conf_rsp <= L2CAP_CONF_MAX_CONF_RSP) {
 			char req[64];
-- 
1.7.4.1


      parent reply	other threads:[~2011-09-01 11:07 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-01 11:07 [RFCv2 0/7] EFS: extended flow specification option support Emeltchenko Andrei
2011-09-01 11:07 ` [RFCv2 1/7] Bluetooth: L2CAP extended feature mask update Emeltchenko Andrei
2011-09-01 11:07 ` [RFCv2 2/7] Bluetooth: EFS: definitions and headers for EFS Emeltchenko Andrei
2011-09-01 11:07 ` [RFCv2 3/7] Bluetooth: EFS: add disable_flowspec kernel param Emeltchenko Andrei
2011-09-13 20:17   ` Gustavo Padovan
2011-09-14  5:30     ` Marcel Holtmann
2011-09-14  8:30       ` Emeltchenko Andrei
2011-09-14 13:38         ` Gustavo Padovan
2011-09-01 11:07 ` [RFCv2 4/7] Bluetooth: parse EFS in l2cap config request Emeltchenko Andrei
2011-09-13 20:32   ` Gustavo Padovan
2011-09-01 11:07 ` [RFCv2 5/7] Bluetooth: parse EFS in l2cap config response Emeltchenko Andrei
2011-09-01 11:07 ` [RFCv2 6/7] Bluetooth: add EFS option in l2cap conf req Emeltchenko Andrei
2011-09-01 12:45   ` Szymon Janc
2011-09-02  7:25     ` Emeltchenko Andrei
2011-09-01 11:07 ` Emeltchenko Andrei [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1314875256-6904-8-git-send-email-Andrei.Emeltchenko.news@gmail.com \
    --to=andrei.emeltchenko.news@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.