|
From: Anders J. <and...@us...> - 2002-02-11 17:52:40
|
The following files were modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
bnep.c 1.3 1.4=20=20=20=20=20=20=20=20=20=20=20=20=20
l2cap.c 1.128 1.129=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
* Deny multiple bnepconnections from the same client.
* Don't delete the connection if non-initiator when
replying negative on a connection request.
The diff of the modified file(s):
--- bnep.c 29 Jan 2002 15:57:26 -0000 1.3
+++ bnep.c 11 Feb 2002 17:52:38 -0000 1.4
@@ -410,7 +410,7 @@
struct bnep_compressed_ethernet_source_only bnep_c_s;
struct bnep_compressed_ethernet bnep_c;
void *bhdr;
- int i, bhdrlen, ethhdrlen =3D sizeof(struct ethhdr), buflen, strip_len =
=3D 0;
+ int i, bhdrlen, ethhdrlen =3D sizeof(struct ethhdr), buflen, strip_len =
=3D 0, j;
u16 proto, payload_proto;=20
int send_packet =3D 0;
int dest =3D 1;
@@ -1239,10 +1239,30 @@
static void=20
bnep_connect_ind(l2cap_con *l2cap)=20
{
- int i;
+ int i, j, dupe;
struct net_local *local;
D_MISC("bnep_connect_ind: remote cid %d\n", l2cap->remote_cid);
=20=09
+ for (i=3D0 ; i < BNEP_MAX_CON ; i++) {
+ local =3D dev_bnep[i].priv;
+ if(local->l2cap) {
+ dupe =3D 1;
+ for (j =3D 0; j < 6; j++) {
+ if (l2cap->remote_bd[j] !=3D local->l2cap->remote_bd[j]) {
+ dupe =3D 0;
+ break;
+ }
+ }
+ if(dupe) {
+ D_ERR(__FUNCTION__ ": Already have a bnep connection from that client\=
n");
+ if (l2ca_connect_rsp(l2cap, RES_NOSRC, STAT_NOINFO)) {
+ D_ERR("bnep_connect_ind: l2ca_connect_rsp failed\n");
+ }
+ return;
+ }=09
+ }
+ }
+
/* Check for free interfaces */
for (i=3D0 ; i < BNEP_MAX_CON ;i++) {
local =3D dev_bnep[i].priv;
--- l2cap.c 24 Jan 2002 12:41:31 -0000 1.128
+++ l2cap.c 11 Feb 2002 17:52:38 -0000 1.129
@@ -1788,8 +1788,12 @@
ENTERSTATE(con, CLOSED);
PRINTSTATE(con);
=20
- /* remove connection */
+ /* As the hcihdl is stored in the l2cap connection
+ object we need to keep it if we are non-initiator
+ */
+ if(con->initiator || (count_con(con->hci_hdl) > 1)) {
delete_con(con);
+ }
}=20=20
return result;
}
|