Index: sys/net/if_epair.c =================================================================== --- sys/net/if_epair.c +++ sys/net/if_epair.c @@ -53,10 +53,13 @@ __FBSDID("$FreeBSD$"); #include +#include #include +#include #include #include #include +#include #include #include #include @@ -713,6 +716,7 @@ struct ifnet *ifp; char *dp; int error, unit, wildcard; + unsigned long hostid; uint8_t eaddr[ETHER_ADDR_LEN]; /* 00:00:00:00:00:00 */ /* @@ -722,12 +726,18 @@ * it cannot fail anymore. So just do attach it here. */ if (params) { + getcredhostid(curthread->td_ucred, &hostid); + if (hostid == 0) + arc4rand(&hostid, (sizeof(unsigned long)), 0); + scb = (struct epair_softc *)params; ifp = scb->ifp; /* Assign a hopefully unique, locally administered etheraddr. */ eaddr[0] = 0x02; - eaddr[3] = (ifp->if_index >> 8) & 0xff; - eaddr[4] = ifp->if_index & 0xff; + eaddr[1] = ((uint8_t *)(scb->oifp->if_hw_addr))[1]; + eaddr[2] = ((uint8_t *)(scb->oifp->if_hw_addr))[2]; + eaddr[3] = (scb->oifp->if_index >> 8) & 0xff; + eaddr[4] = scb->oifp->if_index & 0xff; eaddr[5] = 0x0b; ether_ifattach(ifp, eaddr); /* Correctly set the name for the cloner list. */ @@ -836,7 +846,13 @@ if_setsendqlen(ifp, ifqmaxlen); if_setsendqready(ifp); /* Assign a hopefully unique, locally administered etheraddr. */ + getcredhostid(curthread->td_ucred, &hostid); + if (hostid == 0) + arc4rand(&hostid, (sizeof(unsigned long)), 0); + eaddr[0] = 0x02; + eaddr[1] = (hostid >> 8) & 0xff; + eaddr[2] = hostid & 0xff; eaddr[3] = (ifp->if_index >> 8) & 0xff; eaddr[4] = ifp->if_index & 0xff; eaddr[5] = 0x0a;