lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <7e7430908c3ccaf71f0851050c8ccaf9ecfb3b56.1251621661.git.marcel@holtmann.org>
Date:	Sun, 30 Aug 2009 01:51:01 -0700
From:	Marcel Holtmann <marcel@...tmann.org>
To:	"David S. Miller" <davem@...emloft.net>
Cc:	netdev@...r.kernel.org
Subject: [PATCH 47/47] Bluetooth: Add support for L2CAP 'Send RRorRNR' action

From: Gustavo F. Padovan <gustavo@....ic.unicamp.br>

When called, 'Send RRorRNR' should send a RNR frame if local device is
busy or a RR frame otherwise.

Signed-off-by: Gustavo F. Padovan <gustavo@....ic.unicamp.br>
Signed-off-by: Marcel Holtmann <marcel@...tmann.org>
---
 net/bluetooth/l2cap.c |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
index 40fbf5c..b030125 100644
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -366,6 +366,16 @@ static inline int l2cap_send_sframe(struct l2cap_pinfo *pi, u16 control)
 	return hci_send_acl(pi->conn->hcon, skb, 0);
 }
 
+static inline int l2cap_send_rr_or_rnr(struct l2cap_pinfo *pi, u16 control)
+{
+	if (pi->conn_state & L2CAP_CONN_LOCAL_BUSY)
+		control |= L2CAP_SUPER_RCV_NOT_READY;
+	else
+		control |= L2CAP_SUPER_RCV_READY;
+
+	return l2cap_send_sframe(pi, control);
+}
+
 static void l2cap_do_start(struct sock *sk)
 {
 	struct l2cap_conn *conn = l2cap_pi(sk)->conn;
@@ -1202,8 +1212,7 @@ static void l2cap_monitor_timeout(unsigned long arg)
 	__mod_monitor_timer();
 
 	control = L2CAP_CTRL_POLL;
-	control |= L2CAP_SUPER_RCV_READY;
-	l2cap_send_sframe(l2cap_pi(sk), control);
+	l2cap_send_rr_or_rnr(l2cap_pi(sk), control);
 	bh_unlock_sock(sk);
 }
 
@@ -1219,8 +1228,7 @@ static void l2cap_retrans_timeout(unsigned long arg)
 	l2cap_pi(sk)->conn_state |= L2CAP_CONN_WAIT_F;
 
 	control = L2CAP_CTRL_POLL;
-	control |= L2CAP_SUPER_RCV_READY;
-	l2cap_send_sframe(l2cap_pi(sk), control);
+	l2cap_send_rr_or_rnr(l2cap_pi(sk), control);
 	bh_unlock_sock(sk);
 }
 
@@ -3428,8 +3436,8 @@ static inline int l2cap_data_channel_sframe(struct sock *sk, u16 rx_control, str
 
 		del_timer(&l2cap_pi(sk)->retrans_timer);
 		if (rx_control & L2CAP_CTRL_POLL) {
-			u16 control = L2CAP_CTRL_FINAL | L2CAP_SUPER_RCV_READY;
-			l2cap_send_sframe(l2cap_pi(sk), control);
+			u16 control = L2CAP_CTRL_FINAL;
+			l2cap_send_rr_or_rnr(l2cap_pi(sk), control);
 		}
 		break;
 	}
-- 
1.6.2.5

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ