The generated fixed MAC address stored the interface index in a single byte, which wraps after 256 devices and produces duplicate MACs under repeated hot-plug. Spread the index across the last two bytes of the address, extending the unique range to 65536.
Signed-off-by: Stephen Hemminger <[email protected]> --- drivers/net/tap/rte_eth_tap.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index e06e1ca079..8b6d5db37e 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -2274,13 +2274,15 @@ set_mac_type(const char *key __rte_unused, return 0; if (!strncasecmp(ETH_TAP_MAC_FIXED, value, strlen(ETH_TAP_MAC_FIXED))) { - static int iface_idx; - - /* fixed mac = 02:64:74:61:70:<iface_idx> */ - memcpy((char *)user_mac->addr_bytes, "\002dtap", - RTE_ETHER_ADDR_LEN); - user_mac->addr_bytes[RTE_ETHER_ADDR_LEN - 1] = - iface_idx++ + '0'; + static uint16_t iface_idx; + + /* fixed mac that is locally assigned based off of iface_idx. */ + user_mac->addr_bytes[0] = RTE_ETHER_LOCAL_ADMIN_ADDR; /* 0x2 */ + user_mac->addr_bytes[1] = 'd'; + user_mac->addr_bytes[2] = 't'; + user_mac->addr_bytes[3] = 'a'; + user_mac->addr_bytes[4] = 'p' + (iface_idx >> 8); + user_mac->addr_bytes[5] = '0' + (uint8_t)iface_idx++; goto success; } -- 2.51.0

