seanhold3n / android-wifi-tether

Automatically exported from code.google.com/p/android-wifi-tether
0 stars 0 forks source link

Random BSSID (MAC address) in every connection. #1104

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Which device (manufacturer, type)?

Any tested, actually I own a Desire Z

Which firmware is installed?

Doesn't matter, actually Cyanogen 7

What version of wireless tether are you using?

3.1 Beta5

What steps will reproduce the problem?

1 Just made the connection, ping the phone from the PC and do an arp -a from 
the PC. You will get the Android phone's MAC address

2 Disconnect and repeat the step 1, you will get a different MAC address.

3 Windows 7 (and vista) interpret this as a new connection, triggering the 
public/home/work  network wizard at each connection.

And naming a new connection with a progressive number

What is the expected output? What do you see instead?

An unique MAC address/BSSID should be used, I guess that just a single line of 
code to enforce the mac address should be enough.

Please provide any additional information below.

The froyo and gingerbread stock tethering are affected too, the HTC hot spot 
tethering is unaffected, Barnacle has a field to manually put a fixed BSSID

Original issue reported on code.google.com by thesolu...@gmail.com on 31 Aug 2011 at 2:04

GoogleCodeExporter commented 8 years ago
Which device-profile and setup-method (all in app-settings) are you using?
Have you tried to select the "desire"-profile and "softap"-setting?

Original comment by harald....@gmail.com on 1 Sep 2011 at 5:56

GoogleCodeExporter commented 8 years ago
desire + softap doesent work for me (windows doesent ask for the passphrase).

btw i looked via ifconfig and the HWaddr is still changing every time the 
internet sharing is enabled

I use nexus one + netd, which works perfectly for me, aside the annoying 
problem mentioned.

Original comment by thesolu...@gmail.com on 1 Sep 2011 at 12:25

GoogleCodeExporter commented 8 years ago
Hi same here, Android AP's interface MAC address keeps changing every time I 
create an AP. May that actually be a feature?

Original comment by christia...@googlemail.com on 2 Dec 2012 at 3:31

GoogleCodeExporter commented 8 years ago

I have a Samsung Galaxy Nexus running CyanogenMod 9 (Android ICS) and I've been 
experiencing this "bug".  This behavior is clearly intentional, but I'm not 
sure why...

The Broadcom WiFi driver is the culprit.  My driver is called 'bcmdhd', but 
yours might be different (check your dmesg output to see).  If you "repo" the 
CM9 source and cd to the kernel dir like so:

  cd kernel/samsung/tuna

You'll find the offending code in this file:

  drivers/net/wireless/bcmdhd/dhd_linux.c

It looks like this (I removed some of it):

  #ifdef SET_RANDOM_MAC_SOFTAP
      // ...
      srandom32((uint)jiffies);
      rand_mac = random32();
      iovbuf[0] = 0x02;              /* locally administered bit */
      iovbuf[1] = 0x1A;
      iovbuf[2] = 0x11;
      iovbuf[3] = (unsigned char)(rand_mac & 0x0F) | 0xF0;
      iovbuf[4] = (unsigned char)(rand_mac >> 8);
      iovbuf[5] = (unsigned char)(rand_mac >> 16);
      // ...
    }
  #endif /* SET_RANDOM_MAC_SOFTAP */

So we see that the last three octets of the SoftAP's BSSID get randomized.

This causes my laptop to always think it's seeing the AP for the very first 
time and therefore it never remembers my AP's password (which is annoying)...

The fix for me was to hardcode the last three octets (making them like the 
first three) and rebuild the kernel for my phone...

I realize this is not something that most users of android-wifi-tether will 
want or be able to do.  If someone wanted to create a more general fix in 
android-wifi-tether, I think it would be possible as the WiFi driver has some 
code nearby where it allows a custom MAC to be assigned, but I did not look 
into that...

Original comment by alfred.e...@gmail.com on 25 Mar 2013 at 5:28