[ovs-discuss] why the datapath-id choose the minimum non-local MAC address among all of the ports in bridge

Ben Pfaff blp at ovn.org
Fri Jan 29 00:01:06 UTC 2021


On Thu, Jan 28, 2021 at 09:57:49AM +0800, taoyunupt wrote:
> At 2021-01-28 09:29:45, "Ben Pfaff" <blp at ovn.org> wrote:
> >On Wed, Jan 27, 2021 at 06:13:12PM +0800, taoyunupt wrote:
> >> Hi,
> >>     If no configure of "datapath-id" in other_config of br, then it will  choose the minimum non-local MAC address among all of the ports in bridge. The relevant code is in the find_local_hw_addr function(https://github.com/openvswitch/ovs/blob/master/vswitchd/bridge.c#L2322).  
> >>     
> >>     In this case, If a new  port with miner mac, it will change the dpid ,and the mac of br-int. It will cause frequently reset with SDN controller by ofproto_set_datapath_id function.
> >>     Is this reasonable?
> >
> >This solution is the best one we know.  It yields a predictable port MAC
> >address and datapath ID given a particular collection of ports.  It's
> >been that way for perhaps 10 years or so.
> >
> 
> >I don't know what a miner mac is.
> 
> 
> The "miner" should be "smaller", sorry for that. 
> 
> 
> If a new  port with smaller MAC, it will change the dpid ,and the MAC of  bridge, so  a connection  reset will happen. I don't understand why the mac address of the port affects the mac address of the bridge . I think hold a MAC address(such as default ea?) steady is neccesary, what do you think?

The reason that this happens is exactly to keep the MAC address of the
bridge steady.

Here's the use case it was designed to address.  It started with
XenServer, but other hypervisors work similarly.  Each physical NIC that
might have VMs on it gets put into a bridge, and then the IP address for
that NIC (if any) gets migrated from the pnic to the bridge device.  You
want the bridge device to have the same MAC address as the physical NIC,
so taking the minimum MAC address does that.  Adding virtual NICs
doesn't change it because OVS ignores random MACs.

If you want a stable MAC, but you have some different situation, set
your own MAC.


More information about the discuss mailing list