Comment 8 for bug 787192

Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote : Re: [Bug 787192] Re: Network Manager Cloned MAC Address feature fails on WPA Wireless Networks

On Mon, Jun 6, 2011 at 12:43 PM, Jean-Sébastien Gosselin
<email address hidden> wrote:
> I've tried to do the workaround suggested in
> http://markmail.org/message/5ary4cvzlirvro73, but unfortunately there is
> just not enough information for a non-programmer like me to do this
> right.
>
> On a more specific level, I do not understand where exactly I should add
> the code lines mentioned in point 3. Anybody can walk me through this
> please?

Sure.

Assuming you have a script that changes the MAC address for your
device, you'll need to add it to the upstart script for
NetworkManager. I didn't have a script, so I'm calling macchanger
directly in the example below.

This is what I added to /etc/init.d/network-manager.conf to achieve
the MAC change, but I'm doing it for a wifi device:

pre-start script
 macchanger -m 00:DE:AD:BE:EF:0f wlan0
 /sbin/wpa_supplicant -u -s -O /var/run/wpa_supplicant &
 python -c 'import dbus; print
dbus.SystemBus().call_blocking("fi.epitest.hostap.WPASupplicant",
"/fi/epitest/hostap/WPASupplicant", "fi.epitest.hostap.WPASupplicant",
"addInterface", "sa{sv}", ("wlan0", {"driver":"wext"}))'
end script

post-stop script
 macchanger -p wlan0
end script

And that's it. No need to have config in the dialog for a cloned mac
address in that case. This is for Natty, if you're running on Maverick
it might be slightly different (such as dropping -O
/var/ruin/wpa_supplicant, I think). I think the python call isn't
necessary either in this case, since you're not having cloned MAC
settings in NM itself, everything is done *before* NM is started. For
wired devices, you only need the macchanger part.

To test:

sudo stop network-manager
*edit the file /etc/init/network-manager.conf as above*
sudo start network-manager

If things break, that's what the post-stop script is there to fix:
revert the mac address to what it should be by default: macchanger -p
*device* does this.

Mathieu Trudel-Lapierre <email address hidden>
Freenode: cyphermox, Jabber: <email address hidden>
4096R/EE018C93 1967 8F7D 03A1 8F38 732E FF82 C126 33E1 EE01 8C93