Re: [patch] BNEP/PAN Qualification issues

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I got my hand over a BNEP and PAN test plan and tried to pass it with current PAN implementation (pand, not network service). I met several issues and tried to find some solutions to them.

* Handling of 32 and 128 bits uuids,
* Correct response to invalid uuids,
* Respond to control messages before connection setup,
* Handling of bnep extension together with general headers,
* Handling of bnep extensions together with setup connection requests.
* Forwarding of unknown BNEP extensions (not available for broadcast, advice requested),
* Give up pan connection after 30 seconds,

The result of that work is two patchs, one for the kernel (based on latest git) and one for pand (a bit old that one I fear). However, it should be easy to get similar patch for network service.

I need both patches in unified diff format (-u). I am not a machine and
can't read context diffs.

Please break up the kernel patch in small chunks that solve each
problem. It is easier for me to review them and then apply them.

Sorry for long delay, i was ooto. Will split patch and send with -u.
For now here is first patch for pand and network service.

Give up pan connection after 30 seconds
TP/BNEP/CTRL/BV-02-C


Marcel, Luiz,
A part of the patch si to move handling of incoming setup_conn_req in kernel. In order to keep pan working with older kernel, some differenciation must be done. How to achieve this ?

Regards,
Frederic


diff --git a/pand/bnep.c b/pand/bnep.c
index 604ed55..88c1184 100644
--- a/pand/bnep.c
+++ b/pand/bnep.c
@@ -259,6 +259,7 @@ int bnep_create_connection(int sk, uint16_t role, uint16_t svc, char *dev)
 	struct __service_16 *s;
 	unsigned char pkt[BNEP_MTU];
 	int r;
+	struct timeval t = { 30, 0 };
 
 	/* Send request */
 	req = (void *) pkt;
@@ -269,6 +270,8 @@ int bnep_create_connection(int sk, uint16_t role, uint16_t svc, char *dev)
 	s->dst = htons(svc);
 	s->src = htons(role);
 
+	setsockopt(sk, SOL_SOCKET, SO_RCVTIMEO, &t, sizeof(t));
+
 	if (send(sk, pkt, sizeof(*req) + sizeof(*s), 0) < 0)
 		return -1;
 
@@ -278,6 +281,9 @@ receive:
 	if (r <= 0)
 		return -1;
 
+	t.tv_sec = 0;
+	setsockopt(sk, SOL_SOCKET, SO_RCVTIMEO, &t, sizeof(t));
+
 	errno = EPROTO;
 
 	if (r < sizeof(*rsp))
diff --git a/network/connection.c b/network/connection.c
index 057fbba..9d09e83 100644
--- a/network/connection.c
+++ b/network/connection.c
@@ -109,6 +109,7 @@ static gboolean bnep_connect_cb(GIOChannel *chan, GIOCondition cond,
 	int sk;
 	DBusMessage *reply;
 	const char *pdev;
+	struct timeval t = { 0, 0 };
 
 	if (cond & G_IO_NVAL)
 		return FALSE;
@@ -155,6 +156,8 @@ static gboolean bnep_connect_cb(GIOChannel *chan, GIOCondition cond,
 
 	sk = g_io_channel_unix_get_fd(chan);
 
+	setsockopt(sk, SOL_SOCKET, SO_RCVTIMEO, &t, sizeof(t));
+
 	if (bnep_connadd(sk, BNEP_SVC_PANU, nc->dev)) {
 		error("%s could not be added", nc->dev);
 		goto failed;
@@ -196,6 +199,7 @@ static int bnep_connect(struct network_conn *nc)
 	unsigned char pkt[BNEP_MTU];
 	GIOChannel *io;
 	int err = 0;
+	struct timeval t = { 30, 0 };
 
 	/* Send request */
 	req = (void *) pkt;
@@ -206,6 +210,8 @@ static int bnep_connect(struct network_conn *nc)
 	s->dst = htons(nc->id);
 	s->src = htons(BNEP_SVC_PANU);
 
+	setsockopt(nc->sk, SOL_SOCKET, SO_RCVTIMEO, &t, sizeof(t));
+
 	io = g_io_channel_unix_new(nc->sk);
 	g_io_channel_set_close_on_unref(io, FALSE);
 
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Bluez-devel mailing list
Bluez-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/bluez-devel

[Index of Archives]     [Linux Bluetooth Devel]     [Linux USB Devel]     [Network Devel]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux