patch for: RFComm dynamic channel allocation
Hi,
just found and fixed the problem with dynamic rfcomm channel allocation. My code binds to a specific local bdaddr, the rfcomm tool binds to ANY. This case was not handled correctly. The fix is simple, see attachment.
... Collin
Signature · 4 lines
Collin R. Mulliner <[email protected]> BETAVERSiON Systems [www.betaversion.net] info/pgp: finger [email protected] Just don't create a file called -rf. :-) --Larry Wall
sock.c renamed from sock.c_orig +1 -1
@@ -407,7 +407,7 @@write_lock_bh (&rfcomm_sk_list.lock);for (channel =1 ; channel <31 ; channel++) -if (!__rfcomm_get_sock_by_addr (channel, src)) { +if (!__rfcomm_get_sock_by_channel (0 , channel, src)) {rfcomm_pi (sk)->channel = channel; err =0 ;break ;
Marcel Holtmann
maintainerHi Collin,
Quoted 3 lines
just found and fixed the problem with dynamic rfcomm channel allocation. My code binds to a specific local bdaddr, the rfcomm tool binds to ANY. This case was not handled correctly. The fix is simple, see attachment.
I don't get the point of your fix, because bind() to a specific BD_ADDR and to BDADDR_ANY are totally different and can result in different dynamic channel allocations.
Regards
Marcel
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Hi Marcel,
Quoted 3 lines
I don't get the point of your fix, because
bind()to a specificBD_ADDRand toBDADDR_ANYare totally different and can result in different dynamic channel allocations.
I understand why binding to BDADDR_ANY could lead to a different channel, e.g. when having multiple BT devices but the current code doesn't work when binding to a specific BD_ADDR. I only talk about dynamic rfcomm channel allocation which takes place when calling listen()! Not about the general bind().
... Collin
Signature · 15 lines
Collin R. Mulliner <[email protected]> BETAVERSiON Systems [www.betaversion.net] info/pgp: finger [email protected] Success is a journey, not a destination. So stop running. ------------------------------------------------------- This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com _______________________________________________ Bluez-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/bluez-devel
Marcel Holtmann
maintainerHi Collin,
Quoted 9 lines
Quoted 3 lines
I don't get the point of your fix, because
bind()to a specificBD_ADDRand toBDADDR_ANYare totally different and can result in different dynamic channel allocations.I understand why binding to
BDADDR_ANYcould lead to a different channel, e.g. when having multiple BT devices but the current code doesn't work when binding to a specificBD_ADDR. I only talk about dynamic rfcomm channel allocation which takes place when callinglisten()! Not about the generalbind().
the code works, because the scope of a specific BD_ADDR is different from BDADDR_ANY and both start with channel 1. I am not going to mix them two in the kernel, because this is an application specific problem you are trying to solve.
Regards
Marcel
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Marcel Holtmann
maintainerHi Collin,
Quoted 4 lines
what happens if one program binds to
BDADDR_ANYchannel 1 and a second program binds toSPECIFIC_BDADDRchannel 1 (thru dynamic channel allocation). Which program gets the incoming connection to channel one (with just one BT device).
try this out, but the program that listens on the specific BD_ADDR should get the incoming connection.
Regards
Marcel
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel