linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] LMP transaction collision at Set encryption
       [not found] <LMP Transaction collision>
@ 2012-02-14  8:57 ` rajmohan.mohanan
  2012-02-14 11:33   ` Luiz Augusto von Dentz
  2012-02-15 12:29   ` Marcel Holtmann
  0 siblings, 2 replies; 6+ messages in thread
From: rajmohan.mohanan @ 2012-02-14  8:57 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: mohanan

From: mohanan <rajmohan.mohanan@intel.com>

ISSUE:
1. started pairing from my device(DUT) to a remote device (Lenovo T500). After successful bonding bluez send device discovery in the same ACL connection createdprior to BONDING
2. Changed to DUT role as slave.
3. From Host ,sending Set Connection Encryption, getting LMP Error Transaction Collision as status of  encryption command sent by DUT(Slave).(Remote guy who is a master has also initiated Set encryption).
4. In between bluez has initiated SDP search after bonding process complete(device_bonding_complete()).
5. From the encryption change event (event status is 0x23(LMP transaction collision),Bluez disconnecting l2cap and then acl link.
We are not able Find the services of remote device because application written in spite of service discovery has initiated after bonding process

FIX:
Made changes in hci_event.c  for solving LMP Transaction collision.

When we gets Encrypt change event with error code as LMP  transaction collision , Ignoring the change event because From Master Encrypt change event will process and will get encrypt change event with success second time.

If we are not getting Encrypt change event from master we are sending again Set encryption from slave( because we already sent a set encryption which result in to a collision) after 1 second delay.

If we getting a encrypt change event from master after collision event then we delete timer and process it normally.

HCIDUMP:

HCI sniffer - Bluetooth packet analyzer ver 1.42

device: hci0 snap_len: 1028 filter: 0xffffffff

2004-01-01 00:24:28.201531 < HCI Command: Create Connection (0x01|0x0005) plen 13

    bdaddr C4:17:FE:F5:74:DF ptype 0xcc18 rswitch 0x01 clkoffset 0x0000

    Packet type: DM1 DM3 DM5 DH1 DH3 DH5

2004-01-01 00:24:28.214399 > HCI Event: Command Status (0x0f) plen 4

    Create Connection (0x01|0x0005) status 0x00 ncmd 1

2004-01-01 00:24:33.329983 > HCI Event: Connect Complete (0x03) plen 11

    status 0x04 handle 65535 bdaddr C4:17:FE:F5:74:DF type ACL encrypt 0x00

    Error: Page Timeout

2004-01-01 00:24:45.458623 < HCI Command: Create Connection (0x01|0x0005) plen 13

    bdaddr C4:17:FE:F5:74:DF ptype 0xcc18 rswitch 0x01 clkoffset 0x0000

    Packet type: DM1 DM3 DM5 DH1 DH3 DH5

2004-01-01 00:24:45.466521 > HCI Event: Command Status (0x0f) plen 4

    Create Connection (0x01|0x0005) status 0x00 ncmd 1

2004-01-01 00:24:47.052369 > HCI Event: Role Change (0x12) plen 8

    status 0x00 bdaddr C4:17:FE:F5:74:DF role 0x01

    Role: Slave

2004-01-01 00:24:47.213870 > HCI Event: Connect Complete (0x03) plen 11

    status 0x00 handle 256 bdaddr C4:17:FE:F5:74:DF type ACL encrypt 0x00

2004-01-01 00:24:47.214457 < HCI Command: Read Remote Supported Features (0x01|0x001b) plen 2

    handle 256

2004-01-01 00:24:47.234339 > HCI Event: Max Slots Change (0x1b) plen 3

    handle 256 slots 5

2004-01-01 00:24:47.234397 > HCI Event: Command Status (0x0f) plen 4

    Read Remote Supported Features (0x01|0x001b) status 0x00 ncmd 1

2004-01-01 00:24:47.234405 > HCI Event: Read Remote Supported Features (0x0b) plen 11

    status 0x00 handle 256

    Features: 0xff 0xff 0x8f 0xfe 0x9b 0xff 0x79 0x83

2004-01-01 00:24:47.234917 < HCI Command: Read Remote Extended Features (0x01|0x001c) plen 3

    handle 256 page 1

2004-01-01 00:24:47.236452 > HCI Event: Command Status (0x0f) plen 4

    Read Remote Extended Features (0x01|0x001c) status 0x00 ncmd 1

2004-01-01 00:24:47.244773 > HCI Event: Read Remote Extended Features (0x23) plen 13

    status 0x00 handle 256 page 1 max 0

    Features: 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00

2004-01-01 00:24:47.244923 < HCI Command: Authentication Requested (0x01|0x0011) plen 2

    handle 256

2004-01-01 00:24:47.246853 > HCI Event: Command Status (0x0f) plen 4

    Authentication Requested (0x01|0x0011) status 0x00 ncmd 1

2004-01-01 00:24:47.246882 > HCI Event: Link Key Request (0x17) plen 6

    bdaddr C4:17:FE:F5:74:DF

2004-01-01 00:24:47.264148 < HCI Command: Remote Name Request (0x01|0x0019) plen 10

    bdaddr C4:17:FE:F5:74:DF mode 2 clkoffset 0x0000

2004-01-01 00:24:47.266043 > HCI Event: Command Status (0x0f) plen 4

    Remote Name Request (0x01|0x0019) status 0x00 ncmd 1

2004-01-01 00:24:47.270761 < HCI Command: Link Key Request Negative Reply (0x01|0x000c) plen 6

    bdaddr C4:17:FE:F5:74:DF

2004-01-01 00:24:47.272375 > HCI Event: Command Complete (0x0e) plen 10

    Link Key Request Negative Reply (0x01|0x000c) ncmd 1

    status 0x00 bdaddr C4:17:FE:F5:74:DF

2004-01-01 00:24:47.272536 > HCI Event: IO Capability Request (0x31) plen 6

    bdaddr C4:17:FE:F5:74:DF

2004-01-01 00:24:47.280195 < HCI Command: IO Capability Request Reply (0x01|0x002b) plen 9

    bdaddr C4:17:FE:F5:74:DF capability 0x01 oob 0x00 auth 0x03

    Capability: DisplayYesNo (OOB data not present)

    Authentication: Dedicated Bonding (MITM Protection)

2004-01-01 00:24:47.282037 > HCI Event: Command Complete (0x0e) plen 10

    IO Capability Request Reply (0x01|0x002b) ncmd 1

    status 0x00 bdaddr C4:17:FE:F5:74:DF

2004-01-01 00:24:48.026091 > HCI Event: IO Capability Response (0x32) plen 9

    bdaddr C4:17:FE:F5:74:DF capability 0x01 oob 0x00 auth 0x05

    Capability: DisplayYesNo (OOB data not present)

    Authentication: General Bonding (MITM Protection)

2004-01-01 00:24:48.027156 > HCI Event: Remote Name Req Complete (0x07) plen 255

    status 0x00 bdaddr C4:17:FE:F5:74:DF name 'ICHAUHAX-MOBL'

2004-01-01 00:24:49.023901 > HCI Event: User Confirmation Request (0x33) plen 10

    bdaddr C4:17:FE:F5:74:DF passkey 733849

2004-01-01 00:24:53.594371 < HCI Command: User Confirmation Request Reply (0x01|0x002c) plen 6

    bdaddr C4:17:FE:F5:74:DF

2004-01-01 00:24:53.596301 > HCI Event: Command Complete (0x0e) plen 10

    User Confirmation Request Reply (0x01|0x002c) ncmd 1

    status 0x00 bdaddr C4:17:FE:F5:74:DF

2004-01-01 00:24:58.224051 > HCI Event: Simple Pairing Complete (0x36) plen 7

    status 0x00 bdaddr C4:17:FE:F5:74:DF

2004-01-01 00:24:58.329211 > HCI Event: Link Key Notification (0x18) plen 23

    bdaddr C4:17:FE:F5:74:DF key 9DAA63E15700DAC5E321CFA90C251CAC type 5

    Type: Authenticated Combination Key

2004-01-01 00:24:58.329246 > HCI Event: Auth Complete (0x06) plen 3

    status 0x00 handle 256

2004-01-01 00:24:58.329536 < HCI Command: Set Connection Encryption (0x01|0x0013) plen 3

    handle 256 encrypt 0x01

2004-01-01 00:24:58.330803 > HCI Event: Command Status (0x0f) plen 4

    Set Connection Encryption (0x01|0x0013) status 0x00 ncmd 1

2004-01-01 00:24:58.331115 > HCI Event: Encrypt Change (0x08) plen 4

    status 0x23 handle 256 encrypt 0x00

    Error: LMP Error Transaction Collision

2004-01-01 00:24:58.334127 < HCI Command: Disconnect (0x01|0x0006) plen 3

    handle 256 reason 0x13

    Reason: Remote User Terminated Connection

2004-01-01 00:24:58.335829 > HCI Event: Command Status (0x0f) plen 4

    Disconnect (0x01|0x0006) status 0x00 ncmd 1

2004-01-01 00:24:58.505066 > HCI Event: Disconn Complete (0x05) plen 4

    status 0x00 handle 256 reason 0x16

    Reason: Connection Terminated by Local Host

2004-01-01 00:25:01.005023 < HCI Command: Create Connection (0x01|0x0005) plen 13

    bdaddr C4:17:FE:F5:74:DF ptype 0xcc18 rswitch 0x01 clkoffset 0x0000

    Packet type: DM1 DM3 DM5 DH1 DH3 DH5

2004-01-01 00:25:01.012243 > HCI Event: Command Status (0x0f) plen 4

    Create Connection (0x01|0x0005) status 0x00 ncmd 1

2004-01-01 00:25:04.143950 > HCI Event: Role Change (0x12) plen 8

    status 0x00 bdaddr C4:17:FE:F5:74:DF role 0x01

    Role: Slave

2004-01-01 00:25:04.302687 > HCI Event: Connect Complete (0x03) plen 11

    status 0x00 handle 256 bdaddr C4:17:FE:F5:74:DF type ACL encrypt 0x00

2004-01-01 00:25:04.302884 < HCI Command: Read Remote Supported Features (0x01|0x001b) plen 2

    handle 256

2004-01-01 00:25:04.309310 > HCI Event: Command Status (0x0f) plen 4

    Read Remote Supported Features (0x01|0x001b) status 0x00 ncmd 1

2004-01-01 00:25:04.309339 > HCI Event: Max Slots Change (0x1b) plen 3

    handle 256 slots 5

2004-01-01 00:25:04.316336 > HCI Event: Read Remote Supported Features (0x0b) plen 11

    status 0x00 handle 256

    Features: 0xff 0xff 0x8f 0xfe 0x9b 0xff 0x79 0x83

2004-01-01 00:25:04.316805 < HCI Command: Read Remote Extended Features (0x01|0x001c) plen 3

    handle 256 page 1

2004-01-01 00:25:04.318293 > HCI Event: Command Status (0x0f) plen 4

    Read Remote Extended Features (0x01|0x001c) status 0x00 ncmd 1

2004-01-01 00:25:04.323696 > HCI Event: Read Remote Extended Features (0x23) plen 13

    status 0x00 handle 256 page 1 max 0

    Features: 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00

2004-01-01 00:25:04.323868 < ACL data: handle 256 flags 0x00 dlen 10

    L2CAP(s): Info req: type 2

2004-01-01 00:25:04.342133 > HCI Event: Number of Completed Packets (0x13) plen 5

    handle 256 packets 1

2004-01-01 00:25:04.347449 > ACL data: handle 256 flags 0x02 dlen 12

    L2CAP(s): Info rsp: type 2 result 1

      Not supported

2004-01-01 00:25:04.347614 < ACL data: handle 256 flags 0x00 dlen 10

    L2CAP(s): Info req: type 3

2004-01-01 00:25:04.364833 < HCI Command: Remote Name Request (0x01|0x0019) plen 10

    bdaddr C4:17:FE:F5:74:DF mode 2 clkoffset 0x0000

2004-01-01 00:25:04.366772 > HCI Event: Command Status (0x0f) plen 4

    Remote Name Request (0x01|0x0019) status 0x00 ncmd 1

2004-01-01 00:25:10.563930 > HCI Event: Number of Completed Packets (0x13) plen 5

    handle 256 packets 1

2004-01-01 00:25:10.565921 > ACL data: handle 256 flags 0x02 dlen 12

    L2CAP(s): Info rsp: type 3 result 1

      Not supported

2004-01-01 00:25:10.566069 < ACL data: handle 256 flags 0x00 dlen 12

    L2CAP(s): Connect req: psm 1 scid 0x0040

2004-01-01 00:25:40.756957 > HCI Event: Remote Name Req Complete (0x07) plen 255

    status 0x22 bdaddr C4:17:FE:F5:74:DF name ''

    Error: LMP Response Timeout

2004-01-01 00:25:40.756993 > HCI Event: Disconn Complete (0x05) plen 4

    status 0x00 handle 256 reason 0x22

    Reason: LMP Response Timeout

Signed-off-by: mohanan <rajmohan.mohanan@intel.com>
---
 include/net/bluetooth/hci.h      |    1 +
 include/net/bluetooth/hci_core.h |   11 ++++++-----
 net/bluetooth/hci_conn.c         |   22 +++++++++++++++++++++-
 net/bluetooth/hci_event.c        |   16 ++++++++++------
 4 files changed, 38 insertions(+), 12 deletions(-)

diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 22ddaf3..e2eefdd 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -108,6 +108,7 @@ enum {
 #define HCI_PAIRING_TIMEOUT	(60000)	/* 60 seconds */
 #define HCI_IDLE_TIMEOUT	(6000)	/* 6 seconds */
 #define HCI_INIT_TIMEOUT	(10000)	/* 10 seconds */
+#define HCI_ENCRYPTION_TIMEOUT (1000) /*1 seconds*/
 
 /* HCI data types */
 #define HCI_COMMAND_PKT		0x01
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 7a1c03d..e426786 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -197,10 +197,11 @@ struct hci_conn {
 	__u16            pkt_type;
 	__u16            link_policy;
 	__u32		 link_mode;
-	__u8             auth_type;
-	__u8             sec_level;
-	__u8             power_save;
-	__u16            disc_timeout;
+	__u8         auth_type;
+	__u8         sec_level;
+	__u8         power_save;
+	__u16        disc_timeout;
+	__u16        encrypt_timeout;   
 	unsigned long	 pend;
 
 	unsigned int	 sent;
@@ -209,7 +210,7 @@ struct hci_conn {
 
 	struct timer_list disc_timer;
 	struct timer_list idle_timer;
-
+    struct timer_list encrypt_timer;
 	struct work_struct work_add;
 	struct work_struct work_del;
 
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 2f4d30f..22a6df0 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -195,7 +195,23 @@ static void hci_conn_idle(unsigned long arg)
 
 	hci_conn_enter_sniff_mode(conn);
 }
+static void hci_conn_encryption(unsigned long arg)
+{
+	struct hci_conn *conn = (void *) arg;
+    
+	BT_DBG("Encryption status check");
 
+	if((conn) && (test_and_clear_bit(HCI_CONN_ENCRYPT_PEND,&conn->pend)))
+	{
+		struct hci_dev *hdev = conn->hdev;
+		del_timer(&conn->encrypt_timer);
+		struct hci_cp_set_conn_encrypt cp;
+		cp.handle  = conn->handle;
+		cp.encrypt = 0x01;
+		hci_send_cmd(hdev, HCI_OP_SET_CONN_ENCRYPT,
+					sizeof(cp), &cp);
+	}
+}
 struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type,
 					__u16 pkt_type, bdaddr_t *dst)
 {
@@ -216,6 +232,7 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type,
 
 	conn->power_save = 1;
 	conn->disc_timeout = HCI_DISCONN_TIMEOUT;
+	conn->encrypt_timeout = HCI_ENCRYPTION_TIMEOUT;
 
 	switch (type) {
 	case ACL_LINK:
@@ -245,6 +262,7 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type,
 
 	setup_timer(&conn->disc_timer, hci_conn_timeout, (unsigned long)conn);
 	setup_timer(&conn->idle_timer, hci_conn_idle, (unsigned long)conn);
+	setup_timer(&conn->encrypt_timer, hci_conn_encryption, (unsigned long)conn);
 
 	atomic_set(&conn->refcnt, 0);
 
@@ -275,6 +293,8 @@ int hci_conn_del(struct hci_conn *conn)
 
 	del_timer(&conn->disc_timer);
 
+	del_timer(&conn->encrypt_timer);
+
 	if (conn->type == ACL_LINK) {
 		struct hci_conn *sco = conn->link;
 		if (sco)
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index f7229d2..75719b4 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -1,6 +1,5 @@
 /*
    BlueZ - Bluetooth protocol stack for Linux
-   Copyright (C) 2012 Intel Mobile Communications GmbH
    Copyright (C) 2000-2001 Qualcomm Incorporated
 
    Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
@@ -21,9 +20,6 @@
    ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
    COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
    SOFTWARE IS DISCLAIMED.
-
-notes:
-   18-Jan-2012 Added handling for hci flowspec complete event.
 */
 
 /* Bluetooth HCI event handling. */
@@ -1107,7 +1103,7 @@ static inline void hci_encrypt_change_evt(struct hci_dev *hdev, struct sk_buff *
 {
 	struct hci_ev_encrypt_change *ev = (void *) skb->data;
 	struct hci_conn *conn;
-
+    unsigned long timeo;
 	BT_DBG("%s status %d", hdev->name, ev->status);
 
 	hci_dev_lock(hdev);
@@ -1115,6 +1111,7 @@ static inline void hci_encrypt_change_evt(struct hci_dev *hdev, struct sk_buff *
 	conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle));
 	if (conn) {
 		if (!ev->status) {
+			del_timer(&conn->encrypt_timer);
 			if (ev->encrypt) {
 				/* Encryption implies authentication */
 				conn->link_mode |= HCI_LM_AUTH;
@@ -1122,6 +1119,13 @@ static inline void hci_encrypt_change_evt(struct hci_dev *hdev, struct sk_buff *
 			} else
 				conn->link_mode &= ~HCI_LM_ENCRYPT;
 		}
+	   else if(ev->status == 0x23)
+	   {
+	   		BT_DBG("LMP transactioon collision happened, we need to wait");
+			timeo = msecs_to_jiffies(conn->encrypt_timeout);
+		    mod_timer(&conn->encrypt_timer, jiffies + timeo);
+			goto done;
+	   }
 
 		clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend);
 
@@ -1134,7 +1138,7 @@ static inline void hci_encrypt_change_evt(struct hci_dev *hdev, struct sk_buff *
 		} else
 			hci_encrypt_cfm(conn, ev->status, ev->encrypt);
 	}
-
+done:
 	hci_dev_unlock(hdev);
 }
 
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] LMP transaction collision at Set encryption
  2012-02-14  8:57 ` [PATCH] LMP transaction collision at Set encryption rajmohan.mohanan
@ 2012-02-14 11:33   ` Luiz Augusto von Dentz
  2012-02-14 13:16     ` Mohanan, Rajmohan
  2012-02-15 12:29   ` Marcel Holtmann
  1 sibling, 1 reply; 6+ messages in thread
From: Luiz Augusto von Dentz @ 2012-02-14 11:33 UTC (permalink / raw)
  To: rajmohan.mohanan; +Cc: linux-bluetooth

Hi,

On Tue, Feb 14, 2012 at 10:57 AM,  <rajmohan.mohanan@intel.com> wrote:
> From: mohanan <rajmohan.mohanan@intel.com>
>
> ISSUE:
> 1. started pairing from my device(DUT) to a remote device (Lenovo T500). After successful bonding bluez send device discovery in the same ACL connection createdprior to BONDING
> 2. Changed to DUT role as slave.
> 3. From Host ,sending Set Connection Encryption, getting LMP Error Transaction Collision as status of  encryption command sent by DUT(Slave).(Remote guy who is a master has also initiated Set encryption).
> 4. In between bluez has initiated SDP search after bonding process complete(device_bonding_complete()).
> 5. From the encryption change event (event status is 0x23(LMP transaction collision),Bluez disconnecting l2cap and then acl link.
> We are not able Find the services of remote device because application written in spite of service discovery has initiated after bonding process

This stack that you are running in Lenovo T500 is really weird,
forcing master every time it connects and always starting sdp
immediately will for sure cause problems with other stacks too, afaik
even BITE tester does not like our reverse sdp which is not
immediately (2 sec.).

Anyway the point of not disconnecting on collision seems valid, btw
please start with "Bluetooth:..." when submitting patches to Linux
kernel.

> diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
> index 22ddaf3..e2eefdd 100644
> --- a/include/net/bluetooth/hci.h
> +++ b/include/net/bluetooth/hci.h
> @@ -108,6 +108,7 @@ enum {
>  #define HCI_PAIRING_TIMEOUT    (60000) /* 60 seconds */
>  #define HCI_IDLE_TIMEOUT       (6000)  /* 6 seconds */
>  #define HCI_INIT_TIMEOUT       (10000) /* 10 seconds */
> +#define HCI_ENCRYPTION_TIMEOUT (1000) /*1 seconds*/
>
>  /* HCI data types */
>  #define HCI_COMMAND_PKT                0x01
> diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
> index 7a1c03d..e426786 100644
> --- a/include/net/bluetooth/hci_core.h
> +++ b/include/net/bluetooth/hci_core.h
> @@ -197,10 +197,11 @@ struct hci_conn {
>        __u16            pkt_type;
>        __u16            link_policy;
>        __u32            link_mode;
> -       __u8             auth_type;
> -       __u8             sec_level;
> -       __u8             power_save;
> -       __u16            disc_timeout;
> +       __u8         auth_type;
> +       __u8         sec_level;
> +       __u8         power_save;
> +       __u16        disc_timeout;
> +       __u16        encrypt_timeout;

It seems you are changing other lines instead of just adding
encrypt_timeout, make sure you/your editor is not adding spaces
instead of tabs for some reason.

>        unsigned long    pend;
>
>        unsigned int     sent;
> @@ -209,7 +210,7 @@ struct hci_conn {
>
>        struct timer_list disc_timer;
>        struct timer_list idle_timer;
> -
> +    struct timer_list encrypt_timer;
>        struct work_struct work_add;
>        struct work_struct work_del;

Grouping timer_list together but you don't need to remove the empty
line that separate them to the work_struct.

> diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
> index 2f4d30f..22a6df0 100644
> --- a/net/bluetooth/hci_conn.c
> +++ b/net/bluetooth/hci_conn.c
> @@ -195,7 +195,23 @@ static void hci_conn_idle(unsigned long arg)
>
>        hci_conn_enter_sniff_mode(conn);
>  }
> +static void hci_conn_encryption(unsigned long arg)
> +{
> +       struct hci_conn *conn = (void *) arg;
> +
> +       BT_DBG("Encryption status check");
>
> +       if((conn) && (test_and_clear_bit(HCI_CONN_ENCRYPT_PEND,&conn->pend)))
> +       {
> +               struct hci_dev *hdev = conn->hdev;
> +               del_timer(&conn->encrypt_timer);
> +               struct hci_cp_set_conn_encrypt cp;
> +               cp.handle  = conn->handle;
> +               cp.encrypt = 0x01;
> +               hci_send_cmd(hdev, HCI_OP_SET_CONN_ENCRYPT,
> +                                       sizeof(cp), &cp);
> +       }
> +}

No need to duplicate code of hci_conn_encrypt, you can just call it,
also I would call it hci_conn_encrypt_timeout to make clear this run
on timer context and avoid confusion with hci_conn_encrypt. Btw I
don't think you really need to use del_timer inside the callback since
we don't use on other timeout handlers.

> -   Copyright (C) 2012 Intel Mobile Communications GmbH

This is not upstream, it wont apply.

>    Copyright (C) 2000-2001 Qualcomm Incorporated
>
>    Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
> @@ -21,9 +20,6 @@
>    ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
>    COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
>    SOFTWARE IS DISCLAIMED.
> -
> -notes:
> -   18-Jan-2012 Added handling for hci flowspec complete event.

Neither this.

> +          else if(ev->status == 0x23)
> +          {
> +                       BT_DBG("LMP transactioon collision happened, we need to wait");
> +                       timeo = msecs_to_jiffies(conn->encrypt_timeout);
> +                   mod_timer(&conn->encrypt_timer, jiffies + timeo);
> +                       goto done;
> +          }

Formatting here is wrong please check the coding style, also if the
remote stack run the same code (BlueZ vs BlueZ) it is going to collide
again after timer expire, so perhaps you should be checking if it is
master resend immediately otherwise wait for master.

-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH] LMP transaction collision at Set encryption
  2012-02-14 11:33   ` Luiz Augusto von Dentz
@ 2012-02-14 13:16     ` Mohanan, Rajmohan
  0 siblings, 0 replies; 6+ messages in thread
From: Mohanan, Rajmohan @ 2012-02-14 13:16 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth@vger.kernel.org

Hi,
      I could not really get what is the point " No need to duplicate code of hci_conn_encrypt, you can just call it ".Could you please explain ?
I will change the function name as you suggested and will remove the delete timer.

> +static void hci_conn_encryption(unsigned long arg) {
> +       struct hci_conn *conn = (void *) arg;
> +
> +       BT_DBG("Encryption status check");
>
> +       if((conn) && 
> +(test_and_clear_bit(HCI_CONN_ENCRYPT_PEND,&conn->pend)))
> +       {
> +               struct hci_dev *hdev = conn->hdev;
> +               del_timer(&conn->encrypt_timer);
> +               struct hci_cp_set_conn_encrypt cp;
> +               cp.handle  = conn->handle;
> +               cp.encrypt = 0x01;
> +               hci_send_cmd(hdev, HCI_OP_SET_CONN_ENCRYPT,
> +                                       sizeof(cp), &cp);
> +       }
> +}

No need to duplicate code of hci_conn_encrypt, you can just call it, also I would call it hci_conn_encrypt_timeout to make clear this run on timer context and avoid confusion with hci_conn_encrypt. Btw I don't think you really need to use del_timer inside the callback since we don't use on other timeout handlers.

Regards
Rajmohan
-----Original Message-----
From: Luiz Augusto von Dentz [mailto:luiz.dentz@gmail.com] 
Sent: Tuesday, February 14, 2012 5:03 PM
To: Mohanan, Rajmohan
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH] LMP transaction collision at Set encryption

Hi,

On Tue, Feb 14, 2012 at 10:57 AM,  <rajmohan.mohanan@intel.com> wrote:
> From: mohanan <rajmohan.mohanan@intel.com>
>
> ISSUE:
> 1. started pairing from my device(DUT) to a remote device (Lenovo 
> T500). After successful bonding bluez send device discovery in the same ACL connection createdprior to BONDING 2. Changed to DUT role as slave.
> 3. From Host ,sending Set Connection Encryption, getting LMP Error Transaction Collision as status of  encryption command sent by DUT(Slave).(Remote guy who is a master has also initiated Set encryption).
> 4. In between bluez has initiated SDP search after bonding process complete(device_bonding_complete()).
> 5. From the encryption change event (event status is 0x23(LMP transaction collision),Bluez disconnecting l2cap and then acl link.
> We are not able Find the services of remote device because application 
> written in spite of service discovery has initiated after bonding 
> process

This stack that you are running in Lenovo T500 is really weird, forcing master every time it connects and always starting sdp immediately will for sure cause problems with other stacks too, afaik even BITE tester does not like our reverse sdp which is not immediately (2 sec.).

Anyway the point of not disconnecting on collision seems valid, btw please start with "Bluetooth:..." when submitting patches to Linux kernel.

> diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h 
> index 22ddaf3..e2eefdd 100644
> --- a/include/net/bluetooth/hci.h
> +++ b/include/net/bluetooth/hci.h
> @@ -108,6 +108,7 @@ enum {
>  #define HCI_PAIRING_TIMEOUT    (60000) /* 60 seconds */
>  #define HCI_IDLE_TIMEOUT       (6000)  /* 6 seconds */
>  #define HCI_INIT_TIMEOUT       (10000) /* 10 seconds */
> +#define HCI_ENCRYPTION_TIMEOUT (1000) /*1 seconds*/
>
>  /* HCI data types */
>  #define HCI_COMMAND_PKT                0x01 diff --git 
> a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
> index 7a1c03d..e426786 100644
> --- a/include/net/bluetooth/hci_core.h
> +++ b/include/net/bluetooth/hci_core.h
> @@ -197,10 +197,11 @@ struct hci_conn {
>        __u16            pkt_type;
>        __u16            link_policy;
>        __u32            link_mode;
> -       __u8             auth_type;
> -       __u8             sec_level;
> -       __u8             power_save;
> -       __u16            disc_timeout;
> +       __u8         auth_type;
> +       __u8         sec_level;
> +       __u8         power_save;
> +       __u16        disc_timeout;
> +       __u16        encrypt_timeout;

It seems you are changing other lines instead of just adding encrypt_timeout, make sure you/your editor is not adding spaces instead of tabs for some reason.

>        unsigned long    pend;
>
>        unsigned int     sent;
> @@ -209,7 +210,7 @@ struct hci_conn {
>
>        struct timer_list disc_timer;
>        struct timer_list idle_timer;
> -
> +    struct timer_list encrypt_timer;
>        struct work_struct work_add;
>        struct work_struct work_del;

Grouping timer_list together but you don't need to remove the empty line that separate them to the work_struct.

> diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 
> 2f4d30f..22a6df0 100644
> --- a/net/bluetooth/hci_conn.c
> +++ b/net/bluetooth/hci_conn.c
> @@ -195,7 +195,23 @@ static void hci_conn_idle(unsigned long arg)
>
>        hci_conn_enter_sniff_mode(conn);
>  }
> +static void hci_conn_encryption(unsigned long arg) {
> +       struct hci_conn *conn = (void *) arg;
> +
> +       BT_DBG("Encryption status check");
>
> +       if((conn) && 
> +(test_and_clear_bit(HCI_CONN_ENCRYPT_PEND,&conn->pend)))
> +       {
> +               struct hci_dev *hdev = conn->hdev;
> +               del_timer(&conn->encrypt_timer);
> +               struct hci_cp_set_conn_encrypt cp;
> +               cp.handle  = conn->handle;
> +               cp.encrypt = 0x01;
> +               hci_send_cmd(hdev, HCI_OP_SET_CONN_ENCRYPT,
> +                                       sizeof(cp), &cp);
> +       }
> +}

No need to duplicate code of hci_conn_encrypt, you can just call it, also I would call it hci_conn_encrypt_timeout to make clear this run on timer context and avoid confusion with hci_conn_encrypt. Btw I don't think you really need to use del_timer inside the callback since we don't use on other timeout handlers.

> -   Copyright (C) 2012 Intel Mobile Communications GmbH

This is not upstream, it wont apply.

>    Copyright (C) 2000-2001 Qualcomm Incorporated
>
>    Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com> @@ -21,9 
> +20,6 @@
>    ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
>    COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
>    SOFTWARE IS DISCLAIMED.
> -
> -notes:
> -   18-Jan-2012 Added handling for hci flowspec complete event.

Neither this.

> +          else if(ev->status == 0x23)
> +          {
> +                       BT_DBG("LMP transactioon collision happened, 
> + we need to wait");
> +                       timeo = 
> + msecs_to_jiffies(conn->encrypt_timeout);
> +                   mod_timer(&conn->encrypt_timer, jiffies + timeo);
> +                       goto done;
> +          }

Formatting here is wrong please check the coding style, also if the remote stack run the same code (BlueZ vs BlueZ) it is going to collide again after timer expire, so perhaps you should be checking if it is master resend immediately otherwise wait for master.

--
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] LMP transaction collision at Set encryption
  2012-02-14  8:57 ` [PATCH] LMP transaction collision at Set encryption rajmohan.mohanan
  2012-02-14 11:33   ` Luiz Augusto von Dentz
@ 2012-02-15 12:29   ` Marcel Holtmann
  2012-02-17  4:41     ` Mohanan, Rajmohan
  1 sibling, 1 reply; 6+ messages in thread
From: Marcel Holtmann @ 2012-02-15 12:29 UTC (permalink / raw)
  To: rajmohan.mohanan; +Cc: linux-bluetooth

Hi Rajmohan,

> ISSUE:
> 1. started pairing from my device(DUT) to a remote device (Lenovo T500). After successful bonding bluez send device discovery in the same ACL connection createdprior to BONDING
> 2. Changed to DUT role as slave.
> 3. From Host ,sending Set Connection Encryption, getting LMP Error Transaction Collision as status of  encryption command sent by DUT(Slave).(Remote guy who is a master has also initiated Set encryption).
> 4. In between bluez has initiated SDP search after bonding process complete(device_bonding_complete()).
> 5. From the encryption change event (event status is 0x23(LMP transaction collision),Bluez disconnecting l2cap and then acl link.
> We are not able Find the services of remote device because application written in spite of service discovery has initiated after bonding process

please reformat this to keep it under 72 characters per line. Mainly so
that a git log in a 80 char wide terminal stays readable.

> FIX:
> Made changes in hci_event.c  for solving LMP Transaction collision.
> 
> When we gets Encrypt change event with error code as LMP  transaction collision , Ignoring the change event because From Master Encrypt change event will process and will get encrypt change event with success second time.
> 
> If we are not getting Encrypt change event from master we are sending again Set encryption from slave( because we already sent a set encryption which result in to a collision) after 1 second delay.
> 
> If we getting a encrypt change event from master after collision event then we delete timer and process it normally.

Same here.

> 
> HCIDUMP:
> 
> HCI sniffer - Bluetooth packet analyzer ver 1.42
> 
> device: hci0 snap_len: 1028 filter: 0xffffffff
> 
> 2004-01-01 00:24:28.201531 < HCI Command: Create Connection (0x01|0x0005) plen 13
> 
>     bdaddr C4:17:FE:F5:74:DF ptype 0xcc18 rswitch 0x01 clkoffset 0x0000
> 
>     Packet type: DM1 DM3 DM5 DH1 DH3 DH5

Please fix this up and remove the empty lines. I bet that you send this
through Exchange and one point and it messed it up for you, but it still
needs to be fixed.

> Signed-off-by: mohanan <rajmohan.mohanan@intel.com>

Please have a proper full name signed-off-by line. Same goes for From:.

> ---
>  include/net/bluetooth/hci.h      |    1 +
>  include/net/bluetooth/hci_core.h |   11 ++++++-----
>  net/bluetooth/hci_conn.c         |   22 +++++++++++++++++++++-
>  net/bluetooth/hci_event.c        |   16 ++++++++++------
>  4 files changed, 38 insertions(+), 12 deletions(-)
> 
> diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
> index 22ddaf3..e2eefdd 100644
> --- a/include/net/bluetooth/hci.h
> +++ b/include/net/bluetooth/hci.h
> @@ -108,6 +108,7 @@ enum {
>  #define HCI_PAIRING_TIMEOUT	(60000)	/* 60 seconds */
>  #define HCI_IDLE_TIMEOUT	(6000)	/* 6 seconds */
>  #define HCI_INIT_TIMEOUT	(10000)	/* 10 seconds */
> +#define HCI_ENCRYPTION_TIMEOUT (1000) /*1 seconds*/

Follow the coding style for comments. Example is right above.

>  
>  /* HCI data types */
>  #define HCI_COMMAND_PKT		0x01
> diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
> index 7a1c03d..e426786 100644
> --- a/include/net/bluetooth/hci_core.h
> +++ b/include/net/bluetooth/hci_core.h
> @@ -197,10 +197,11 @@ struct hci_conn {
>  	__u16            pkt_type;
>  	__u16            link_policy;
>  	__u32		 link_mode;
> -	__u8             auth_type;
> -	__u8             sec_level;
> -	__u8             power_save;
> -	__u16            disc_timeout;
> +	__u8         auth_type;
> +	__u8         sec_level;
> +	__u8         power_save;
> +	__u16        disc_timeout;
> +	__u16        encrypt_timeout;   

Follow our indentation and do not re-format things.

>  	unsigned long	 pend;
>  
>  	unsigned int	 sent;
> @@ -209,7 +210,7 @@ struct hci_conn {
>  
>  	struct timer_list disc_timer;
>  	struct timer_list idle_timer;
> -
> +    struct timer_list encrypt_timer;

I don't think this is against Johan's bluetooth-next tree. We converted
to workqueues.

>  	struct work_struct work_add;
>  	struct work_struct work_del;
>  
> diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
> index 2f4d30f..22a6df0 100644
> --- a/net/bluetooth/hci_conn.c
> +++ b/net/bluetooth/hci_conn.c
> @@ -195,7 +195,23 @@ static void hci_conn_idle(unsigned long arg)
>  
>  	hci_conn_enter_sniff_mode(conn);
>  }

Extra empty line here between functions. Please follow coding
convention.

> +static void hci_conn_encryption(unsigned long arg)
> +{
> +	struct hci_conn *conn = (void *) arg;
> +    
> +	BT_DBG("Encryption status check");
>  
> +	if((conn) && (test_and_clear_bit(HCI_CONN_ENCRYPT_PEND,&conn->pend)))

No (conn) and it is if<space>(. Please follow coding convention as you
see all through the code.

> +	{
> +		struct hci_dev *hdev = conn->hdev;
> +		del_timer(&conn->encrypt_timer);
> +		struct hci_cp_set_conn_encrypt cp;
> +		cp.handle  = conn->handle;
> +		cp.encrypt = 0x01;
> +		hci_send_cmd(hdev, HCI_OP_SET_CONN_ENCRYPT,
> +					sizeof(cp), &cp);
> +	}
> +}
>  struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type,
>  					__u16 pkt_type, bdaddr_t *dst)
>  {
> @@ -216,6 +232,7 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type,
>  
>  	conn->power_save = 1;
>  	conn->disc_timeout = HCI_DISCONN_TIMEOUT;
> +	conn->encrypt_timeout = HCI_ENCRYPTION_TIMEOUT;

Why are we doing this? It makes no sense. The timeout is always the
same. The case of the disconnect timeout is different since it changes.
So please remove this.

>  
>  	switch (type) {
>  	case ACL_LINK:
> @@ -245,6 +262,7 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type,
>  
>  	setup_timer(&conn->disc_timer, hci_conn_timeout, (unsigned long)conn);
>  	setup_timer(&conn->idle_timer, hci_conn_idle, (unsigned long)conn);
> +	setup_timer(&conn->encrypt_timer, hci_conn_encryption, (unsigned long)conn);

This reminds me. Shortcut encryption to encrypt like we do everywhere
else.

>  
>  	atomic_set(&conn->refcnt, 0);
>  
> @@ -275,6 +293,8 @@ int hci_conn_del(struct hci_conn *conn)
>  
>  	del_timer(&conn->disc_timer);
>  
> +	del_timer(&conn->encrypt_timer);
> +
>  	if (conn->type == ACL_LINK) {
>  		struct hci_conn *sco = conn->link;
>  		if (sco)
> diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
> index f7229d2..75719b4 100644
> --- a/net/bluetooth/hci_event.c
> +++ b/net/bluetooth/hci_event.c
> @@ -1,6 +1,5 @@
>  /*
>     BlueZ - Bluetooth protocol stack for Linux
> -   Copyright (C) 2012 Intel Mobile Communications GmbH
>     Copyright (C) 2000-2001 Qualcomm Incorporated
>  
>     Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
> @@ -21,9 +20,6 @@
>     ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
>     COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
>     SOFTWARE IS DISCLAIMED.
> -
> -notes:
> -   18-Jan-2012 Added handling for hci flowspec complete event.
>  */

No idea where this comes from, but it is not upstream. Patch has to
apply cleanly against Johan's bluetooth-next tree.
 
>  /* Bluetooth HCI event handling. */
> @@ -1107,7 +1103,7 @@ static inline void hci_encrypt_change_evt(struct hci_dev *hdev, struct sk_buff *
>  {
>  	struct hci_ev_encrypt_change *ev = (void *) skb->data;
>  	struct hci_conn *conn;
> -
> +    unsigned long timeo;
>  	BT_DBG("%s status %d", hdev->name, ev->status);

Please keep the coding style.

>  
>  	hci_dev_lock(hdev);
> @@ -1115,6 +1111,7 @@ static inline void hci_encrypt_change_evt(struct hci_dev *hdev, struct sk_buff *
>  	conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle));
>  	if (conn) {
>  		if (!ev->status) {
> +			del_timer(&conn->encrypt_timer);
>  			if (ev->encrypt) {
>  				/* Encryption implies authentication */
>  				conn->link_mode |= HCI_LM_AUTH;
> @@ -1122,6 +1119,13 @@ static inline void hci_encrypt_change_evt(struct hci_dev *hdev, struct sk_buff *
>  			} else
>  				conn->link_mode &= ~HCI_LM_ENCRYPT;
>  		}
> +	   else if(ev->status == 0x23)
> +	   {

Please keep the coding style.

> +	   		BT_DBG("LMP transactioon collision happened, we need to wait");
> +			timeo = msecs_to_jiffies(conn->encrypt_timeout);
> +		    mod_timer(&conn->encrypt_timer, jiffies + timeo);

And once more.

> +			goto done;
> +	   }
>  
>  		clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend);
>  
> @@ -1134,7 +1138,7 @@ static inline void hci_encrypt_change_evt(struct hci_dev *hdev, struct sk_buff *
>  		} else
>  			hci_encrypt_cfm(conn, ev->status, ev->encrypt);
>  	}
> -
> +done:
>  	hci_dev_unlock(hdev);
>  }
>  

Regards

Marcel



^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH] LMP transaction collision at Set encryption
  2012-02-15 12:29   ` Marcel Holtmann
@ 2012-02-17  4:41     ` Mohanan, Rajmohan
  2012-02-17  8:53       ` Marcel Holtmann
  0 siblings, 1 reply; 6+ messages in thread
From: Mohanan, Rajmohan @ 2012-02-17  4:41 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: linux-bluetooth@vger.kernel.org

SGksDQogICAgICBJbiBMbXAgdHJhbnNhY3Rpb24gY29sbGlzaW9uIGhhcHBlbnMgYXQgc2V0IGVu
Y3J5cHRpb24gcmVxdWVzdCAsDQogICAgIGlmIGVuY3J5cHQgY2hhbmdlIGV2ZW50IHdpdGggc3Rh
dHVzIGNvZGUgIiBMTVAgdHJhbnNhY3Rpb24gY29sbGlzaW9uICJjb21lcyBhbmQgd2lsbCBzdGFy
dCB0aGUgZGlzY29ubmVjdGlvbiBwcm9jZWR1cmUuDQogICAgIElmIGVuY3J5cHRpb24gY2hhbmdl
IGV2ZW50IHdpdGggc3VjY2VzcyhNYXN0ZXIgaW5pdGlhdGVkKSAgY29tZXMgd2l0aCBpbi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nQoc3RydWN0IGhjaV9kZXYgKmhkZXYsIHN0cnVjdCBza19idWZmICoNCj4gIAkJfSBlbHNlDQo+
ICAJCQloY2lfZW5jcnlwdF9jZm0oY29ubiwgZXYtPnN0YXR1cywgZXYtPmVuY3J5cHQpOw0KPiAg
CX0NCj4gLQ0KPiArZG9uZToNCj4gIAloY2lfZGV2X3VubG9jayhoZGV2KTsNCj4gIH0NCj4gIA0K
DQpSZWdhcmRzDQoNCk1hcmNlbA0KDQoNCg==

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH] LMP transaction collision at Set encryption
  2012-02-17  4:41     ` Mohanan, Rajmohan
@ 2012-02-17  8:53       ` Marcel Holtmann
  0 siblings, 0 replies; 6+ messages in thread
From: Marcel Holtmann @ 2012-02-17  8:53 UTC (permalink / raw)
  To: Mohanan, Rajmohan; +Cc: linux-bluetooth@vger.kernel.org

Hi Rajmohan,

please refrain from top-posting on the mailing list. Please do inline
quoting.

>       In Lmp transaction collision happens at set encryption request ,
>      if encrypt change event with status code " LMP transaction collision "comes and will start the disconnection procedure.
>      If encryption change event with success(Master initiated)  comes with in 10 millisecond, then conn->refcount will go to a negative   value(because hci_conn_put is calling and it will decrement the reference count which was zero already  in the previous error response). At this time disconnection won't happen but the reference count value went to negative which will make the timer operations in a bad state. I have faced this issue two times.
> 
> If I'm misunderstood please correct me.
> 
> So the patch  solves this issue also.

Please reply to patches properly. I have not idea what the above
statement has to do with my review.

Regards

Marcel



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-02-17  8:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <LMP Transaction collision>
2012-02-14  8:57 ` [PATCH] LMP transaction collision at Set encryption rajmohan.mohanan
2012-02-14 11:33   ` Luiz Augusto von Dentz
2012-02-14 13:16     ` Mohanan, Rajmohan
2012-02-15 12:29   ` Marcel Holtmann
2012-02-17  4:41     ` Mohanan, Rajmohan
2012-02-17  8:53       ` Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).