L2CAP raw socket patch
Subsystems (2)
Hi List,
I have written a small patch for l2cap.c to improve the capabilities of L2CAP raw sockets. Currently only very few responses travel back to a RAW socket (which is very bad if you need to see command responses). The patch is very simple - it just puts all responses on the Sig-Channel to all open RAW sockets. The owner of the raw socket just needs to select his packets and in normal operation there shouldn't be much use of RAW sockets so I don't think this is a performance issue.
I have attached the patch file to this email, hope this is ok.
thanks ... Collin
Signature · 3 lines
Collin Mulliner <[email protected]> BATAVERSiON Systems [www.betaversion.net] Don't ask why! Ask why not!
l2cap.c +6 -11
@@ -1663,6 +1663,12 @@break ; } +/* +* for better low-level access +* put command to all raw sockets +*/ +l2cap_raw_recv (conn, skb); +switch (cmd.code) {case L2CAP_CONN_REQ : err =l2cap_connect_req (conn, &cmd, data);
@@ -1688,21 +1694,10 @@ err =l2cap_disconnect_rsp (conn, &cmd, data);break ; -case L2CAP_COMMAND_REJ : -/* FIXME: We should process this */ -l2cap_raw_recv (conn, skb); -break ; -case L2CAP_ECHO_REQ :l2cap_send_rsp (conn, cmd.ident,L2CAP_ECHO_RSP , cmd.len, data);break ; -case L2CAP_ECHO_RSP : -case L2CAP_INFO_REQ : -case L2CAP_INFO_RSP : -l2cap_raw_recv (conn, skb); -break ; -default :BT_ERR ("Uknown signaling command 0x%2.2x" , cmd.code); err = -EINVAL ;
Marcel Holtmann
maintainerHi Collin,
Quoted 7 lines
I have written a small patch for
l2cap.cto improve the capabilities of L2CAP raw sockets. Currently only very few responses travel back to a RAW socket (which is very bad if you need to see command responses). The patch is very simple - it just puts all responses on the Sig-Channel to all open RAW sockets. The owner of the raw socket just needs to select his packets and in normal operation there shouldn't be much use of RAW sockets so I don't think this is a performance issue.
do anyone have comments about this patch?
Quoted 1 line
I have attached the patch file to this email, hope this is ok.
BTW this patch is wrong, because we must keep the case statements. Otherwise the kernel log will be filled with unneeded error messages.
Regards
Marcel
net/bluetooth/l2cap.c +2 -2
@@ -1643,6 +1643,8 @@break ; } +l2cap_raw_recv (conn, skb); +switch (cmd.code) {case L2CAP_CONN_REQ : err =l2cap_connect_req (conn, &cmd, data);
@@ -1670,7 +1672,6 @@case L2CAP_COMMAND_REJ :/* FIXME: We should process this */ -l2cap_raw_recv (conn, skb);break ;case L2CAP_ECHO_REQ :
@@ -1680,7 +1681,6 @@case L2CAP_ECHO_RSP :case L2CAP_INFO_REQ :case L2CAP_INFO_RSP : -l2cap_raw_recv (conn, skb);break ;default :
A message that is not in the archive (sent off-list or not yet received): [email protected]
Marcel Holtmann
maintainerHi Collin,
Quoted 4 lines
Quoted 2 lines
BTW this patch is wrong, because we must keep the case statements. Otherwise the kernel log will be filled with unneeded error messages.
ups ... will make a new one and post it again.
I already attached it to my response ;)
Regards
Marcel
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Hi All,
so what do you all think about the RAW socket patch, does it make sense putting it into the official tree?
... Collin
Signature · 14 lines
Collin Mulliner <[email protected]> BATAVERSiON Systems [www.betaversion.net] Linux is something for Windows haters, BSD something for Unix lovers. ------------------------------------------------------- The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. http://www.eclipsecon.org/osdn _______________________________________________ Bluez-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/bluez-devel
Marcel Holtmann
maintainerHi Collin,
Quoted 2 lines
so what do you all think about the RAW socket patch, does it make sense putting it into the official tree?
the original code was even wrong. If a SKB contains two or more commands or responses the SKB will be put more than once to the raw socket. I am going to apply the attached patch and hope we don't get a performance decrease.
Regards
Marcel
===== net/bluetooth/l2cap.c 1.36 vs edited =====
net/bluetooth/l2cap.c +3 -3
@@ -1629,6 +1629,8 @@struct l2cap_cmd_hdr cmd;int err =0 ; +l2cap_raw_recv (conn, skb); +while (len >=L2CAP_CMD_HDR_SIZE ) {memcpy (&cmd, data,L2CAP_CMD_HDR_SIZE ); data +=L2CAP_CMD_HDR_SIZE ;
@@ -1670,7 +1672,6 @@case L2CAP_COMMAND_REJ :/* FIXME: We should process this */ -l2cap_raw_recv (conn, skb);break ;case L2CAP_ECHO_REQ :
@@ -1680,11 +1681,10 @@case L2CAP_ECHO_RSP :case L2CAP_INFO_REQ :case L2CAP_INFO_RSP : -l2cap_raw_recv (conn, skb);break ;default : -BT_ERR ("Uknown signaling command 0x%2.2x" , cmd.code); +BT_ERR ("Unknown signaling command 0x%2.2x" , cmd.code); err = -EINVAL ;break ; }