Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 68893 - Setting MAC of network card using mac_eth0 fails every time - baselayout
Summary: Setting MAC of network card using mac_eth0 fails every time - baselayout
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: x86 Linux
: High major (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-10-25 14:10 UTC by Manuel McLure
Modified: 2004-11-02 15:53 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Manuel McLure 2004-10-25 14:10:29 UTC
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.
Comment 1 Manuel McLure 2004-10-25 14:16:35 UTC
Forgot to note - this is baselayout-1.11.3
Comment 2 SpanKY gentoo-dev 2004-10-25 16:32:08 UTC
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
Comment 3 Manuel McLure 2004-10-25 18:01:37 UTC
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.
Comment 4 Roy Marples (RETIRED) gentoo-dev 2004-10-29 04:22:54 UTC
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 :)
Comment 5 Roy Marples (RETIRED) gentoo-dev 2004-11-02 09:23:40 UTC
This should be fixed in baselayout-1.11.5
Comment 6 SpanKY gentoo-dev 2004-11-02 15:53:29 UTC
you heard the man