|
From: Fredrik S. <fre...@us...> - 2002-02-20 10:13:38
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
bnep.c 1.7 1.8=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Removed stripping of the Ethernet checksum as this turned out to be a bug i=
n the Etrax Ethernet driver.
The diff of the modified file(s):
--- bnep.c 13 Feb 2002 14:05:03 -0000 1.7
+++ bnep.c 20 Feb 2002 10:13:37 -0000 1.8
@@ -411,20 +411,17 @@
{
bt_tx_buf *tx_buf;
struct net_local *local;
- struct net_local *other;
-=09
struct ethhdr *eth;
struct bnep_compressed_ethernet_dest_only bnep_c_d;
struct bnep_general_ethernet bnep_g;=20
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, j;
+ int i, bhdrlen, ethhdrlen =3D sizeof(struct ethhdr), buflen;
u16 proto, payload_proto;=20
int send_packet =3D 0;
int dest =3D 1;
int source =3D 1;
- int fromLAN =3D 1;
=20
eth =3D (struct ethhdr *)skb->data;
=20=09
@@ -582,40 +579,9 @@
=20
/* Everything examined; time to send the data */
=20
- /* check whether the we have room for the bt_tx_buf ( -4 ?) */
+ /* check whether we have room for the bt_tx_buf */
buflen =3D skb->len + sizeof(bnep_tx_buf) - ethhdrlen + bhdrlen;
=20=20=20
-
- /* Check the data source as we should
- strip 4 bytes when it comes from the LAN.=20
- Found during UPF7 but can't reproduce it here.*/
-#if 0
- for(i =3D 0 ; i < BNEP_INTERFACES; i++) {
- other =3D dev_bnep[i].priv;
- if(other->state !=3D CONNECTED) {
- continue;
- }
-=09
- for (j =3D 0; j < 6; j++) {
- if (eth->h_source[j] !=3D other->l2cap->remote_bd[5-j]) {
- fromLAN =3D 1;
- break;
- }
- fromLAN =3D 0;
- }
-
- if(!fromLAN) {
- break;
- }
- }
-
- if(!source && fromLAN && (skb->len >=3D 4)) {
- strip_len =3D 4;
- }
-
- buflen -=3D strip_len;
-#endif
-=20=20
D_XMIT("buflen %i\n",buflen);
if (buf_write_room() < buflen) {
D_ERR(__FUNCTION__": not enough room for a %d byte bt_tx_buf\n", skb->le=
n);
@@ -635,7 +601,7 @@
memcpy(tx_buf->data + sizeof(bnep_tx_buf) + bhdrlen,=20
skb->data + ethhdrlen,=20
buflen - bhdrlen - sizeof(bnep_tx_buf));
- tx_buf->cur_len =3D skb->len - ethhdrlen + bhdrlen - strip_len; /*-4*/
+ tx_buf->cur_len =3D skb->len - ethhdrlen + bhdrlen;
/* transmit the packet */
D_XMIT("bnep: tx packet\n");
l2cap_send_data(tx_buf, local->l2cap);
|
|
From: Fredrik S. <fre...@us...> - 2002-03-13 09:56:12
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Tag Comment
---- ----------- ----------- --- -------
bnep.c 1.11 1.12=20=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Disabled a debug printout.
The diff of the modified file(s):
--- bnep.c 8 Mar 2002 09:41:42 -0000 1.11
+++ bnep.c 13 Mar 2002 09:56:11 -0000 1.12
@@ -339,7 +339,7 @@
{
struct sockaddr *addr =3D p;
memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
- DSYS("%s: changed MAC to %02x:%02x:%02x:%02x:%02x:%02x\n", dev->name,
+ D_MISC("%s: changed MAC to %02x:%02x:%02x:%02x:%02x:%02x\n", dev->name,
dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2],=20
dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5]);
return 0;
@@ -599,7 +599,7 @@
=20
D_XMIT("buflen %i\n",buflen);
if (buf_write_room() < buflen) {
- D_ERR(__FUNCTION__": not enough room for a %d byte bt_tx_buf\n", skb->le=
n);
+ D_XMIT(__FUNCTION__": not enough room for a %d byte bt_tx_buf\n", skb->l=
en);
/* don't necessarily need to discard the buffer; could set dev->tbusy =
=3D 1
and then start a timer to check for free buffer space */
local->stats.tx_dropped++;
|
|
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;
}
|
|
From: Fredrik S. <fre...@us...> - 2002-03-21 15:15:11
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Tag Comment
---- ----------- ----------- --- -------
bnep.c 1.13 1.14=20=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Return correct network statistics for BNEP devices.
The diff of the modified file(s):
--- bnep.c 14 Mar 2002 13:44:07 -0000 1.13
+++ bnep.c 21 Mar 2002 15:15:06 -0000 1.14
@@ -373,7 +373,8 @@
static struct net_device_stats *
bnep_get_stats(struct net_device *dev)
{
- return (struct net_device_stats *)dev->priv;
+ struct net_local *local =3D (struct net_local *) dev->priv;
+ return &local->stats;
}
=20
/*
|
|
From: Willy S. <sag...@us...> - 2002-04-08 16:45:07
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Tag Comment
---- ----------- ----------- --- -------
bnep.c 1.14 1.15=20=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Added bnep_disconnect_req=20
The diff of the modified file(s):
--- bnep.c 21 Mar 2002 15:15:06 -0000 1.14
+++ bnep.c 8 Apr 2002 09:39:46 -0000 1.15
@@ -58,7 +58,7 @@
#include <linux/ioctl.h>
#include <linux/config.h>
#include <linux/module.h>
-#include <linux/malloc.h>
+#include <linux/slab.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
@@ -117,6 +117,8 @@
=20
/****************** GLOBAL VARIABLE DECLARATION SECTION ******************=
***/
=20
+static s32 result_param_bnep;
+
/*************************** UPF TEST VARS *******************************=
***/
extern int dont_send_reply;
=20
@@ -1277,18 +1279,23 @@
if (l2ca_connect_rsp(l2cap, RES_NOSRC, STAT_NOINFO)) {
D_ERR("bnep_connect_ind: l2ca_connect_rsp failed\n");
}
+ result_param_bnep |=3D 0xff;
return;
}
=20=20=20
if (l2ca_connect_rsp(l2cap, RES_SUCCESS, STAT_NOINFO)) {
D_ERR("bnep_connect_ind: l2ca_connect_rsp failed\n");
+ result_param_bnep |=3D 0xff;
return;
}
=20=09
// l2cap->dev =3D &dev_bnep[i];
+ result_param_bnep =3D ((l2cap->hci_hdl<<8)&0x0ffff00) + ((i<<24)&0=
xff000000);
local->state =3D BNEP_CONFIG;
local->initiator =3D 0;
l2cap->upper_con =3D (void *)&dev_bnep[i];
+
+ result_param_bnep &=3D 0xffffff00;
}
=20
static void
@@ -1474,7 +1481,33 @@
return -1;
}
=20=09
+ return result_param_bnep;
+}
+
+u32
+bnep_disconnect_req(u8 *bd_addr)
+{
+ struct net_local *local;
+ int i;
+
+ DSYS("BNEP: Shutting down BD_ADDR %02x:%02x:%02x:%02x:%02x:%02x\n",
+ bd_addr[0],bd_addr[1],bd_addr[2],bd_addr[3],bd_addr[4],bd_addr[5]);
+=20=09
+ for (i =3D 0; i < BNEP_INTERFACES; i++) {
+ local =3D dev_bnep[i].priv;
+ if (local !=3D NULL && local->l2cap !=3D NULL && local->l2cap->remote_bd=
!=3D NULL)
+ if (memcmp(local->l2cap->remote_bd, bd_addr, 6)) {
+ D_MISC("Disconnecting %s\n", dev_bnep[i].name);
+ if (l2ca_disconnect_req(local->l2cap)) {
+ D_ERR(__FUNCTION__": l2ca_connect_req failed\n");
+ return -1;
+ }
+ else
return 0;
+ }
+ }
+ DSYS("BNEP: bnep_disconnect_req bd_addr no found !!!\n");
+ return -1;
}
=20
s32
|
|
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 */
|
|
From: Orjan F. <or...@us...> - 2003-03-30 17:14:20
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Tag Comment
---- ----------- ----------- --- -------
bnep.c 1.16 1.17=20=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
(On behalf of anderstj.) Added support for forwarding unknown extension
headers.
The diff of the modified file(s):
--- bnep.c 9 Jan 2003 09:56:19 -0000 1.16
+++ bnep.c 30 Mar 2003 17:13:31 -0000 1.17
@@ -112,6 +112,7 @@
#endif
=20
#define BNEP_INTERFACES 7
+#define MAX_EHEADERS 20
=20
/****************** TYPE DEFINITION SECTION ******************************=
***/
=20
@@ -708,6 +709,9 @@
struct net_device *dev;
struct net_local *local;
struct ethhdr *eth, eth_header;
+ bt_tx_buf *tx_buf;
+ u8 *unknown_eheaders[MAX_EHEADERS];
+ u8 eheader_count =3D 0;
u8 type;
u8 eheaders;
int blen,skblen;
@@ -847,8 +851,13 @@
break;
=20
default:
- D_ERR(__FUNCTION__": Unknown extension header %02x length %i\n",
+ D_ERR(__FUNCTION__": Unknown extension header %02x length %i, store tem=
porarily for receiving PANU\n",
type, eheader->length);
+ if (eheader_count < MAX_EHEADERS) {
+ unknown_eheaders[eheader_count++] =3D data=
+ pos;
+ } else {
+ D_ERR(__FUNCTION__": Too many extension he=
aders\n");
+ }
}
=20
pos +=3D eheader->length + 2;
@@ -858,6 +867,109 @@
}
}
=20
+ /* If we found any unknown eheaders we must forward them if the destinati=
on
+ address belongs to a PANU currently connected to us */
+ if(eheader_count && eth_frame) {
+ struct net_local *remote;
+ int i, j;
+ for (i =3D 0; i < BNEP_INTERFACES; i++) {
+ remote =3D dev_bnep[i].priv;
+ if (remote !=3D NULL && remote->l2cap !=3D NULL && remote->l2cap->remot=
e_bd !=3D NULL) {
+ for(j =3D 0 ; j < 6 ; j++) {
+ if(eth->h_dest[j] !=3D remote->l2cap->remote_bd[5 - j]) {
+ break;
+ }
+ }
+=09=09=09=09
+ if(j =3D=3D 6) {
+ break;
+ }
+ }
+ }
+=09=09
+ if(i !=3D BNEP_INTERFACES) {
+ /* OK, this PANU is connected to us, let's forward
+ all data with the unknown extentionheaders to
+ the PANU */
+ struct bnep_compressed_ethernet_source_only bnep_c_s;
+ struct bnep_eheader *eheader;
+ u16 totallen;
+
+ bnep_c_s.bnep_type =3D BNEP_COMPRESSED_ETHERNET_SOURCE_ONLY | 0x80;
+ bnep_c_s.type =3D eth->h_proto;
+ for ( i =3D 0 ; i < 6; i++) {
+ bnep_c_s.saddr[i] =3D eth->h_source[i];
+ }
+
+ totallen =3D sizeof(struct bnep_compressed_ethernet_source_only);
+=09=09=09
+ /* Calculate length for all eheaders and make sure eheader-bit is set */
+ for(i =3D 0 ; i < eheader_count ; i++)
+ {
+ totallen +=3D sizeof(struct bnep_eheader);
+ eheader =3D (struct bnep_eheader *)unknown_eheaders[i];
+ totallen +=3D eheader->length;
+ eheader->bnep_type |=3D 0x80;
+ }
+=09=09=09
+ /* Clear last extension bit in eheaders */
+ eheader->bnep_type &=3D 0x7f;
+
+ /* Calculate length for the payload data */
+ totallen +=3D (len - pos);
+=09=09=09
+ /* Subscribe from memorybuffer */
+ if (buf_write_room() < totallen) {
+ D_XMIT(__FUNCTION__": not enough room for a %d byte bt_tx_buf\n", skb-=
>len);
+ /* don't necessarily need to discard the buffer; could set dev->tbusy =
=3D 1
+ and then start a timer to check for free buffer space */
+ local->stats.tx_dropped++;
+ return;
+=09=09=09=09
+ } else {
+ int header_len =3D sizeof(struct bnep_compressed_ethernet_source_only);
+ /* subscribe to a bt_tx_buf */
+ D_XMIT("New bt buf length %i \n", totallen);
+ if ((tx_buf =3D subscribe_bt_buf(totallen + sizeof(bnep_tx_buf))) =3D=
=3D NULL) {
+ D_ERR(__FUNCTION__": failed to subscribe %d bytes\n",=20
+ totallen);
+ remote->stats.tx_dropped++;
+ return;
+=09=09=09=09=09
+ } else {
+ /* copy the header to the bt_tx_buf */
+ memcpy(tx_buf->data + sizeof(bnep_tx_buf),=20
+ &bnep_c_s,=20
+ header_len);
+=09=09=09=09=09
+ /* copy all extension headers into buffer */
+ j =3D 0;
+ for(i =3D 0 ; i < eheader_count ; i++) {
+ eheader =3D (struct bnep_eheader *)unknown_eheaders[i];
+ printk("Copy eheader val: %02x, len %02x\n", eheader->bnep_type, ehe=
ader->length);
+ memcpy(tx_buf->data + sizeof(bnep_tx_buf) + header_len + j,=20
+ unknown_eheaders[i], eheader->length + sizeof(struct bnep_ehe=
ader));
+ j +=3D eheader->length + sizeof(struct bnep_eheader);
+ }
+=09=09=09=09=09
+ /* copy rest of the payload data */
+ memcpy(tx_buf->data + sizeof(bnep_tx_buf) + header_len + j,
+ data + pos,
+ len - pos);
+=09
+ tx_buf->cur_len =3D header_len + j + (len - pos);
+ /* transmit the packet */
+ D_XMIT("bnep: tx packet\n");
+ /* update the device statistics */
+ remote->stats.tx_packets++;
+ remote->stats.tx_bytes +=3D totallen;
+ l2cap_send_data(tx_buf, remote->l2cap);
+ return;
+ }
+ }
+ }
+ }=09=09
+
if (eth_frame =3D=3D 1) {
D_REC("eth header src %02x.%02x.%02x.%02x.%02x.%02x "
"dst %02x.%02x.%02x.%02x.%02x.%02x type %04x\n",=20
@@ -1255,7 +1367,7 @@
(void*)&rsp,
sizeof(struct bnep_control_command_not_understood));
tx_buf->cur_len =3D sizeof(struct bnep_control_command_not_understood);
- D_MISC("BNEP send filter response msg\n");
+ D_MISC("BNEP send command not understood response msg\n");
l2cap_send_data(tx_buf, local->l2cap);
}
}
|
|
From: Anders J. <and...@us...> - 2003-06-05 11:32:30
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Tag Comment
---- ----------- ----------- --- -------
bnep.c 1.17 1.18=20=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Filters are reset after a disconnect.
The diff of the modified file(s):
--- bnep.c 2003/03/30 17:13:31 1.17
+++ bnep.c 2003/06/05 11:32:28 1.18
@@ -153,6 +153,8 @@ static void bnep_receive_packet(l2cap_co
static int bnep_control(l2cap_con *l2cap, u8 *data, u8 bnep_control_type);
=20
/* Misc functions */
+static void bnep_reset_multicast_filter(struct net_local *local);
+static void bnep_reset_protocol_filter(struct net_local *local);
s32 check_filter(unsigned char *filter1, unsigned char *filter2, u16 size);
=20
=20
@@ -1163,20 +1165,10 @@ bnep_control(l2cap_con *l2cap, u8 *data,
rsp.bnep_control_type =3D BNEP_FILTER_NET_TYPE_RESPONSE_MSG;
rsp.bnep_response_msg =3D cpu_to_be16(SUCCESS);
=20=09=09
-=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++) {
- local->filter_list[i*2] =3D 0;
- local->filter_list[i*2+1] =3D 0;
- }
-
- /* Accept all packet types */
- local->filter_list[0] =3D 0x0000;
- local->filter_list[1] =3D 0xffff;
+ bnep_reset_protocol_filter(local);
used_filters=3D0;
- }=20
+=09=09=20
if (n =3D=3D 0) {
}=20
else if (n > BNEP_MAX_PROTOCOL_FILTER_RANGES) {
@@ -1266,12 +1258,7 @@ bnep_control(l2cap_con *l2cap, u8 *data,
=20=09=09
/* If no filters are set, reset filter list */
D_MISC(__FUNCTION__" Reset all multicast filters and accep=
t all addresses\n");
- for (i=3D0;i<BNEP_MAX_MCAST_FILTER_RANGES;i++) {
- memset(&local->filter_multi_addr_list[i*2].addr[0],0,6);
- memset(&local->filter_multi_addr_list[i*2+1].addr[0],0,6);
- }
- /* Accept all multicast addresses */
- memset(&local->filter_multi_addr_list[1].addr[0],0xff,6);
+ bnep_reset_multicast_filter(local);
used_filters=3D0;
=20
if (n =3D=3D 0) {
@@ -1552,6 +1539,8 @@ bnep_disconnect_ind(l2cap_con *l2cap)=20
local =3D dev->priv;
local->l2cap =3D NULL;
local->state =3D DISCONNECTED;
+ bnep_reset_multicast_filter(local);
+ bnep_reset_protocol_filter(local);
}
}
=20
@@ -1566,6 +1555,8 @@ bnep_disconnect_cfm(l2cap_con *l2cap)=20
dev =3D (struct net_device *)l2cap->upper_con;
local =3D dev->priv;
local->state =3D DISCONNECTED;
+ bnep_reset_multicast_filter(local);
+ bnep_reset_protocol_filter(local);
=20=09
DSYS(__FUNCTION__": disconnected\n");
local->l2cap =3D NULL;
@@ -1646,6 +1637,32 @@ bnep_disconnect_req(u8 *bd_addr)
}
DSYS("BNEP: bnep_disconnect_req bd_addr no found !!!\n");
return -1;
+}
+
+static void=20
+bnep_reset_multicast_filter(struct net_local *local)
+{
+ int i;
+ for (i =3D 0 ; i < BNEP_MAX_MCAST_FILTER_RANGES ; i++) {
+ memset(&local->filter_multi_addr_list[i*2].addr[0],0,6);
+ memset(&local->filter_multi_addr_list[i*2+1].addr[0],0,6);
+ }
+ /* Accept all multicast addresses */
+ memset(&local->filter_multi_addr_list[1].addr[0],0xff,6);
+}
+
+static void=20
+bnep_reset_protocol_filter(struct net_local *local)
+{
+ int i;
+ for (i=3D0;i<BNEP_MAX_PROTOCOL_FILTER_RANGES;i++) {
+ local->filter_list[i*2] =3D 0;
+ local->filter_list[i*2+1] =3D 0;
+ }
+=09
+ /* Accept all packet types */
+ local->filter_list[0] =3D 0x0000;
+ local->filter_list[1] =3D 0xffff;
}
=20
s32
|
|
From: Anders J. <and...@us...> - 2003-06-05 12:13:07
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Tag Comment
---- ----------- ----------- --- -------
bnep.c 1.16 1.16.2.1 change_branch--bnep_fix=20=20
The accompanying log:
Filters are reset after a disconnect.
The diff of the modified file(s):
--- bnep.c 2003/01/09 09:56:19 1.16
+++ bnep.c 2003/06/05 12:13:04 1.16.2.1
@@ -152,6 +152,8 @@ static void bnep_receive_packet(l2cap_co
static int bnep_control(l2cap_con *l2cap, u8 *data, u8 bnep_control_type);
=20
/* Misc functions */
+static void bnep_reset_multicast_filter(struct net_local *local);
+static void bnep_reset_protocol_filter(struct net_local *local);
s32 check_filter(unsigned char *filter1, unsigned char *filter2, u16 size);
=20
=20
@@ -1051,20 +1053,10 @@ bnep_control(l2cap_con *l2cap, u8 *data,
rsp.bnep_control_type =3D BNEP_FILTER_NET_TYPE_RESPONSE_MSG;
rsp.bnep_response_msg =3D cpu_to_be16(SUCCESS);
=20=09=09
-=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++) {
- local->filter_list[i*2] =3D 0;
- local->filter_list[i*2+1] =3D 0;
- }
-
- /* Accept all packet types */
- local->filter_list[0] =3D 0x0000;
- local->filter_list[1] =3D 0xffff;
+ bnep_reset_protocol_filter(local);
used_filters=3D0;
- }=20
+
if (n =3D=3D 0) {
}=20
else if (n > BNEP_MAX_PROTOCOL_FILTER_RANGES) {
@@ -1154,12 +1146,7 @@ bnep_control(l2cap_con *l2cap, u8 *data,
=20=09=09
/* If no filters are set, reset filter list */
D_MISC(__FUNCTION__" Reset all multicast filters and accep=
t all addresses\n");
- for (i=3D0;i<BNEP_MAX_MCAST_FILTER_RANGES;i++) {
- memset(&local->filter_multi_addr_list[i*2].addr[0],0,6);
- memset(&local->filter_multi_addr_list[i*2+1].addr[0],0,6);
- }
- /* Accept all multicast addresses */
- memset(&local->filter_multi_addr_list[1].addr[0],0xff,6);
+ bnep_reset_multicast_filter(local);
used_filters=3D0;
=20
if (n =3D=3D 0) {
@@ -1440,6 +1427,8 @@ bnep_disconnect_ind(l2cap_con *l2cap)=20
local =3D dev->priv;
local->l2cap =3D NULL;
local->state =3D DISCONNECTED;
+ bnep_reset_multicast_filter(local);
+ bnep_reset_protocol_filter(local);
}
}
=20
@@ -1454,6 +1443,8 @@ bnep_disconnect_cfm(l2cap_con *l2cap)=20
dev =3D (struct net_device *)l2cap->upper_con;
local =3D dev->priv;
local->state =3D DISCONNECTED;
+ bnep_reset_multicast_filter(local);
+ bnep_reset_protocol_filter(local);
=20=09
DSYS(__FUNCTION__": disconnected\n");
local->l2cap =3D NULL;
@@ -1534,6 +1525,32 @@ bnep_disconnect_req(u8 *bd_addr)
}
DSYS("BNEP: bnep_disconnect_req bd_addr no found !!!\n");
return -1;
+}
+
+static void=20
+bnep_reset_multicast_filter(struct net_local *local)
+{
+ int i;
+ for (i =3D 0 ; i < BNEP_MAX_MCAST_FILTER_RANGES ; i++) {
+ memset(&local->filter_multi_addr_list[i*2].addr[0],0,6);
+ memset(&local->filter_multi_addr_list[i*2+1].addr[0],0,6);
+ }
+ /* Accept all multicast addresses */
+ memset(&local->filter_multi_addr_list[1].addr[0],0xff,6);
+}
+
+static void=20
+bnep_reset_protocol_filter(struct net_local *local)
+{
+ int i;
+ for (i=3D0;i<BNEP_MAX_PROTOCOL_FILTER_RANGES;i++) {
+ local->filter_list[i*2] =3D 0;
+ local->filter_list[i*2+1] =3D 0;
+ }
+=09
+ /* Accept all packet types */
+ local->filter_list[0] =3D 0x0000;
+ local->filter_list[1] =3D 0xffff;
}
=20
s32
|
|
From: Anders J. <and...@us...> - 2004-01-27 12:18:35
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Tag Comment
---- ----------- ----------- --- -------
bnep.c 1.20 1.21=20=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Handle source/dest UUID correctly when send setup connection for BNEP.
The diff of the modified file(s):
--- bnep.c 2003/11/05 17:03:14 1.20
+++ bnep.c 2004/01/27 12:17:35 1.21
@@ -1075,6 +1075,7 @@ bnep_control(l2cap_con *l2cap, u8 *data,
D_MISC("UUID length: %x, dest uuid: %02lx, source uuid: %02lx\n",
data[0], destination_uuid, source_uuid);
local->remote_role =3D source_uuid;
+ local->role =3D destination_uuid;
/* Lets compare destination uuid, dont care about source uuid */
if (destination_uuid =3D=3D UUID_NAP || destination_uuid =3D=3D UUID_GN=
) {=09
D_MISC("uuids are matching, enter connected state\n");
@@ -1595,12 +1596,12 @@ bnep_setup_connection(struct net_local *
*(u16*)(tx_buf->data +=20
sizeof(bnep_tx_buf) +=20
sizeof(struct bnep_setup_connection_request_msg)) =3D=20
- cpu_to_be16(UUID_NAP);
+ cpu_to_be16(local->remote_role);
=20=09=09
*(u16*)(tx_buf->data +=20
sizeof(bnep_tx_buf) +=20
sizeof(struct bnep_setup_connection_request_msg) + 2) =3D=20
- cpu_to_be16(UUID_PANU);
+ cpu_to_be16(local->role);
=20=09=09
tx_buf->cur_len =3D (sizeof(struct bnep_setup_connection_request_msg) +=
=20
req.uuid_size * 2);
|