diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -1076,11 +1076,8 @@ if (!em_is_valid_ether_addr(hw->mac.addr)) { if (adapter->vf_ifp) { - u8 addr[ETHER_ADDR_LEN]; - arc4rand(&addr, sizeof(addr), 0); - addr[0] &= 0xFE; - addr[0] |= 0x02; - bcopy(addr, hw->mac.addr, sizeof(addr)); + ether_gen_addr(iflib_get_ifp(ctx), + (struct ether_addr *)hw->mac.addr); } else { device_printf(dev, "Invalid MAC address\n"); error = EIO; diff --git a/sys/dev/ixgbe/if_ixv.c b/sys/dev/ixgbe/if_ixv.c --- a/sys/dev/ixgbe/if_ixv.c +++ b/sys/dev/ixgbe/if_ixv.c @@ -465,12 +465,10 @@ /* If no mac address was assigned, make a random one */ if (!ixv_check_ether_addr(hw->mac.addr)) { - u8 addr[ETHER_ADDR_LEN]; - arc4rand(&addr, sizeof(addr), 0); - addr[0] &= 0xFE; - addr[0] |= 0x02; - bcopy(addr, hw->mac.addr, sizeof(addr)); - bcopy(addr, hw->mac.perm_addr, sizeof(addr)); + ether_gen_addr(iflib_get_ifp(ctx), + (struct ether_addr *)hw->mac.addr); + bcopy(hw->mac.addr, hw->mac.perm_addr, + sizeof(hw->mac.perm_addr)); } /* Most of the iflib initialization... */ diff --git a/sys/dev/ixl/if_iavf.c b/sys/dev/ixl/if_iavf.c --- a/sys/dev/ixl/if_iavf.c +++ b/sys/dev/ixl/if_iavf.c @@ -433,13 +433,9 @@ iavf_dbg_init(sc, "Resource Acquisition complete\n"); /* If no mac address was assigned just make a random one */ - if (!iavf_check_ether_addr(hw->mac.addr)) { - u8 addr[ETHER_ADDR_LEN]; - arc4rand(&addr, sizeof(addr), 0); - addr[0] &= 0xFE; - addr[0] |= 0x02; - bcopy(addr, hw->mac.addr, sizeof(addr)); - } + if (!iavf_check_ether_addr(hw->mac.addr)) + ether_gen_addr(iflib_get_ifp(ctx), + (struct ether_addr *)hw->mac.addr); bcopy(hw->mac.addr, hw->mac.perm_addr, ETHER_ADDR_LEN); iflib_set_mac(ctx, hw->mac.addr);