|
From: Fredrik S. <fre...@us...> - 2002-03-08 09:41:42
|
The following files were modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
bluetooth.c 1.224 1.225=20=20=20=20=20=20=20=20=20=20=20
bnep.c 1.10 1.11=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
If BD address is changed also change MAC address of all BNEP interfaces.
The diff of the modified file(s):
--- bluetooth.c 28 Feb 2002 20:12:14 -0000 1.224
+++ bluetooth.c 8 Mar 2002 09:41:42 -0000 1.225
@@ -258,15 +258,6 @@
void bt_linebuf_send(s32 line);
#endif
=20
-#ifdef CONFIG_BLUETOOTH_PAN
-void bnep_init(void);
-void bnep_shutdown(void);
-u32 bnep_connect_req(u8 *bd_addr);
-u32 bnep_test(u8 *p);
-u32 bnep_set_multicast_filter(u8 *filter);
-u32 bnep_set_protocol_filter(u16 *filter);
-#endif
-
/****************** GLOBAL VARIABLE DECLARATION SECTION ******************=
***/
=20
extern hci_controller hci_ctrl;
@@ -1034,11 +1025,18 @@
}
=20=09
case HCIWRITEBDADDR:
+ {
copy_from_user(&bd_addr, (s32*)arg, size);
BT_DRIVER(__FUNCTION__ ": Setting BD_ADDR to\n");
print_data("bd:",(u8*)bd_addr,6);
hci_set_bd_addr(bd_addr);
+
+#ifdef CONFIG_BLUETOOTH_PAN
+ bnep_set_mac_address_all(bd_addr);
+#endif
+
break;
+ }
=20=09=09
/* | len (1) | hci header (4) | data (max 256)| */
case HCISENDRAWDATA:
--- bnep.c 25 Feb 2002 14:28:18 -0000 1.10
+++ bnep.c 8 Mar 2002 09:41:42 -0000 1.11
@@ -204,8 +204,8 @@
void
bnep_init(void)
{
- int i, j;
- char temp[8];
+ int i;
+ char temp[6];
=20=09
DSYS("Initializing BNEP\n");
=20=09
@@ -224,15 +224,13 @@
=20=09
/* Read BD address (converting to big endian) */
D_MISC("Read local BD addr\n");
- hci_read_local_bd(bd_addr);
+ hci_read_local_bd(temp);
for (i =3D 0; i < 6; i++) {
- temp[7-i] =3D bd_addr[i];
+ bd_addr[5-i] =3D temp[i];
}
=20=09
/* Set MAC address for all 7 interfaces. */
- for (j =3D 0; j < BNEP_INTERFACES; j++) {
- bnep_set_mac_address(&dev_bnep[j], &temp);
- }
+ bnep_set_mac_address_all(bd_addr);
=20
D_MISC("BNEP Initialized\n");
}
@@ -341,10 +339,27 @@
{
struct sockaddr *addr =3D p;
memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
- D_MISC("%s: changed MAC to %02X:%02x:%02x:%02x:%02x:%02x\n", dev->name,
+ DSYS("%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;
+}
+
+/*=20
+ * Set MAC address for all BNEP interfaces.
+ */
+void
+bnep_set_mac_address_all(u8 *addr)
+{
+ int j;
+ struct sockaddr saddr;
+
+ memcpy(saddr.sa_data, addr, 6);
+
+ /* Set MAC address for all 7 interfaces. */
+ for (j =3D 0; j < BNEP_INTERFACES; j++) {
+ bnep_set_mac_address(&dev_bnep[j], &saddr);
+ }
}
=20
/*
|