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

RE: [bluetooth-dev] Bugs in the last release of L2CAP + PSM




Hi,
first of all, thanks for your help !

> -----Original Message-----
> From: mathieu.gonot@xxxxxxx.com">mailto:mathieu.gonot@xxxxxxx.com]
> Sent: Wednesday, August 02, 2000 5:08 PM
> To: matsf@xxxxxxx.com
> Cc: bluetooth-dev@xxxxxxx.com
> Subject: [bluetooth-dev] Bugs in the last release of L2CAP + PSM
> 
> 
> Hi Mats,
> 
> I have discovered some bugs that have been added in the last 
> release of L2CAP.
> 
> In the file l2cap.c:
> 1.  line 866, 
> 		ENTERSTATE(con, CLOSED);
> 		PRINTSTATE(con);
> have to be removed since "con" is now deleted by the function 
> 		l2ca_disconnect_cfm(con,0); on the previous line.
> In fact, those two macros have to be moved in the function 
> l2ca_disconnect_cfm() just after the lines:
> 	/* tell upper layers that connection is down */
> 	l2cap->upper_layers[con->psm].disc_cfm(con, result);


I also added a check for the current state in delete_con which prints a warning if the connection is not in CLOSED state.


> 
> 2. In the same function l2ca_disconnect_cfm(), the line
> 	if (count_con(con->hci_con_handle) == 0) {
> has to be modified as follows
> 	if (count_con(tmp_hdl) == 0) {
> since "con" has been deleted on the previous line.

yes, that was the reason of using tmp_hdl... must have been one of those late evenings... :)

> 
> 
> 3. line 846, the trace in the SIG_DISCRSP case is incorrect: 
> 	PRINTPKT(FNC"config response", rsp->data, rsp->len); 
> must be replaced by PRINTPKT(FNC"disconnect response", 
> rsp->data, rsp->len);

fixed.

> 
> --------------------------------------------------------------
> ----------------------
> Concerning the PSM, it must be at least of type u16 (probably 
> u32!) since the range of dynamically assigned values is 
> [0x1001-0xFFFF] (See p:278 Core specification).
> But it is also written on this page that the PSM field can be 
> extended beyond 16 bits ...

As of today I don't see why there should be a need for more than 
65536 upper protocols... :) so for now I think 16 bits will do. 
If a need comes up that should be pretty easy to change.

comments ?

> 
> So, the declaration of the functions  lines 221, 222, 223 in 
> l2cap.h must be modified:
> 	s32 l2cap_register_upper(u8 psm, struct protocol_layer *prot);
> 	s32 l2cap_unregister_upper(u8 psm);
> 	s32 l2cap_is_registered(u8 psm);
> The same modifications must be done in the file l2cap.c of course!

I'll change the u8:s to u16:s.

Once again thanks for your help, it is much appreciated !
brgds
Mattias Ågren

> 
> 
> Regards,
> 
> Mathieu GONOT
> 
> International Technology Centre Leuven
> Interleuvenlaan 74-76
> B-3001 Leuven-Belgium
> 
> Tel. +32 16 390 652
>