BNEP/PAN Qualification issues
Subsystems (2)
PATCH 1/1 BNEP/PAN Qualification issues
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.
Let me know if this is of interest for you !
BR,
Frédéric
net/bluetooth/bnep/bnep.h +2 -0
@@ -170,6 +170,8 @@ struct bnep_session {struct socket *sock;struct net_device *dev;struct net_device_stats stats; + +int setup; };void bnep_net_setup (struct net_device *dev);
net/bluetooth/bnep/core.c +190 -18
322 lines not on this page · raw message
==== //dev/ALP/main/open-source/bluez-utils/dist/pand/bnep.c#2 - /home/fdalleau/perforce/dev/ALP/main/open-source/bluez-utils/dist/pand/bnep.c ==== 183c183
< static int bnep_connadd(int sk, uint16_t role, char *dev)
---
Quoted 1 line
static int
bnep_connadd(int sk, uint16_t role, char *dev, int setup_done)
189a190
Quoted 1 line
req.flags = setup_done;
219,357c220
< struct bnep_setup_conn_req *req;
< struct bnep_control_rsp *rsp;
< unsigned char pkt[BNEP_MTU];
< char alignreq[50];
< uint16_t *service16;
<
< int r;
<
< r = recv(sk, pkt, BNEP_MTU, 0);
< if (r <= 0)
< return -1;
<
< errno = EPROTO;
<
< if (r < sizeof(*req))
< return -1;
<
< req = (void *) pkt;
< if (req->type != BNEP_CONTROL || req->ctrl != BNEP_SETUP_CONN_REQ)
< return -1;
<
< /* Check role UUIDs */
<
< //DST UUID
< memcpy(alignreq, &req->service, req->uuid_size);
< service16 = (uint16_t *)alignreq;
<
< switch(req->uuid_size) {
< case 2:
< if((ntohs(*service16) != BNEP_SVC_PANU)
< && (ntohs(*service16) != BNEP_SVC_NAP)
< && (ntohs(*service16) != BNEP_SVC_GN))
< goto failed;
< break;
< case 4:
< if(ntohs(*service16) != 0x0000)
< goto failed;
< service16++;
< if((ntohs(*service16) != BNEP_SVC_PANU)
< && (ntohs(*service16) != BNEP_SVC_NAP)
< && (ntohs(*service16) != BNEP_SVC_GN))
< goto failed;
< break;
< case 16:
< if(ntohs(*service16) != 0x0000)
< goto failed;
< service16++;
< if((ntohs(*service16) != BNEP_SVC_PANU)
< && (ntohs(*service16) != BNEP_SVC_NAP)
< && (ntohs(*service16) != BNEP_SVC_GN))
< goto failed;
< service16++;
< if(ntohs(*service16) != 0x0000)
< goto failed;
< service16++;
< if(ntohs(*service16) != 0x1000)
< goto failed;
< service16++;
< if(ntohs(*service16) != 0x8000)
< goto failed;
< service16++;
< if(ntohs(*service16) != 0x0080)
< goto failed;
< service16++;
< if(ntohs(*service16) != 0x5F9B)
< goto failed;
< service16++;
< if(ntohs(*service16) != 0x34FB)
< goto failed;
< break;
< }
<
< //SRC UUID
< memcpy(alignreq, ((char*)&req->service)+req->uuid_size, req->uuid_size);
< service16 = (uint16_t *)alignreq;
<
< switch(req->uuid_size) {
< case 2:
< if((ntohs(*service16) != BNEP_SVC_PANU)
< && (ntohs(*service16) != BNEP_SVC_NAP)
< && (ntohs(*service16) != BNEP_SVC_GN))
< goto failed;
< break;
< case 4:
< if(ntohs(*service16) != 0x0000)
< goto failed;
< service16++;
< if((ntohs(*service16) != BNEP_SVC_PANU)
< && (ntohs(*service16) != BNEP_SVC_NAP)
< && (ntohs(*service16) != BNEP_SVC_GN))
< goto failed;
< break;
< case 16:
< if(ntohs(*service16) != 0x0000)
< goto failed;
< service16++;
< if((ntohs(*service16) != BNEP_SVC_PANU)
< && (ntohs(*service16) != BNEP_SVC_NAP)
< && (ntohs(*service16) != BNEP_SVC_GN))
< goto failed;
< service16++;
< if(ntohs(*service16) != 0x0000)
< goto failed;
< service16++;
< if(ntohs(*service16) != 0x1000)
< goto failed;
< service16++;
< if(ntohs(*service16) != 0x8000)
< goto failed;
< service16++;
< if(ntohs(*service16) != 0x0080)
< goto failed;
< service16++;
< if(ntohs(*service16) != 0x5F9B)
< goto failed;
< service16++;
< if(ntohs(*service16) != 0x34FB)
< goto failed;
< break;
< }
<
< rsp = (void *) pkt;
< rsp->type = BNEP_CONTROL;
< rsp->ctrl = BNEP_SETUP_CONN_RSP;
< rsp->resp = htons(BNEP_SUCCESS);
< if (send(sk, rsp, sizeof(*rsp), 0) < 0)
< return -1;
<
< return bnep_connadd(sk, role, dev);
<
< failed:
< rsp = (void *) pkt;
< rsp->type = BNEP_CONTROL;
< rsp->ctrl = BNEP_SETUP_CONN_RSP;
< rsp->resp = htons(BNEP_CONN_INVALID_SRC);
< if (send(sk, rsp, sizeof(*rsp), 0) < 0)
< return -1;
<
< return -1;
---
Quoted 1 line
return bnep_connadd(sk, role, dev, 0);
372a236,238
Quoted 3 lines
struct timeval to0;
struct timeval to30 = { 30, 0 };
socklen_t to0s = sizeof(to0);382a249,251
Quoted 3 lines
getsockopt(sk, SOL_SOCKET, SO_RCVTIMEO, &to0, &to0s); setsockopt(sk, SOL_SOCKET, SO_RCVTIMEO, &to30, sizeof(to30));
391a261,262
Quoted 2 lines
setsockopt(sk, SOL_SOCKET, SO_RCVTIMEO, &to0, sizeof(to0));
421c292
< return bnep_connadd(sk, role, dev);
---
Quoted 1 line
return bnep_connadd(sk, role, dev, 1);
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Luiz Augusto von Dentz
maintainerHi Frederic,
pand is deprecated so it should be good if you can take a look in network plugin and see if it surfer from the same problems.
-- =
Luiz Augusto von Dentz
Engenheiro de Computa=E7=E3o
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference =
Don't miss this year's exciting event. There's still time to save $100. =
Use priority code J8TL2D2. =
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/java=
one
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Marcel Holtmann
maintainerHi Luiz,
Quoted 2 lines
pand is deprecated so it should be good if you can take a look in network plugin and see if it surfer from the same problems.
both share the kernel layer. So we have to fix that part first.
Regards
Marcel
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Quoted 15 lines · Marcel Holtmann
Hi Luiz,
Quoted 2 lines
pand is deprecated so it should be good if you can take a look in network plugin and see if it surfer from the same problems.
both share the kernel layer. So we have to fix that part first.
Regards
Marcel
Quoted 10 lines
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Hi,
Does it make sense validate the source and destination uuid in the kernel?
We also need to decode the setup connection request message and reply an error when the server is not enabled. Suppose that PANU and GN are enabled and NAP is disabled. If destination requested is NAP the response message should be not allowed, correct?
Another point, it is necessary check source/destination role combination. For example: GN <->GN, NAP<->NAP, GN<->NAP must be rejected.
Regards,
Claudio.
Signature · 15 lines
-- Claudio Takahasi Instituto Nokia de Tecnologia Recife - Pernambuco - Brasil +55 81 30879999 ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ Bluez-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/bluez-devel
Marcel Holtmann
maintainerHi Frederic,
Quoted 13 lines
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,
Quoted 3 lines
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.
Regards
Marcel
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Hi,
Quoted 10 lines
Quoted 10 lines
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,
Quoted 9 lines
Quoted 2 lines
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
pand/bnep.c +6 -0
@@ -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))
network/connection.c +6 -0
@@ -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
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Marcel Holtmann
maintainerHi Frederic,
Quoted 27 lines
Quoted 19 lines
Quoted 14 lines
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,Quoted 4 lines
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.
Quoted 7 lines
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.
Quoted 5 lines
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
patch looks good to me.
Luiz, feel free to apply it.
Quoted 3 lines
A part of the patch si to move handling of incoming
setup_conn_reqin kernel. In order to keep pan working with older kernel, some differenciation must be done. How to achieve this ?
I don't know yet. Can we first fix the issues that don't need modifications within the kernel. I prefer not modifying the kernel at all at the moment.
Regards
Marcel
-------------------------------------------------------------------------
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 [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Quoted 11 lines
Quoted 5 lines
A part of the patch si to move handling of incoming
setup_conn_reqin kernel. In order to keep pan working with older kernel, some differenciation must be done. How to achieve this ?I don't know yet. Can we first fix the issues that don't need modifications within the kernel. I prefer not modifying the kernel at all at the moment.
I understand.
My problem is that some tests require grouping several messages into one. In particular, the setup_conn_req can be sent together with a control extension TP/BNEP/CTRL/BV-19-C.
The current extension processing is to skip everything and I'm not sure the control message can be handled at application level.
Frederic
-------------------------------------------------------------------------
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 [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Marcel, Luiz
Quoted 10 lines
Quoted 5 lines
Quoted 3 lines
A part of the patch si to move handling of incoming
setup_conn_reqin kernel. In order to keep pan working with older kernel, some differenciation must be done. How to achieve this ?I don't know yet. Can we first fix the issues that don't need modifications within the kernel. I prefer not modifying the kernel at all at the moment.
I understand.
My problem is that some tests require grouping several messages into one. In particular, thesetup_conn_reqcan be sent together with a control extension TP/BNEP/CTRL/BV-19-C. The current extension processing is to skip everything and I'm not sure the control message can be handled at application level.
I wake up this thread,
I'm working at making this easier to integrate but it will makes a bunch of patches. Let's start with the small and self contained.
Resend patch for bluez-utils, and network service timeout (after SETUP_CONN_REQ is sent and no answer for 30 sec, disconnect)
Other patch adds a parameter to bnep module for disabling header compression.
Let me know what you think.
Regards,
Frédéric DALLEAU
Quoted 1 line
Quoted 1 line
From
3aad408454114436898ea668377a44745e9cad52Mon Sep 17 00:00:00 2001
From: fred <fred@fred-laptop.(none)>
Date: Tue, 1 Jul 2008 15:44:24 +0200
Subject: [PATCH] Add compress parameter to bnep module
--- net/bluetooth/bnep/core.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-)
net/bluetooth/bnep/core.c +6 -2
@@ -62,6 +62,7 @@#endif #define VERSION "1.3" +static unsigned int compress =0x03 ;static LIST_HEAD (bnep_session_list);static DECLARE_RWSEM (bnep_session_sem);
@@ -593,10 +594,10 @@ static inline int bnep_tx_frame(struct bnep_session *s, struct sk_buff *skb) iv[il++] = (struct kvec ) { &type,1 }; len++; -if (!compare_ether_addr (eh->h_dest, s->eh.h_source)) +if ((compress &0x01 ) && !compare_ether_addr (eh->h_dest, s->eh.h_source)) type |=0x01 ; -if (!compare_ether_addr (eh->h_source, s->eh.h_dest)) +if ((compress &0x02 ) && !compare_ether_addr (eh->h_source, s->eh.h_dest)) type |=0x02 ;if (type)
@@ -898,6 +899,9 @@ static void __exit bnep_exit(void)module_init (bnep_init);module_exit (bnep_exit); +module_param (compress, uint,0644 ); +MODULE_PARM_DESC (compress,"Compress BNEP headers before sending (0x01 src, 0x02 dst, 0x03 both)" ); +MODULE_AUTHOR ("David Libault <[email protected]>, Maxim Krasnyansky <[email protected]>" );MODULE_DESCRIPTION ("Bluetooth BNEP ver " VERSION );MODULE_VERSION (VERSION );
Signature · 1 line
1.5.3.GIT
Quoted 1 line
Quoted 1 line
From
157045ed03558efb120e5ed30e0d334c0ef9b598Mon Sep 17 00:00:00 2001
From: fred <fred@fred-laptop.(none)>
Date: Tue, 1 Jul 2008 18:30:47 +0200
Subject: [PATCH] Add 30s timeout to setup connection phase
--- network/connection.c | 6 ++++++ pand/bnep.c | 6 ++++++ 2 files changed, 12 insertions(+), 0 deletions(-)
network/connection.c +6 -0
@@ -152,6 +152,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;
@@ -198,6 +199,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;
@@ -241,6 +244,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;
@@ -251,6 +255,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);
pand/bnep.c +6 -0
@@ -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))
Signature · 1 line
1.5.3.GIT
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Any updates?
Fr=E9d=E9ric DALLEAU
Quoted 58 lines · Fr=E9d=E9ric Dalleau wrote:
Marcel, Luiz
Quoted 17 lines
Quoted 4 lines
Quoted 3 lines
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 =
Quoted 8 lines
Quoted 2 lines
differenciation must be done. How to achieve this ?
=I don't know yet. Can we first fix the issues that don't need =
modifications within the kernel. I prefer not modifying the kernel =
at all at the moment. =
I understand.
My problem is that some tests require grouping several messages into =Quoted 7 lines
one. In particular, the
setup_conn_reqcan be sent together with a =control extension TP/BNEP/CTRL/BV-19-C.
The current extension processing is to skip everything and I'm not =sure the control message can be handled at application level.
=I wake up this thread,
I'm working at making this easier to integrate but it will makes a =
bunch of patches.
Let's start with the small and self contained.Resend patch for bluez-utils, and network service timeout (after =
SETUP_CONN_REQis sent and no answer for 30 sec, disconnect)Other patch adds a parameter to bnep module for disabling header =
compression.
Let me know what you think.
Regards,Fr=E9d=E9ric DALLEAU
------------------------------------------------------------------------
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08
------------------------------------------------------------------------
Quoted 4 lines
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great priz= es
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=3D100&url=3D/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Luiz Augusto von Dentz
maintainerHi Frederic,
I hope the patch for bluez-utils doesn't make it block for 30s, other than that it looks fine. But I cannot apply it to cvs since Marcel removed the permission, so we got to wait for git repository.
-- =
Luiz Augusto von Dentz
Engenheiro de Computa=E7=E3o
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great priz= es
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=3D100&url=3D/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Hi Frederic,
Quoted 6 lines
I'm working at making this easier to integrate but it will makes a bunch of patches.
Let's start with the small and self contained.Resend patch for bluez-utils, and network service timeout (after
SETUP_CONN_REQis sent and no answer for 30 sec, disconnect)
I applied the bluez-utils patches to our 4.x repository.
Quoted 2 lines
Other patch adds a parameter to bnep module for disabling header compression.
I am going through that one know.
Regards
Marcel
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Marcel,
Great you could start integrating.
Please find attached the remaining patches.
Let me know what you think.
Regards,
Frédéric DALLEAU
Quoted 23 lines · Marcel Holtmann
Hi Frederic,
Quoted 5 lines
I'm working at making this easier to integrate but it will makes a bunch of patches. Let's start with the small and self contained.
Resend patch for bluez-utils, and network service timeout (after
SETUP_CONN_REQis sent and no answer for 30 sec, disconnect)I applied the bluez-utils patches to our 4.x repository.
Quoted 2 lines
Other patch adds a parameter to bnep module for disabling header compression.
I am going through that one know.
Regards
Marcel
Quoted 11 lines
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-develQuoted 1 line
From
27ff0ea542342df8b0de29323cc0de95367bd831Mon Sep 17 00:00:00 2001
From: fred <fred@fred-laptop.(none)>
Date: Mon, 8 Sep 2008 09:55:38 +0200
Subject: [PATCH] Add bnep_not_understood
--- net/bluetooth/bnep/bnep.h | 1 + net/bluetooth/bnep/core.c | 16 +++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-)
net/bluetooth/bnep/bnep.h +1 -0
@@ -166,6 +166,7 @@ struct bnep_session {struct socket *sock;struct net_device *dev;struct net_device_stats stats; +int setup; };void bnep_net_setup (struct net_device *dev);
net/bluetooth/bnep/core.c +11 -5
@@ -112,6 +112,16 @@ static int bnep_send_rsp(struct bnep_session *s, u8 ctrl, u16 resp)return bnep_send (s, &rsp,sizeof (rsp)); } +int bnep_not_understood (struct bnep_session *s,u8 cmd) +{ +u8 pkt[3 ]; + pkt[0 ] =BNEP_CONTROL ; + pkt[1 ] =BNEP_CMD_NOT_UNDERSTOOD ; + pkt[2 ] = cmd; +bnep_send (s, pkt,sizeof (pkt)); +return sizeof (pkt); +} +#ifdef CONFIG_BT_BNEP_PROTO_FILTER static inline void bnep_set_default_proto_filter (struct bnep_session *s) {
@@ -251,11 +261,7 @@ static int bnep_rx_control(struct bnep_session *s, void *data, int len)break ;default : { -u8 pkt[3 ]; - pkt[0 ] =BNEP_CONTROL ; - pkt[1 ] =BNEP_CMD_NOT_UNDERSTOOD ; - pkt[2 ] = cmd; -bnep_send (s, pkt,sizeof (pkt)); +bnep_not_understood (s, cmd); }break ; }
Signature · 1 line
1.5.3.GIT
Quoted 1 line
Quoted 1 line
From
676acf41cf623e7c21c3c6798ebf29883f6331ffMon Sep 17 00:00:00 2001
From: fred <fred@fred-laptop.(none)>
Date: Mon, 8 Sep 2008 09:56:44 +0200
Subject: [PATCH] Handle BNEP setup CONN REQ in kernel
--- net/bluetooth/bnep/core.c | 92 +++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 89 insertions(+), 3 deletions(-)
net/bluetooth/bnep/core.c +89 -3
120 lines not on this page · raw message
Signature · 1 line
1.5.3.GIT
Quoted 1 line
Quoted 1 line
From
f637bbf49fef96f6aadc1adfa5581be87d945b91Mon Sep 17 00:00:00 2001
From: fred <fred@fred-laptop.(none)>
Date: Mon, 8 Sep 2008 09:57:28 +0200
Subject: [PATCH] Find cumulative length of extensions
--- net/bluetooth/bnep/core.c | 39 +++++++++++++++++++++++++++++---------- 1 files changed, 29 insertions(+), 10 deletions(-)
net/bluetooth/bnep/core.c +29 -10
@@ -139,6 +139,7 @@ static inline void bnep_set_default_proto_filter(struct bnep_session *s)static int bnep_ctrl_set_netfilter (struct bnep_session *s,__be16 *data,int len) { +int l = len;int n;if (len <2 )
@@ -179,11 +180,12 @@ static int bnep_ctrl_set_netfilter(struct bnep_session *s, __be16 *data, int len#else bnep_send_rsp (s,BNEP_FILTER_NET_TYPE_RSP ,BNEP_FILTER_UNSUPPORTED_REQ );#endif -return 0 ; +return l - len; }static int bnep_ctrl_set_mcfilter (struct bnep_session *s,u8 *data,int len) { +int l = len;int n;if (len <2 )
@@ -233,7 +235,7 @@ static int bnep_ctrl_set_mcfilter(struct bnep_session *s, u8 *data, int len)#else bnep_send_rsp (s,BNEP_FILTER_MULTI_ADDR_RSP ,BNEP_FILTER_UNSUPPORTED_REQ );#endif -return 0 ; +return l - len; } static struct {
@@ -326,12 +328,14 @@ static int bnep_rx_control(struct bnep_session *s, void *data, int len) err =bnep_ctrl_setup_conn_req (s, data, len); }else {bnep_send_rsp (s,BNEP_SETUP_CONN_RSP ,BNEP_CONN_NOT_ALLOWED ); + err = len; }break ;case BNEP_FILTER_NET_TYPE_SET :if (!s->setup) {bnep_not_understood (s, cmd); + err = len; }else { err =bnep_ctrl_set_netfilter (s, data, len); }
@@ -340,17 +344,20 @@ static int bnep_rx_control(struct bnep_session *s, void *data, int len)case BNEP_FILTER_MULTI_ADDR_SET :if (!s->setup) {bnep_not_understood (s, cmd); + err = len; }else { err =bnep_ctrl_set_mcfilter (s, data, len); }break ; -default : { -bnep_not_understood (s, cmd); - } +default : +bnep_not_understood (s, cmd); + err = len;break ; } +if (err >=0 ) + err++;return err; }
@@ -370,11 +377,13 @@ static int bnep_rx_extension(struct bnep_session *s, struct sk_buff *skb)switch (h->type &BNEP_TYPE_MASK ) {case BNEP_EXT_CONTROL : -bnep_rx_control (s, skb->data, skb->len); +if (bnep_rx_control (s, skb->data, h->len) != h->len) +return -EILSEQ ;break ;default :/* Unknown extension, skip it. */ + err +=sizeof (*h) + h->len;break ; }
@@ -382,7 +391,7 @@ static int bnep_rx_extension(struct bnep_session *s, struct sk_buff *skb) err = -EILSEQ ;break ; } - }while (!err && (h->type &BNEP_EXT_HEADER )); + }while (h->type &BNEP_EXT_HEADER );return err; }
@@ -401,6 +410,7 @@ static inline int bnep_rx_frame(struct bnep_session *s, struct sk_buff *skb)struct net_device *dev = s->dev;struct sk_buff *nskb;u8 type; +int ext; dev->last_rx = jiffies; s->stats.rx_bytes += skb->len;
@@ -411,7 +421,15 @@ static inline int bnep_rx_frame(struct bnep_session *s, struct sk_buff *skb) goto badframe;if ((type &BNEP_TYPE_MASK ) ==BNEP_CONTROL ) { -bnep_rx_control (s, skb->data, skb->len); +if ((ext =bnep_rx_control (s, skb->data, skb->len)) <0 ) + goto badframe; + +skb_pull (skb, ext); + +if (type &BNEP_EXT_HEADER ) { +if ((ext =bnep_rx_extension (s, skb)) <0 ) + goto badframe; + }kfree_skb (skb);return 0 ; }
@@ -425,9 +443,10 @@ static inline int bnep_rx_frame(struct bnep_session *s, struct sk_buff *skb) s->eh.h_proto =get_unaligned ((__be16 *) (skb->data -2 ));if (type &BNEP_EXT_HEADER ) { -if (bnep_rx_extension (s, skb) <0 ) +if ((ext =bnep_rx_extension (s, skb)) <0 ) goto badframe; - } + }else + ext =0 ;/* Strip 802.1p header */ if (ntohs (s->eh.h_proto) ==0x8100 ) {
Signature · 1 line
1.5.3.GIT
Quoted 1 line
Quoted 1 line
From
2420f247ef05aef15bcfcc9f2bb79e5a0a2a8543Mon Sep 17 00:00:00 2001
From: fred <fred@fred-laptop.(none)>
Date: Mon, 8 Sep 2008 09:58:03 +0200
Subject: [PATCH] Forward BNEP packets containing extensions
--- net/bluetooth/bnep/core.c | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 43 insertions(+), 1 deletions(-)
net/bluetooth/bnep/core.c +43 -1
72 lines not on this page · raw message
Signature · 1 line
1.5.3.GIT
Quoted 1 line
Quoted 1 line
From
7de817f39757607f691990584f4b69c8ba2fad65Mon Sep 17 00:00:00 2001
From: fred <fred@fred-laptop.(none)>
Date: Mon, 8 Sep 2008 10:28:20 +0200
Subject: [PATCH] Add ksetup parameter
--- net/bluetooth/bnep/core.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
net/bluetooth/bnep/core.c +4 -0
@@ -61,6 +61,7 @@static int compress_src =1 ;static int compress_dst =1 ; +static unsigned int ksetup =1 ;static LIST_HEAD (bnep_session_list);static DECLARE_RWSEM (bnep_session_sem);
@@ -908,6 +909,9 @@ MODULE_PARM_DESC(compress_src, "Compress sources headers");module_param (compress_dst, bool,0644 );MODULE_PARM_DESC (compress_dst,"Compress destination headers" ); +module_param (ksetup, uint,0644 ); +MODULE_PARM_DESC (ksetup,"Present if kernel can handle BNEP_SETUP_CONN_REQ" ); +MODULE_AUTHOR ("Marcel Holtmann <[email protected]>" );MODULE_DESCRIPTION ("Bluetooth BNEP ver " VERSION );MODULE_VERSION (VERSION );
Signature · 1 line
1.5.3.GIT
Quoted 1 line
Quoted 1 line
From
8cb22dbab9475f579cd08b9a3e7632a640932e9aMon Sep 17 00:00:00 2001
From: fred <fred@fred-laptop.(none)>
Date: Mon, 8 Sep 2008 10:28:47 +0200
Subject: [PATCH] Add support for kernel side BNEP_SETUP_CONN_REQ
--- compat/bnep.c | 23 ++++++++++++++++++++--- network/common.c | 3 ++- network/common.h | 2 +- network/connection.c | 2 +- network/server.c | 31 ++++++++++++++++++++++++++----- 5 files changed, 50 insertions(+), 11 deletions(-)
compat/bnep.c +20 -3
@@ -32,6 +32,8 @@#include <stdlib.h> #include <sys/socket.h> #include <sys/ioctl.h> +#include <sys/types.h> +#include <sys/stat.h> #include <bluetooth/bluetooth.h> #include <bluetooth/l2cap.h>
@@ -180,13 +182,14 @@ int bnep_kill_all_connections(void)return 0 ; } -static int bnep_connadd (int sk,uint16_t role,char *dev) +static int bnep_connadd (int sk,uint16_t role,char *dev,int setup_done) {struct bnep_connadd_req req;strncpy (req.device, dev,16 ); req.device[15 ] ='\0' ; req.sock = sk; + req.flags = setup_done; req.role = role;if (ioctl (ctl, bnepconnadd, &req))return -1 ;
@@ -220,6 +223,20 @@ int bnep_accept_connection(int sk, uint16_t role, char *dev)struct bnep_control_rsp *rsp;unsigned char pkt[BNEP_MTU ];int r; +FILE *f; +int ksetup =0 ; + +/* Read BNEP kernel module version number */ + + f =fopen ("/sys/module/bnep/parameters/ksetup" ,"rt" ); +if (f) { +if (fscanf (f,"%d" , &ksetup) !=1 ) + ksetup =0 ; +fclose (f); + } + +if (ksetup) +return bnep_connadd (sk, role, dev,0 ); r =recv (sk, pkt,BNEP_MTU ,0 );if (r <=0 )
@@ -243,7 +260,7 @@ int bnep_accept_connection(int sk, uint16_t role, char *dev)if (send (sk, rsp,sizeof (*rsp),0 ) <0 )return -1 ; -return bnep_connadd (sk, role, dev); +return bnep_connadd (sk, role, dev,1 ); }/* Create BNEP connection
@@ -319,5 +336,5 @@ receive:return -1 ; } -return bnep_connadd (sk, role, dev); +return bnep_connadd (sk, role, dev,1 ); }
network/common.c +2 -1
@@ -198,7 +198,7 @@ int bnep_kill_all_connections(void)return 0 ; } -int bnep_connadd (int sk,uint16_t role,char *dev) +int bnep_connadd (int sk,uint16_t role,char *dev,int setup_done) {struct bnep_connadd_req req;
@@ -206,6 +206,7 @@ int bnep_connadd(int sk, uint16_t role, char *dev)strncpy (req.device, dev,16 ); req.device[15 ] ='\0' ; req.sock = sk; + req.flags = setup_done; req.role = role;if (ioctl (ctl,BNEPCONNADD , &req) <0 ) {int err = errno;
network/common.h +1 -1
@@ -36,6 +36,6 @@ const char *bnep_name(uint16_t id);int bnep_kill_connection (bdaddr_t *dst);int bnep_kill_all_connections (void ); -int bnep_connadd (int sk,uint16_t role,char *dev); +int bnep_connadd (int sk,uint16_t role,char *dev,int setup_done);int bnep_if_up (const char *devname,uint16_t id);int bnep_if_down (const char *devname);
network/connection.c +1 -1
@@ -215,7 +215,7 @@ static gboolean bnep_connect_cb(GIOChannel *chan, GIOCondition cond,setsockopt (sk,SOL_SOCKET ,SO_RCVTIMEO , &timeo,sizeof (timeo)); -if (bnep_connadd (sk,BNEP_SVC_PANU , nc->dev)) { +if (bnep_connadd (sk,BNEP_SVC_PANU , nc->dev,1 )) {error ("%s could not be added" , nc->dev); goto failed; }
network/server.c +26 -5
@@ -64,6 +64,7 @@ struct setup_session {uint16_t src_role;/* Source role */ int nsk;/* L2CAP socket */ guint watch;/* BNEP socket watch */ +int ksetup;/* Kernel does BNEP_SETUP_CONN_REQ */ };struct timeout {
@@ -126,7 +127,8 @@ static struct network_server *find_server(GSList *list, uint16_t id) }static struct setup_session *setup_session_new (gchar *address, -uint16_t dst_role,uint16_t src_role,int nsk,guint watch) +uint16_t dst_role,uint16_t src_role,int nsk, +guint watch,int ksetup) {struct setup_session *setup;
@@ -136,6 +138,7 @@ static struct setup_session *setup_session_new(gchar *address, setup->src_role = src_role; setup->nsk = nsk; setup->watch = watch; + setup->ksetup = ksetup;return setup; }
@@ -298,7 +301,7 @@ static ssize_t send_bnep_ctrl_rsp(int sk, uint16_t val) }static int server_connadd (struct network_server *ns,int nsk, -const gchar *address,uint16_t dst_role) +const gchar *address,uint16_t dst_role,int ksetup) {char devname[16 ];const char *bridge;
@@ -311,7 +314,7 @@ static int server_connadd(struct network_server *ns, int nsk,memset (devname,0 ,16 );strncpy (devname, prefix,strlen (prefix)); - err =bnep_connadd (nsk, dst_role, devname); + err =bnep_connadd (nsk, dst_role, devname, !ksetup);if (err <0 )return err;
@@ -358,7 +361,7 @@ static void req_auth_cb(DBusError *derr, void *user_data) }if (server_connadd (ns, setup->nsk, - setup->address, setup->dst_role) <0 ) + setup->address, setup->dst_role, setup->ksetup) <0 ) val =BNEP_CONN_NOT_ALLOWED ;else val =BNEP_SUCCESS ;
@@ -444,6 +447,8 @@ static gboolean bnep_setup(GIOChannel *chan,char address[18 ];uint16_t rsp, src_role, dst_role;int n, sk; +FILE *f; +int ksetup =0 ;if (cond &G_IO_NVAL )return FALSE;
@@ -455,6 +460,20 @@ static gboolean bnep_setup(GIOChannel *chan, sk =g_io_channel_unix_get_fd (chan); +/* Read BNEP kernel module version number */ + + f =fopen ("/sys/module/bnep/parameters/ksetup" ,"rt" ); +if (f) { +if (fscanf (f,"%d" , &ksetup) !=1 ) + ksetup =0 ; +fclose (f); + } + +if (ksetup) { + src_role = dst_role =BNEP_SVC_NAP ; + goto end_read; + } +/* Reading BNEP_SETUP_CONNECTION_REQUEST_MSG */ n =read (sk, packet,sizeof (packet));if (n <0 ) {
@@ -473,6 +492,7 @@ static gboolean bnep_setup(GIOChannel *chan,if (rsp) goto reply; +end_read: size =sizeof (sa);if (getsockname (sk, (struct sockaddr *) &sa, &size) <0 ) { rsp =BNEP_CONN_NOT_ALLOWED ;
@@ -500,7 +520,8 @@ static gboolean bnep_setup(GIOChannel *chan, goto reply; } - setup =setup_session_new (address, dst_role, src_role, sk, to->watch); + setup =setup_session_new (address, dst_role, src_role, sk, + to->watch, ksetup);/* Wait authorization before reply success */ if (authorize_connection (ns, address) <0 ) {
Signature · 1 line
1.5.3.GIT
Quoted 1 line
Quoted 1 line
From
3487a358cd33c69af4c194ada3904fe29c30eb01Mon Sep 17 00:00:00 2001
From: fred <fred@fred-laptop.(none)>
Date: Mon, 8 Sep 2008 09:57:46 +0200
Subject: [PATCH] String extensions not forwarded
--- net/bluetooth/bnep/core.c | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-)
net/bluetooth/bnep/core.c +19 -0
@@ -455,6 +455,25 @@ static inline int bnep_rx_frame(struct bnep_session *s, struct sk_buff *skb) s->eh.h_proto =get_unaligned ((__be16 *) (skb->data -2 )); } +/* Strip extensions if they are not to be forwarded */ +if (ext >0 ) { +switch (type &BNEP_TYPE_MASK ) { +case BNEP_COMPRESSED : +case BNEP_COMPRESSED_SRC_ONLY : +/* Specified destination is this session */ + ext =0 ; +break ; + +case BNEP_COMPRESSED_DST_ONLY : +case BNEP_GENERAL : +/* Check if specified destination is this session */ +if (!compare_ether_addr (skb_mac_header (skb), s->eh.h_dest)) { + ext =0 ; + } +break ; + } + } +/* We have to alloc new skb and copy data here :(. Because original skb * may not be modified and because of the alignment requirements. */ nskb =alloc_skb (2 +ETH_HLEN + skb->len,GFP_KERNEL );
Signature · 1 line
1.5.3.GIT
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Marcel Holtmann
maintainerHi Frederic,
Quoted 2 lines
Great you could start integrating.
Please find attached the remaining patches.
the 0001 patch contains an extra setup variable that is not used in the patch at all. Remove it from it.
The 0002 patch mixes the non-understood changes with the setup changes. Also can we just use flags variable in the session instead of setup. The UUID handling could be done a little bit more elegant.
What is the point behind 0003 patch?
I think 0004 patch needs some cleanup. It looks too hackish.
The 0006 patch is not how we handle this. Either use the exported version number of the BNEP module or we have to add an ioctl for it.
Please don't hijack a thread for this and send these patches one by one to [email protected].
Regards
Marcel
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel