1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-10-19 02:29:40 +00:00

Allow a changed MAC address to show up in ifconfig by changing it

in the ifaddr list as well. Also change an error return in the base system.
This commit is contained in:
Julian Elischer 2001-02-26 09:31:54 +00:00
parent e9ac6c2070
commit e08d3e3c33
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=73083
2 changed files with 14 additions and 1 deletions

View File

@ -3436,7 +3436,7 @@ ng_address_hook(node_p here, item_p item, hook_p hook, ng_ID_t retaddr)
|| NG_NODE_NOT_VALID(NG_PEER_NODE(hook))) {
NG_FREE_ITEM(item);
TRAP_ERROR();
return (EINVAL);
return (ENETDOWN);
}
/*

View File

@ -41,6 +41,7 @@
#include <sys/syslog.h>
#include <net/if.h>
#include <net/if_dl.h>
#include <net/if_types.h>
#include <net/netisr.h>
@ -498,6 +499,8 @@ ng_eiface_rcvmsg(node_p node, item_p item, hook_p lasthook)
case NGM_EIFACE_SET:
{
struct ng_eiface_par *eaddr;
struct ifaddr *ifa;
struct sockaddr_dl *sdl;
if (msg->header.arglen != sizeof(struct ng_eiface_par)){
error = EINVAL;
@ -512,6 +515,16 @@ ng_eiface_rcvmsg(node_p node, item_p item, hook_p lasthook)
priv->arpcom.ac_enaddr[4] = eaddr->oct4;
priv->arpcom.ac_enaddr[5] = eaddr->oct5;
/* And put it in the ifaddr list */
#define IFP2AC(IFP) ((struct arpcom *)IFP)
TAILQ_FOREACH(ifa, &(ifp->if_addrhead), ifa_link) {
sdl = (struct sockaddr_dl *)ifa->ifa_addr;
if (sdl->sdl_type == IFT_ETHER) {
bcopy((IFP2AC(ifp))->ac_enaddr,
LLADDR(sdl), ifp->if_addrlen);
break;
}
}
break;
}