|
From: Anders J. <and...@us...> - 2002-03-14 13:44:10
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Tag Comment
---- ----------- ----------- --- -------
bnep.c 1.12 1.13=20=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
* Replaced memcmp with homemade variant as the memcmp in kernel=20
doesn't return the correct values.
The diff of the modified file(s):
--- bnep.c 13 Mar 2002 09:56:11 -0000 1.12
+++ bnep.c 14 Mar 2002 13:44:07 -0000 1.13
@@ -149,6 +149,10 @@
static void bnep_receive_packet(l2cap_con *l2cap, u8 *data, u32 len);
static int bnep_control(l2cap_con *l2cap, u8 *data, u8 bnep_control_type);
=20
+/* Misc functions */
+s32 check_filter(unsigned char *filter1, unsigned char *filter2, u16 size);
+
+
/****************** FUNCTION DEFINITION SECTION **************************=
***/
=20
/*=20
@@ -285,6 +289,7 @@
local->filter_list[1] =3D 0xffff;
=20=09
/* Accept all multicast packets */
+ memset(&local->filter_multi_addr_list[0].addr[0], 0x00, 6);
memset(&local->filter_multi_addr_list[1].addr[0], 0xff, 6);
=20=09
local->state =3D DISCONNECTED;
@@ -461,6 +466,8 @@
return 0;
}
=20=09
+
+=09
/* Check multicast filters */
if (eth->h_dest[0] & 1) {
D_XMIT(__FUNCTION__": Multicast packet, dest =3D %02x:%02x:%02x:%02x:%02=
x:%02x\n",=20
@@ -471,8 +478,9 @@
/* 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);
- if (memcmp(local->filter_multi_addr_list[i*2].addr, eth->h_dest, 6) >=
=3D 0 &&
- memcmp(local->filter_multi_addr_list[i*2+1].addr, eth->h_dest, 6) <=
=3D 0) {
+
+ 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);
send_packet =3D 1;
}
@@ -1466,4 +1474,16 @@
}
=20=09
return 0;
+}
+
+s32
+check_filter(unsigned char *filter1, unsigned char *filter2, u16 size)
+{
+ int retval =3D 0;
+ const unsigned char *val1, *val2;
+
+ for( val1 =3D filter1, val2 =3D filter2 ; 0 < size; ++val1, ++val2=
, size--)
+ if ((retval =3D *val1 - *val2) !=3D 0)
+ break;
+ return retval;
}
|