After emerging macchanger, and adding mac_eth0="XX:XX:XX:XX:XX:XX" (where XX:XX:XX:XX:XX:XX is a valid address), every attempt to bring up the network interface fails with "Failed to set MAC address" Reproducible: Always Steps to Reproduce: 1. 2. 3. This problem is caused by the following code in /lib/rcscripts/net.modules.d/macchanger: e=$( /sbin/macchanger ${opts} ${IFACE} ) if [[ -n ${e} ]]; then eerror "Failed to set MAC address" return 1 fi The code checks for no output from macchanger, but macchanger *always* produces output, whether it succeeds or not. In my case I removed the if statement and it works now.
Forgot to note - this is baselayout-1.11.3
try this patch: --- macchanger 13 Oct 2004 17:13:49 -0000 1.8 +++ macchanger 25 Oct 2004 23:32:00 -0000 @@ -75,8 +75,8 @@ *) opts="${opts} ${mac}" ;; esac - e=$( /sbin/macchanger ${opts} ${IFACE} ) - if [[ -n ${e} ]]; then + /sbin/macchanger ${opts} ${IFACE} > ${devnull} + if [[ $? -ne 0 ]] ; then eerror "Failed to set MAC address" return 1 fi
That makes it work. From looking at the code to macchanger, there seem to be some failure cases that would return with a successful exit status, though.
There are some cases where you get an error message but a success result and some cases where you get an error result but no error message. e=$( /sbin/macchanger ${opts} ${iface} 2>&1 1>/dev/null || echo failed ) should fix it :)
This should be fixed in baselayout-1.11.5
you heard the man