|
From: Willy S. <sag...@us...> - 2003-01-09 09:56:20
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Tag Comment
---- ----------- ----------- --- -------
bnep.c 1.15 1.16=20=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Updated filter handling
The diff of the modified file(s):
--- bnep.c 8 Apr 2002 09:39:46 -0000 1.15
+++ bnep.c 9 Jan 2003 09:56:19 -0000 1.16
@@ -480,11 +480,11 @@
=20
/* Step through filter range by filter range */
for (i =3D 0; (i < BNEP_MAX_MCAST_FILTER_RANGES) && (!send_packet); i++)=
{
- D_MISC(__FUNCTION__": Trying multicast filter range %d\n", i);
+ D_XMIT(__FUNCTION__": Trying multicast filter range %d\n", i);
=20
if (check_filter(local->filter_multi_addr_list[i*2].addr, eth->h_dest, =
6) <=3D 0 &&
check_filter(local->filter_multi_addr_list[i*2+1].addr, eth->h_dest=
, 6) >=3D 0) {
- D_MISC(__FUNCTION__": Multicast filter range %d OK\n",i);
+ D_XMIT(__FUNCTION__": Multicast filter range %d OK\n",i);
send_packet =3D 1;
}
}
@@ -834,7 +834,7 @@
eheader =3D (struct bnep_eheader *)&data[pos];
type =3D eheader->bnep_type & 0x7f;
eheaders =3D ((eheader->bnep_type & 0x80) >> 7);
- D_REC("Parse extension header type=3D%02x eheader=3D%i pos=3D%08x\n",=20
+ printk("Parse extension header type=3D%02x eheader=3D%i pos=3D%08x\n",=
=20
type, eheaders, pos);
=20
switch(type) {
@@ -853,7 +853,7 @@
=20
pos +=3D eheader->length + 2;
if (pos > len) {
- D_ERR(__FUNCTION__": Error: pos > len\n");
+ D_ERR(__FUNCTION__": Error: pos %i > len %i\n",pos,eheader->length);
break;
}
}
@@ -960,10 +960,30 @@
local->state =3D CONNECTED;
} else {
/* Not supported UUID or invalid */
+ if (destination_uuid =3D=3D UUID_PANU)
+ {
+ D_ERR("Destination uuid expected to be %04=
x or %04x\n",UUID_NAP, UUID_GN);
+ local->state =3D DISCONNECTED;
+ setup_rsp.bnep_response_msg =3D cpu_to_be16(CONNECTION_NOT_ALLOWED);
+ }
+ else
+ {
D_ERR("Destination uuid expected to be %04x or %04x\n",UUID_NAP, UUID_=
GN);
local->state =3D DISCONNECTED;
setup_rsp.bnep_response_msg =3D cpu_to_be16(INVALID_DST_UUID);
}
+ }
+ if ((source_uuid =3D=3D UUID_PANU) || (source_uuid=
=3D=3D UUID_GN ))
+ {
+ D_MISC("Source uuid is ok\n");
+ }
+ else
+ {
+ D_ERR(__FUNCTION__ ": Invalid source UUID\n");
+ local->state =3D DISCONNECTED;
+ setup_rsp.bnep_response_msg =3D cpu_to_be16(INVALID_SRC_UUID);
+ }
+
} else {=20
D_ERR(__FUNCTION__ ": Invalid UUID Size.");
local->state =3D DISCONNECTED;
@@ -1031,7 +1051,8 @@
rsp.bnep_control_type =3D BNEP_FILTER_NET_TYPE_RESPONSE_MSG;
rsp.bnep_response_msg =3D cpu_to_be16(SUCCESS);
=20=09=09
- if (n =3D=3D 0) {
+=09=20=20=20=20=20=20=20
+ {
/* Reset filter */
D_MISC("Reset filter\n");
for (i=3D0;i<BNEP_MAX_PROTOCOL_FILTER_RANGES;i++) {
@@ -1043,7 +1064,10 @@
local->filter_list[0] =3D 0x0000;
local->filter_list[1] =3D 0xffff;
used_filters=3D0;
- } else if (used_filters+n > BNEP_MAX_PROTOCOL_FILTER_RANGES) {
+ }=20
+ if (n =3D=3D 0) {
+ }=20
+ else if (n > BNEP_MAX_PROTOCOL_FILTER_RANGES) {
D_ERR(__FUNCTION__": all protocol filters occupied. Can't set more!\n");
rsp.bnep_response_msg =3D cpu_to_be16(MAX_FILTER);
used_filters =3D BNEP_MAX_PROTOCOL_FILTER_RANGES;
@@ -1061,8 +1085,8 @@
if (rsp.bnep_response_msg =3D=3D cpu_to_be16(SUCCESS)) {=09=09=09
D_MISC("Setting filter ranges:");
for (i=3D0; i<n*2; i++) {
- local->filter_list[i+used_filters*2] =3D be16_to_cpu(filter[i]);
- printk("filter %04x, i %d ",local->filter_list[i+used_filters*2],i);
+ local->filter_list[i] =3D be16_to_cpu(filter[i]);
+ printk("filter %04x, i %d ",local->filter_list[i],i);
}
used_filters+=3Dn;
D_MISC("%d of %d filters in use\n",=20
@@ -1129,7 +1153,6 @@
D_MISC(__FUNCTION__" BNEP_FILTER_MULTI_ADDR_SET_MSG, lenth =3D %i, n =3D=
%i \n",length,n);
=20=09=09
/* If no filters are set, reset filter list */
- if (n =3D=3D 0) {
D_MISC(__FUNCTION__" Reset all multicast filters and accept all address=
es\n");
for (i=3D0;i<BNEP_MAX_MCAST_FILTER_RANGES;i++) {
memset(&local->filter_multi_addr_list[i*2].addr[0],0,6);
@@ -1138,7 +1161,10 @@
/* Accept all multicast addresses */
memset(&local->filter_multi_addr_list[1].addr[0],0xff,6);
used_filters=3D0;
- } else if (used_filters+n > BNEP_MAX_MCAST_FILTER_RANGES) {
+
+ if (n =3D=3D 0) {
+=09=09=09
+ } else if (n > BNEP_MAX_MCAST_FILTER_RANGES) {
D_ERR(__FUNCTION__": all mcast filters occupied. Can't set more!\n");
rsp.bnep_response_msg =3D cpu_to_be16(MAX_FILTER);
n =3D BNEP_MAX_MCAST_FILTER_RANGES;
@@ -1148,16 +1174,16 @@
print_data("Adding multicast filter: ", data+2+i*12, 12);
=20
/* Start address. */
- memcpy(local->filter_multi_addr_list[(used_filters+i)*2].addr,
+ memcpy(local->filter_multi_addr_list[i*2].addr,
data+2+i*12,
6);
=20
/* End address. */
- memcpy(local->filter_multi_addr_list[(used=
_filters+i)*2+1].addr,
+ memcpy(local->filter_multi_addr_list[i*2+1=
].addr,
data+2+i*12+6,
6);
}
- used_filters +=3D n;
+ used_filters =3D n;
}
=20=09=09
/* subscribe to a bt_tx_buf */
|