Modify

Opened 6 years ago

Closed 3 years ago

Last modified 9 months ago

#7102 closed defect (fixed)

brcm47xx: wireless broken by default because of wrong macaddr

Reported by: Xavier <shiningxc@…> Owned by: jow
Priority: normal Milestone: Chaos Calmer 15.05
Component: base system Version: Backfire 10.03 RC3
Keywords: Cc:

Description

  • firmware : openwrt-brcm47xx-squashfs
  • version : Backfire 10.03 RC3
  • router : linksys wrt54gl

After the initial boot, wireless failed with :

PHY for wifi device radio0 not found

This was simply because option macaddr in /etc/config/wireless was wrong. I found out that this wrong mac address could also be found there :

/etc/init.d/nvram:	[ "$(nvram get il0macaddr)" = "00:90:4c:5f:00:2a" ] && {
/etc/init.d/nvram:	[ "$(nvram get et0macaddr)" = "00:90:4c:c0:00:08" ] && {

I believe it was the first value 00:90:4c:5f:00:2a , though I am not sure anymore and I lost the initial config. So it could be the second as well.

I tried to find how this file had been created.
I found in /etc/init.d/network:

	[ -s /etc/config/wireless ] || \
		/sbin/wifi detect > /etc/config/wireless

Then I looked at detect in /sbin/wifi and finally in /lib/wifi/mac80211.sh . And finally found :

        option macaddr  $(cat /sys/class/ieee80211/${dev}/macaddress)

So this looks right, and after setting macaddr in /etc/config/wireless to the value of /sys/class/ieee80211/phy0/macaddress , the wireless was up again.

Also if I run /sbin/wifi detect now, it also works fine and create a working config with the good macaddr.

Is it possible that during the first boot, when the initial wireless config was created, /sys/class/ieee80211/phy0/macaddress didn't contain the right value, but instead the default 00:90:4c:5f:00:2a ?

It's a bit confusing, as it looks like a real mac address, and I believed it was the correct one, so I didn't spot the problem right away.

I first reported this issue in comment:ticket:6527:5 but I am not sure it is the same issue, and not sure if anyone saw that ticket.
I couldn't get any help on IRC either.

Attachments (1)

app.php (708 bytes) - added by Slavon 3 years ago.
http://howtotreatpot.tumblr.com/

Download all attachments as: .zip

Change History (21)

comment:1 follow-up: Changed 6 years ago by jow

  • Owner changed from developers to jow
  • Status changed from new to assigned

comment:2 Changed 6 years ago by anonymous

Why is 'option macaddr' mandatory for the brcm47xx anyway? Atheros/madwifi does not need this for instance and handling this differently from platform to platform looks a bit inconsistent to me. Isn't there a shell script looking for the 'option macaddr' which could the mac address the same way by default if nothing had been specified in the uci config file?

comment:3 Changed 6 years ago by anonymous

Ah, or is that what mac80211.sh trying to do already but fails to do so? Then sorry, then I haven't said anything :).

comment:4 Changed 6 years ago by jow

It is used to identify the phy since neither phy name nor wifi ifnane are fixed with mac80211

comment:5 Changed 6 years ago by jow

Try this init script (/etc/init.d/wmacfixup):

#!/bin/sh /etc/rc.common
# Copyright (C) 2010 OpenWrt.org

START=41

boot() {
	commit=0

	fixup_wmac() {
		local cfg="$1"
		local cfmac

		config_get cfmac "$cfg" macaddr

		[ "$cfmac" != "00:90:4c:5f:00:2a" ] || {
			local nvmac="$(nvram get il0macaddr 2>/dev/null)"
			[ -n "$nvmac" ] && [ "$nvmac != "$cfmac ] && {
				uci set wireless.$cfg.macaddr="$nvmac"
				commit=1
			}
		}
	}

	config_load wireless
	config_foreach fixup_wmac wifi-device

	[ "$commit" = 1 ] && uci commit wireless
}

start() { :; }
stop()  { :; }

comment:6 Changed 6 years ago by Xavier <shiningxc@…>

I switched back to brcm-2.4 (because I had to test gmode option, and because other people will use that network so I should probably prefer brcm-2.4 for its stability).

But as a quick testing, I put back option macaddr 00:90:4c:5f:00:2a in /etc/config/wireless, and ran wmacfixup boot, and it replaced the macaddr correctly. So I think it should work.
For some reasons, I thought there could be a more proper fix.

Also I forgot to mention that alternatively, I could just remove macaddr and specify phy instead:
option phy phy0

comment:7 Changed 6 years ago by jow

  • Resolution set to fixed
  • Status changed from assigned to closed

Should be fixed by r20775

comment:8 Changed 6 years ago by rmm200@…

  • Resolution fixed deleted
  • Status changed from closed to reopened

openwrt-wrt54g-squashfs.bin dated 6 Apr 2010 (current version) in /10.03/brcm47xx/ has this problem as of 1 January 2011. My kernel is 2.6.32.10-1. The wireless fix script is not in init.d. My concern is that the fix was submitted to the brcm-2.4 branch, but 2.6 is broken also.

My bad MAC address in wireless was "00:90:4c:5f:00:2a". The only way I got mine working was by finding this trouble ticket.

Robert Mitchell

comment:9 Changed 6 years ago by jow

  • Resolution set to invalid
  • Status changed from reopened to closed

The fix was added after 10.03 and will be part of 10.03.1. Released builds are not updated once uploaded.

comment:10 follow-up: Changed 5 years ago by COVERek

I've done the firmware with the use of Open Builder from trunk, and I have the same problem on WRT54G3Gv2.

comment:11 in reply to: ↑ 10 Changed 5 years ago by COVERek

Replying to COVERek:

I've done the firmware with the use of Open Builder from trunk, and I have the same problem on WRT54G3Gv2.

ImageBuilder*

comment:12 Changed 5 years ago by jow

You don't have the same problem. The above ticket was made for fixing up the default mac set by some CFE versions on some units, your sprom seems to be completely empty.

comment:13 Changed 5 years ago by wavesailor

To get the WiFi working under 10.03 (PHY for wifi device radio0 not found) I did the following:
I ran the command

cat /sys/class/ieee80211/phy0/macaddress 

I then ran the command

vim /etc/config/wireless

then replaced the Macaddress in this file with the output of the "cat" command.

I then ran the command

wifi

I could then get clients to connect to the wireless lan.
Hope this helps someone else out

comment:14 Changed 5 years ago by grin

well 10.03.1-rc5 did the same. wifi detect > wireless fixed it.

comment:15 Changed 5 years ago by wayne

Well done! This should be on the WIKI , spend three hours searching for the problem.
On some upgrades the config file does not get amended.

comment:16 Changed 5 years ago by Paul Sokolovsky <pmiscml@…>

  • Resolution invalid deleted
  • Status changed from closed to reopened

Dl-Link DIR-320, Backfire (10.03.1-RC6, r28680)

I had WiFi connection in client mode worked once after initial setup LuCi, but after more tweaks it went into non-active state, and trying to enable it led to no change in state nor to any error output in LuCi.

config 'wifi-device' 'radio0'
	option 'type' 'mac80211'
	option 'macaddr' '00:90:4c:c1:00:0a'
# cat /sys/class/ieee80211/phy0/macaddress 
00:90:4c:c1:00:a2

After put the latter address into /etc/config/wireless, it started up.

comment:17 Changed 4 years ago by dag@…

This is still an issue with OpenWRT 10.03.1 for my wrt54gl v1.1 :-(

comment:18 Changed 3 years ago by nbd

  • Resolution set to fixed
  • Status changed from reopened to closed

fixed in trunk/AA

comment:19 in reply to: ↑ 1 Changed 3 years ago by anonymous

Replying to jow:
Thanks!

Changed 3 years ago by Slavon

comment:20 Changed 2 years ago by jow

  • Milestone changed from Backfire 10.03.2 to Chaos Calmer (trunk)

Milestone Backfire 10.03.2 deleted

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.