|
From: Fredrik S. <fre...@us...> - 2002-01-29 09:00:39
|
The following files were modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
bnep.c 1.1 1.2=20=20=20=20=20=20=20=20=20=20=20=20=20
bnep_test.c 1.1 1.2=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Multicast filters should now work.
The diff of the modified file(s):
--- bnep.c 2002/01/24 16:08:47 1.1
+++ bnep.c 2002/01/29 09:00:37 1.2
@@ -389,7 +389,7 @@
struct bnep_compressed_ethernet_source_only bnep_c_s;
struct bnep_compressed_ethernet bnep_c;
void *bhdr;
- int i, j, bhdrlen, ethhdrlen =3D sizeof(struct ethhdr), buflen, strip_len=
=3D 0;
+ int i, bhdrlen, ethhdrlen =3D sizeof(struct ethhdr), buflen, strip_len =
=3D 0;
u16 proto, payload_proto;=20
int send_packet =3D 0;
int dest =3D 1;
@@ -420,36 +420,29 @@
}
=20=09
/* Check multicast filters */
- if (eth->h_dest[0] =3D=3D 1) {
- D_XMIT(__FUNCTION__": Multicast or broadcast packet\n");
+ if (eth->h_dest[0] & 1) {
+ D_XMIT(__FUNCTION__": Multicast packet, dest =3D %02x:%02x:%02x:%02x:%02=
x:%02x\n",=20
+ eth->h_dest[0], eth->h_dest[1], eth->h_dest[2],
+ eth->h_dest[3], eth->h_dest[3], eth->h_dest[5]);
=20=09=09
/* 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);=09=09=09
- /* Make sure that destination address is equal or within range */
- /* Double 'i' in order to get the start range in each filter */
- for (j =3D 0; j < 6 &&
- ((local->filter_multi_addr_list[i*2].addr[j] <=3D eth->h_dest[j])=
&&
- (local->filter_multi_addr_list[i*2+1].addr[j] >=3D eth->h_dest[j=
]));
- j++) {=09=09
- /* Each byte in destination address is within filter range */
- if (j >=3D 5)
- {
+ 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) {
D_MISC(__FUNCTION__": Multicast filter range %d OK\n",i);
send_packet =3D 1;
- break;
}
}
=20
/* All filter ranges have been examined */
- if (i >=3D (BNEP_MAX_MCAST_FILTER_RANGES-1)) {
+ if (!send_packet) {
D_XMIT(__FUNCTION__": Discarding multicast packet\n");
local->stats.tx_dropped++;
dev_kfree_skb(skb);
return 0;
}
}
- }
=20
/* Check protocol filters; first examine if 802.1p header */=20
if (proto =3D=3D 0x8100) {
@@ -893,7 +886,7 @@
struct net_device *dev;
struct net_local *local;
struct bnep_filter_response_msg rsp;=20=20
- int n,i,j, size =3D 0;
+ int n, i, size =3D 0;
bt_tx_buf *tx_buf;
u16 *filter;
=20=09
@@ -1129,16 +1122,17 @@
} else {=20
/* Set filter */
for (i =3D 0; i < n; i++) {
- for (j =3D 0; j < 6; j++) {
- local->filter_multi_addr_list[(used_filters+i)*2].addr[j] =3D=20
- data[j*i+j+2];
- local->filter_multi_addr_list[(used_filters+i)*2+1].addr[j] =3D=20
- data[6*(i+1)+j+2];
+ print_data("Adding multicast filter: ", data+2+i*12, 12);
=20=09=09=09=09=09
- D_MISC("Setting multi addr filter %02x - %02x \n",
- local->filter_multi_addr_list[i*2].addr[j],
- local->filter_multi_addr_list[i*2+1].addr[j]);
- }
+ /* Start address. */
+ memcpy(local->filter_multi_addr_list[(used_filters+i)*2].addr,
+ data+2+i*12,
+ 6);
+
+ /* End address. */
+ memcpy(local->filter_multi_addr_list[(used=
_filters+i)*2+1].addr,
+ data+2+i*12+6,
+ 6);
}
used_filters +=3D n;
}
--- bnep_test.c 2002/01/24 16:08:47 1.1
+++ bnep_test.c 2002/01/29 09:00:37 1.2
@@ -512,7 +512,10 @@
local =3D dev->priv;
l2cap =3D local->l2cap;
=20=09
- D_MISC("Set remote protocol filter \n");
+ printk("Set remote multicast filter %02x:%02x:%02x:%02x:%02x:%02x - "
+ "%02x:%02x:%02x:%02x:%02x:%02x",
+ filter[0], filter[1], filter[2], filter[3], filter[4], filter[5],
+ filter[6], filter[7], filter[8], filter[9], filter[10], filter[11]);
=20=09
bnep.bnep_type =3D BNEP_CONTROL;
bnep.bnep_control_type =3D BNEP_FILTER_NET_TYPE_SET_MSG;
|