All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Frédéric Dalleau" <frederic.dalleau@access-company.com>
To: BlueZ development <bluez-devel@lists.sourceforge.net>
Subject: Re: [Bluez-devel] [patch] BNEP/PAN Qualification issues
Date: Thu, 22 May 2008 13:01:29 +0200	[thread overview]
Message-ID: <48355289.7070906@access-company.com> (raw)
In-Reply-To: <1209058941.12684.37.camel@violet.holtmann.net>

[-- Attachment #1: Type: text/plain, Size: 1499 bytes --]

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



[-- Attachment #2: pand.timeout.patch --]
[-- Type: text/x-patch, Size: 797 bytes --]

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))

[-- Attachment #3: network.timeout.patch --]
[-- Type: text/x-patch, Size: 1148 bytes --]

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);
 

[-- Attachment #4: Type: text/plain, Size: 228 bytes --]

-------------------------------------------------------------------------
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/

[-- Attachment #5: Type: text/plain, Size: 164 bytes --]

_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

  reply	other threads:[~2008-05-22 11:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-17 14:15 [Bluez-devel] [patch] BNEP/PAN Qualification issues Frédéric Dalleau
2008-04-17 18:17 ` Luiz Augusto von Dentz
2008-04-17 18:26   ` Marcel Holtmann
2008-04-17 20:42     ` Claudio Takahasi
2008-04-24 17:42 ` Marcel Holtmann
2008-05-22 11:01   ` Frédéric Dalleau [this message]
2008-05-22 11:48     ` Marcel Holtmann
2008-05-22 14:05       ` Frédéric Dalleau
2008-07-01 17:04         ` Frédéric Dalleau
2008-07-17  9:44           ` Frédéric Dalleau
2008-07-19 15:14             ` Luiz Augusto von Dentz
2008-08-07 22:34           ` Marcel Holtmann
2008-09-08  8:57             ` Frédéric Dalleau
2008-09-08  9:32               ` Marcel Holtmann

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=48355289.7070906@access-company.com \
    --to=frederic.dalleau@access-company.com \
    --cc=bluez-devel@lists.sourceforge.net \
    /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.