OpenWrt Forum Archive

Topic: nvram variable il0macaddr ?

The content of this topic has been archived on 4 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I spent a while debugging why WDS was not working before stumbling on this:

I had noticed after upgrading one end of a WDS pair, a WRT54GS from (blech) DD-WRT to Kamikaze
brcm-2.4 7.06  that well.... WDS no longer worked.  After some fiddling first thing I noticed was that
the MAC address of my wl0 interface was now same as nvram get il0macaddr
00:90:4c:5f:00:2a

I poked for a while trying to find an option for /etc/config/wireless to set the MAC, nothing.
Finally I set nvram il0macaddress to the value I knew it to be previously (looked at WDS setting
on it's partner) and everything worked.   This seem wrong but it fixed my immediate problem
and got my link back up again. Phew!

Question is what SHOULD I have done?

And why is that every Linksys router I check seems to have this variable set to same value?

(Last edited by vincentfox on 12 Jun 2007, 08:54)

re: http://forum.openwrt.org/viewtopic.php?id=10981

Yep, there's something going on - I figure it's strangely up to firmware to set/correct il0macaddr because it seems to affect the Broadcom proprietary stuff (if someone can confirm otherwise, I'm curious).  Kamikaze 7.06 leaves nvram alone.  Do you erase nvram, too?

Coincidentally, DD-WRT's 800+ nvram variables is why I got clearing nvram. smile  And BTW, I set all those variables to the WhiteRussian defaults only because I wanted them sane if I ever flash something else.

(Last edited by Bill_MI on 12 Jun 2007, 11:55)

No I did not erase nvram between flashing.

So are you saying changing il0macaddr is inappropriate or dangerous?

Would be interesting to see value of a unit freshly flashed from Linksy factory firmware.   I only have older WRT around at the moment that have been total sluts and had many firmware, no virgin units.

Hmmm... I got that exact default value for il0macaddr when I erased nvram and rebooted into Kamikaze 7.06 image.  The CFE loads up a bunch of default values.  I did this a lot with Whiterussian and il0macaddr always ended up as et0macaddr +2.

Do you have et0macaddr set?  Normal (Whiterussian, DD-WRT on CFE defaulted nvram):
et0macaddr=00:14:BF:xx:xx:49
il0macaddr=00:14:bf:xx:xx:4b

To support where I'm coming from, here's the values extracted from the CFE nvram area:
et0macaddr=00:90:4C:60:00:2A
il0macaddr=00:90:4c:5f:00:2a

I like this technique to get cfe defaults:
dd if=/dev/mtdblock/0 bs=1 skip=4116 count=2048 | strings > /tmp/cfe.txt

What can it be but Whiterussian and DD-WRT corrected il0macaddr but Kamikaze did not?  You may have triggered CFE to do this by some other means.  Just speculating.  I'm not sure what exact situation triggers CFE to write values.

(Last edited by Bill_MI on 13 Jun 2007, 02:26)

il0macaddr=00:90:4c:5f:00:2a is the CFE default for my WRT54GL as well.  So I want to change it, in the past I used the nvram, but now with Kamikaze, where should I (can I?) define it inside of /etc/config/*?

atm, I changed it to what I need it to be in the nvram, and it's reading the new value from there.

(Last edited by Duon on 22 Jun 2007, 00:42)

The more I think about it, this is one of those grey areas between KAMIKAZE DOES NOT USE NVRAM and reality.  The reality is there are some things you have to read from nvram on a Broadcom device. In this case it looks like that something is the MAC.

You can generate a custom CFE with the corrected default value, so in case NVRAM ever gets cleared it gets reset again correctly.

Alternatively if you don't mess with CFE, I would write a boot-script to check that value and correct it if it goes back to defaults.

Both answers do not seem elegant though.

(Last edited by vincentfox on 22 Jun 2007, 01:21)

For what it's worth from my own curiosity, I found this in White Russian 0.9:

/etc/init.d/S05nvram (last lines)

[ "$(nvram get il0macaddr)" = "00:90:4c:5f:00:2a" ] && {
    # if default wifi mac, set two higher than the lan mac
    nvram set il0macaddr=$(nvram get et0macaddr|
    awk '{OFS=FS=":";for(x=7,y=2;--x;){$x=sprintf("%02x",(y+="0x"$x)%256);y/=256}print}')
}

Looks like there's a good argument to put this in Kamikaze.

The analogous script in Kamikaze appears to be /etc/init.d/netconfig

(Last edited by vincentfox on 22 Jun 2007, 02:45)

The discussion might have continued from here.