[ltp] WG511 PCMCIA with 2 Mac addresses - need udev guru!

Richard Neill linux-thinkpad@linux-thinkpad.org
Thu, 06 Apr 2006 04:07:08 +0100


Dear All,

I'm getting a bit further here:

1)The kernel source confirms your suspicions: namely that the real mac
address doesn't actually exist until the firmware is loaded.
[drivers/net/wireless/prism54/islpci_dev.c ]


2)Looking at the output of udev's logging (syslog), I can see that
the firmware is loaded by /sbin/firmware_helper.


3)However, Mandriva is doing this too late. In Mandriva, the firmware is
loaded at the instant when the network device is brought up. It *should*
be loaded as soon as the network device is detected.


Now, I already have a  (working) udev rule to name the device:

    KERNEL=="eth*", SYSFS{address}=="00:30:b4:00:00:00", NAME="wlan"

so I think it should be a simple matter to run the firmware_helper
program thus:

   KERNEL=="eth*", SYSFS{address}=="00:30:b4:00:00:00", NAME="wlan",
   RUN+="/sbin/firmware_helper"

Unfortunately, I'm now stuck. firmware_helper has no documentation, and
reading the source  [udev-078/extras/firmware/firmware_helper.c]
only tells me that some environment variables must be defined.

I have tried manually running various permutations of the following:

  export ACTION=add ; export DEVPATH=/sys/class/net/wlan ; export
 FIRMWARE=isl3890 ; export PHYSDEVDRIVER=prism54; firmware_helper

but firmware_helper keeps complaining with messages like:

Apr  6 03:51:16 toffee-pecan firmware_helper[14971]: main: error loading
'/lib/hotplug/firmware/isl3890' for device '/sys/class/net/wlan' with
driver 'prism54'


So....Can anyone tell me the magic incantation to make firmware_helper
do its stuff?  What should DEVPATH and PHYSDEVDRIVER be?


Thanks,

Richard






Richard Neill wrote:
> Dear Mauro,
> 
> Thank you very much - that's really helpful.
> 
> Conclusion 1):
> There is (probably) a bug in the prism driver which causes the wrong MAC
> address to be reported if the firmware isn't loaded. [This may be
> deliberate, or it may be a hardware bug.]
> 
> Inference 2)
> I *think* that Gentoo and Mandriva operate slightly differently. Gentoo
> probes the module, then loads the firmware, then checks the MAC address,
> and uses this to configures the interface.
> 
> Mandriva checks the MAC address, uses it to decide which module to
> probe, then loads the firmware, and then configures the interface.
> 
> Therefore, Mandriva is unlucky, and Gentoo is fortunate, in this
> particular circumstance.
> 
> 
> Regarding conclusion 1) I'm not sure what to do.
> 
> Regarding inference (2), can you post the contents of your ifcfg-eth0
> and /etc/iftab files?  I'd like to know whether Gentoo uses the real or
> the bogus mac addresses in these. [Mandriva uses the bogus one both times]
> 
> 
> Lastly, do you have any ideas for a workaround?
> 
> Best wishes,
> 
> Richard
> 
> 
> 
> 
> Mauro Maroni wrote:
> 
>>Richard:
>>
>>Here is what I found:
>>
>>gentoo mauro # /etc/init.d/net.eth0 stop
>> * Unmounting network filesystems ...                                     
>>[ ok ]
>> * Stopping eth0
>> *   Bringing down eth0
>> *     Shutting down eth0 ...                                             
>>[ ok ]
>>
>>After this, it is still showing the real MAC:
>>
>>gentoo mauro # cat /sys/class/net/eth0/address
>>00:09:5b:e6:c5:aa
>>
>>gentoo mauro # rmmod prism54
>>
>>At this point, the card no longer exists in /sys/class/net.
>>And ifconfig only shows the loopback interface
>>
>>gentoo mauro # cardctl eject
>>
>>If I reinsert the card at this point, it is detected, prism54 module is loaded 
>>and then eth0 comes up with the real MAC. 
>>
>>So I did it all again but moving isl3890 firmware to another place.
>>Reinserted the card, it is detected and prism54 loaded.
>>eth0 does not come up (no firmware).And now yes, I get the bogus MAC:
>>
>>gentoo mauro # cat /sys/class/net/eth0/address
>>00:30:b4:00:00:00
>>
>>Then I put isl3890 back in place and tried to bring the card up.
>>It comes up without issues:
>>
>>gentoo mauro # /etc/init.d/net.eth0 start
>> * Starting eth0
>> *   Configuring wireless network for eth0
>> *     eth0 connected to "NETGEAR" at 00:09:5B:DD:FA:6E
>> *   Bringing up eth0
>> *     10.0.0.100                                                                                                                      
>>[ ok ]
>> *   Adding routes
>> *     default gw 10.0.0.2 ...                                                                                                         
>>[ ok ]
>>
>>gentoo mauro # cat /sys/class/net/eth0/address
>>00:09:5b:e6:c5:aa
>>
>>Hope this helps
>>
>>Mauro
>>
>>On Saturday 01 April 2006 20:46, Richard Neill wrote:
>>
>>
>>>Mauro Maroni wrote:
>>>
>>>
>>>>I have a Netgear WG511 but never saw that behaviour...The only issue I
>>>>have is that sometimes the card disconnects from the access point, but I
>>>>only have to run '/etc/init.d/net.eth0 restart' (I am using Gentoo) in
>>>>order to reconnect it. I will try to see if that issue is also related to
>>>>a changing MAC address.
>>>
>>>Dear Mauro,
>>>
>>>Thanks very much for your help. That's interesting that it doesn't
>>>happen on Gentoo. The question is, why?
>>>a) Gentoo's ifup/ifcfg script is smarter than Mandriva's.
>>>b) Your version of the prism driver always reports the true mac, even
>>>without the firmware being uploaded.
>>>c) We have different revisions of the hardware.
>>>
>>>Could you check for me what happens if you do the following:
>>>[I'm assuming your interface is called eth0, although it could be eth1
>>>or wlan]
>>>
>>>0)Stop ifplugd if you have it running.
>>>
>>>1)rmmod prism54; cardctl eject; physically eject the card.
>>>
>>>2)reinsert the card.
>>>
>>>[At this point, the eth0 interface will not be up]
>>>
>>>3)Check which MAC address you have with:
>>> cat sys/class/net/wlan/address
>>>and
>>> ifconfig -a
>>>
>>>4)ifup wlan
>>>
>>>5)Repeat (3).
>>>
>>>6)Ifdown eth0;
>>>
>>>7)ifup eth0
>>>
>>>8)Repeat (3).
>>>
>>>
>>>I would expect that the results are these:
>>>
>>>[3]  00:30:b4:00:00:00   #the "default" bogus mac.
>>>
>>>[5]  your_real_mac_address
>>>
>>>[8]  I don't know, because step 7) fails for me.
>>>
>>>
>>>You might also try repeating steps 1-4 after temporarily moving
>>>/usr/lib/hotplug/firmware/isl3890 somewhere where it cannot be found.
>>>
>>>Lastly, is the MAC you have in  ifcfg-eth0  your real one, or the bogus
>>>one?
>>>
>>>
>>>Thanks very much,
>>>
>>>Richard
>>>
>>>
>>>
>>>>Regards,
>>>>Mauro
>>>>
>>>>On Friday 31 March 2006 21:28, Richard Neill wrote:
>>>>
>>>>
>>>>>Dear All,
>>>>>
>>>>>I wonder whether I could consult the collective wisdom about this. My
>>>>>Netgear WG511 card works perfectly with the prism54 driver, once the
>>>>>binary firmware has been loaded.
>>>>>
>>>>>However, the MAC address (as reported by ifconfig, or udevinfo) changes
>>>>>between 2 different values depending on status:
>>>>>
>>>>>1)Without the firmware installed, or before the network interface has
>>>>>been brought up (for the first time since boot or plugging in the card):
>>>>>	00:30:b4:00:00:00
>>>>>
>>>>>2)Once the firmware has been loaded, and the interface has been  brought
>>>>>up at least once:
>>>>>    00:09:5b:c1:3a:b1
>>>>>
>>>>>The problem is that restarting the network no longer recognises the
>>>>>card, since the MAC address has now changed:
>>>>> "interface 'wlan' not foundDevice wlan has different MAC address
>>>>> than expected, ignoring."
>>>>>
>>>>>
>>>>>
>>>>>All the config tools (iftab, ifcfg-wlan) need to refer to the first
>>>>>(un-initialised) MAC. But once initialised, they don't recognise the
>>>>>card anymore.
>>>>>
>>>>>The simple solution is to cardctl eject, and physically unplug/replug
>>>>>the card each time I restart the network. But that's ugly!  I think I
>>>>>need to bind one interface name to 2 different MAC addresses.
>>>>>
>>>>>Does anyone know the correct solution, or can point me to an appropriate
>>>>>resource?
>>>>>
>>>>>Thanks very much,
>>>>>
>>>>>Richard
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>--
>>>>>rn214@hermes.cam.ac.uk  **  http://www.richardneill.org
>>>>>Richard Neill, Trinity College, Cambridge, CB21TQ, U.K.
> 
> 

-- 
rn214@hermes.cam.ac.uk  **  http://www.richardneill.org
Richard Neill, Trinity College, Cambridge, CB21TQ, U.K.