Hi, It should be possible to set the link layer address of an interface whilst also setting the IP address. Here's a revised patch for ifconfig(8) to add this functionality (against HEAD) based on the one in the PR.
There is a problem in that applying this patch modifies syntax such that statements of the form 'ifconfig xl0 ether' to view the ethernet address of an interface will no longer work. Using ifconfig(8) on its own or with the -a switch will dump this information however. Feedback anyone? BMS
--- ifconfig.c.orig Tue Sep 30 03:25:53 2003 +++ ifconfig.c Wed Oct 1 11:45:54 2003 @@ -170,7 +170,7 @@ c_func setip6eui64; #endif c_func setifipdst; -c_func setifflags, setifmetric, setifmtu, setifcap; +c_func setifflags, setiflladdr, setifmetric, setifmtu, setifcap; c_func clone_destroy; @@ -234,6 +234,6 @@ { "-link2", -IFF_LINK2, setifflags }, { "monitor", IFF_MONITOR, setifflags }, { "-monitor", -IFF_MONITOR, setifflags }, #ifdef USE_IF_MEDIA { "media", NEXTARG, setmedia }, { "mode", NEXTARG, setmediamode }, @@ -286,6 +286,9 @@ { "compress", IFF_LINK0, setifflags }, { "noicmp", IFF_LINK1, setifflags }, { "mtu", NEXTARG, setifmtu }, + { "ether", NEXTARG, setiflladdr }, + { "link", NEXTARG, setiflladdr }, + { "lladdr", NEXTARG, setiflladdr }, { 0, 0, setifaddr }, { 0, 0, setifdstaddr }, }; @@ -339,12 +342,6 @@ #endif { "atalk", AF_APPLETALK, at_status, at_getaddr, NULL, SIOCDIFADDR, SIOCAIFADDR, C(addreq), C(addreq) }, - { "link", AF_LINK, link_status, link_getaddr, NULL, - 0, SIOCSIFLLADDR, NULL, C(ridreq) }, - { "ether", AF_LINK, link_status, link_getaddr, NULL, - 0, SIOCSIFLLADDR, NULL, C(ridreq) }, - { "lladdr", AF_LINK, link_status, link_getaddr, NULL, - 0, SIOCSIFLLADDR, NULL, C(ridreq) }, #if 0 /* XXX conflicts with the media command */ #ifdef USE_IF_MEDIA { "media", AF_UNSPEC, media_status, NULL, NULL, }, /* XXX not real!! */ @@ -1036,4 +1033,17 @@ warn("ioctl (set mtu)"); } +void +setiflladdr(val, dummy, s, afp) + const char *val; + int dummy __unused; + int s; + const struct afswtch *afp; +{ + strncpy(ridreq.ifr_name, name, sizeof(ridreq.ifr_name)); + link_getaddr(val, ADDR); + if (ioctl(s, SIOCSIFLLADDR, (caddr_t)&ridreq) < 0) + warn("ioctl(SIOCSIFLLADDR)"); +} + #define IFFBITS \
_______________________________________________ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-net To unsubscribe, send any mail to "[EMAIL PROTECTED]"