Subject: Re: changing wi(4) MAC address
To: David Young <dyoung@pobox.com>
From: Lord Isildur <mrfusion@vaxpower.org>
List: tech-net
Date: 08/10/2005 11:04:17
On Tue, 9 Aug 2005, David Young wrote:
> Isildur,
> 
> Thanks.  What happens if you change the MAC while wi is in the UP state?
> What hardware have you tested this on?

I've only tested it on a lucent silver so far, it's the only wi interface 
i have. 
If i change the mac address while the interface is up, it changes
immedieately, new packets coming out of it just have the new mac address. 
arp of course gets a little broken by this, in that it would have to 
be reset externally. otherwise the card just keeps on going and never
knows the difference. ifconfig and other such userland things see the
new address, of course. 

> 
> Setting the link-layer address really deserves to be a
> hardware-independent feature.  There have been a few discussions on
> tech-net about how best to set link-layer addresses in a h/w-independent
> way---especially which ioctl is most appropriate (SIOCSALIFADDR, IIRC).
> Would you be willing to produce a patch based on the discussion?

so, there has been murmuring of a grand scheme to slowly put lladr/hwaddr
type support in ifconfig and have a generic mechanism the way linux 
does for changing or setting the mac addr of a device.. 

if there is already a convention for properly exposing this so that
it can be changed by a more generic mechanism, i'll happily adapt this
to fit in with it. 
should I produce a patch from this diff as it is now, in the meantime? 
i probably will add a check to see that the wi_write_rid doesn't fail 
and release a patch maybe this afternoon. 
aside from having the filename info in along with the diff output, is
there anything else wanted for it to be a proper patch? 

isildur

> 
> Dave
> 
> > 
> > 15:29:35 vinyalonde $ diff wi.c wi.c.new
> > 2307a2308,2312
> > >         case WI_RID_MAC_NODE:
> > >               memcpy(ic->ic_myaddr, wreq.wi_val, ETHER_ADDR_LEN);
> > >               IEEE80211_ADDR_COPY(LLADDR(ifp->if_sadl),ic->ic_myaddr);
> > >               wi_write_rid(sc, WI_RID_MAC_NODE, ic->ic_myaddr,
> > IEEE80211_ADDR_LEN);
> > >               break;
> > 
> > a full copy of my updated wi.c is here: 
> > 
> > http://www.vaxpower.org/~isildur/wi.c.new
> > http://www.vaxpower.org/~isildur/wi.c.new.MD5
> > 
> > 
> > happy hacking,
> > isildur
> 
> -- 
> David Young             OJC Technologies
> dyoung@ojctech.com      Urbana, IL * (217) 278-3933
>