Re: [Fwd: Changing MAC address with 'ip' command.]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Donald Becker wrote:
> 
> On Tue, 2 Jan 2001, Ben Greear wrote:
> 
> > Some additional notes:  I had the same bad results trying to set
> > the mac on a tulip based NIC with kernel 2.2.17.  Using the tulip-diag
> > tool, I was able to see that the original MAC was still reported by
> > the NIC, but ifconfig showed the one I had tried to set.
> >
> > Hopefully I'm missing some simple detail/command??
> 
> The tulip-diag and rtl8139-diag programs have _almost_ all of the code to
> change the station address for most of the supported chips(1).
> 
> But people are almost always wrong about their reasons for wanting the
> station address _permanently_ changed, so I frequently leave the actual code
> disabled in the diagnostic programs.

I'm not arguing with that, I just want to temporarily change it.  ifconfig
and ip both supposedly give you that option, it just doesn't work unless
you put the NIC into PROMISC mode, because the card itself (must?) still
think it is the old MAC.  I'd rather just have a way to tell the NIC
to change it's MAC that it keeps in RAM/registers, and leave it's EEPROM
alone so that everything goes back to normal on power-cycle.

Does some version of the code below have that ability?

Many thanks,
Ben


> 
> The complex part of the code is there, and has been tested.  For instance,
> see the comment in rtl8139-diag.c:
> ____
> /* Caution!  This routine works!
>    It will permanently change the EEPROM contents.
>    "You could put an eye out with that thing." */
> static int do_update(long ioaddr, unsigned short *ee_values,
> 
> The missing code is just
> --------
>     if (set_hwaddr)
>         for (i = 0; i < 3; i++)
>             do_update(ioaddr, eeprom_contents, 7 + i, "Station address",
>                 (new_hwaddr[i*2]<<8) + new_hwaddr[i*2+1]);
> 
> Note: The 21041 and PNIC-1 (82c168 and '169) use unique EEPROM access
>    methods.  I don't think that it's possible to write the 21040 EEPROM.
> 
> Donald Becker                           becker@scyld.com
> Scyld Computing Corporation             http://www.scyld.com
> 410 Severn Ave. Suite 210               Second Generation Beowulf Clusters
> Annapolis MD 21403                      410-990-9993

-- 
Ben Greear (greearb@candelatech.com)  http://www.candelatech.com
Author of ScryMUD:  scry.wanfear.com 4444        (Released under GPL)
http://scry.wanfear.com               http://scry.wanfear.com/~greear
-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux