Certain epair[n]b devices can get collisions with other epair[n]b devices due to the MAC address not being random enough. I have a box with a number of vnet jails. Devices epair9b and epair13b shared the same IPv6 link-local address due to how the link-local address was automatically generated from the MAC address. Patch for review included. How-To-Repeat: ifconfig bridge0 create ifconfig epair9a create ifconfig bridge0 addm epair9a ifconfig epair13a create ifconfig bridge0 addm epair13a ifconfg epair9a up ifconfig epair13a up ifconfig epair9b up ifconfig epair13b up
This just bit me, when I found a jail mysteriously disappearing off net when another one appeared that happened to collide :(
Before randomizing organization part of the MAC address I would like to know what addresses were actually assigned. Are epairs created in the host environment only or created/moved across multiple jails? A command line example in the original report looks that it happens even if all of epairs and a bridge are created in the host environment or the same vnet jail. Is it a correct understanding? If it is true, I do not understand which addresses actually conflict with each other and why it happened. It is possible that two identical MAC addresses are assigned to two epairNb in different vnet jails because MAC address uses ifindex and it is jail-local. I am working on a patch to fix it.
Created attachment 193114 [details] Another possible fix This patch fix the issue, reusing the epair a if_index also for epair b. Moreover, I've added hostid bits in the MAC to avoid that multiple servers that shares the same configuration (failover), will have the same epair MAC address (see https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=176671)
A commit references this bug: Author: pizzamig Date: Wed May 23 13:10:58 UTC 2018 New revision: 334094 URL: https://svnweb.freebsd.org/changeset/base/334094 Log: Improve MAC address uniqueness on if_epair(4). As reported in PR184149, it can happen that epair devices can have the same MAC address. This solution is based on a 32-bit hash, obtained combining the if_index of the a interface and the hostid. If the hostid is zero, a random number is used. PR: 184149 Reviewed by: wollman, eugen Approved by: cognet Differential Revision: https://reviews.freebsd.org/D15329 Changes: head/sys/net/if_epair.c
*** Bug 176671 has been marked as a duplicate of this bug. ***