Subject: Re: Fw: Changing MAC addresses on ethernet interfaces?
To: Andrew Gillham <gillham@ameritech.net>
From: Jason R Thorpe <thorpej@zembu.com>
List: tech-net
Date: 01/16/2001 11:28:00
On Tue, Jan 16, 2001 at 01:55:44PM -0500, Andrew Gillham wrote:

 > > Is anyone planning to add a mechanism to override the UAA on an
 > > ethernet card?

I just whipped up a patch that should allow this in -current, but
it's tedious to use without some other changes... but, here it is:

Index: if_ethersubr.c
===================================================================
RCS file: /cvsroot/syssrc/sys/net/if_ethersubr.c,v
retrieving revision 1.74
diff -c -r1.74 if_ethersubr.c
*** if_ethersubr.c	2000/12/26 23:54:34	1.74
--- if_ethersubr.c	2001/01/16 19:27:02
***************
*** 1148,1153 ****
--- 1148,1171 ----
  	case SIOCSIFADDR:
  		ifp->if_flags |= IFF_UP;
  		switch (ifa->ifa_addr->sa_family) {
+ 		case AF_LINK:
+ 		    {
+ 			struct sockaddr_dl *sdl =
+ 			    (struct sockaddr_dl *) ifa->ifa_addr;
+ 
+ 			if (sdl->sdl_type != IFT_ETHER ||
+ 			    sdl->sdl_alen != ifp->if_addrlen) {
+ 				error = EINVAL;
+ 				break;
+ 			}
+ 
+ 			memcpy(LLADDR(ifp->if_sadl), LLADDR(sdl),
+ 			    ifp->if_addrlen);
+ 
+ 			/* Set new address. */
+ 			error = (*ifp->if_init)(ifp);
+ 			break;
+ 		    }
  #ifdef INET
  		case AF_INET:
  			if ((error = (*ifp->if_init)(ifp)) != 0)

-- 
        -- Jason R. Thorpe <thorpej@zembu.com>