aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/dev/e1000/if_em.c7
-rw-r--r--sys/dev/ixgbe/if_ixv.c10
-rw-r--r--sys/dev/ixl/if_iavf.c10
3 files changed, 9 insertions, 18 deletions
diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c
index 2a6afd244445..315437145e1c 100644
--- a/sys/dev/e1000/if_em.c
+++ b/sys/dev/e1000/if_em.c
@@ -1078,11 +1078,8 @@ em_if_attach_pre(if_ctx_t ctx)
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
index 8a242b9b8cba..ca69275928a5 100644
--- a/sys/dev/ixgbe/if_ixv.c
+++ b/sys/dev/ixgbe/if_ixv.c
@@ -468,12 +468,10 @@ ixv_if_attach_pre(if_ctx_t ctx)
/* 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
index 066c565ec53e..72853a35138a 100644
--- a/sys/dev/ixl/if_iavf.c
+++ b/sys/dev/ixl/if_iavf.c
@@ -435,13 +435,9 @@ iavf_if_attach_pre(if_ctx_t ctx)
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);