Subject: Re: [PATCHv2 net] bonding: use permanent address for MAC swapping if device address is same

From: Jay Vosburgh <[email-masked]>
Date: Wed, 23 Apr 2025 09:27:40 -0700

Hangbin Liu <[email-masked]> wrote:

>On Sun, Apr 20, 2025 at 10:10:24PM -0700, Jay Vosburgh wrote:
>> >I'm not familiar with infiniband devices. Can we use eth_random_addr()
>> >to set random addr for infiniband devices? And what about other device
>> >type? Just return error directly?
>> 
>> 	Infiniband devices have fixed MAC addresses that cannot be
>> changed.  Bonding permits IB devices only in active-backup mode, and
>> will set fail_over_mac to active (fail_over_mac=follow is not permitted
>> for IB).
>> 
>> 	I don't understand your questions about other device types or
>> errors, could you elaborate?
>> 
>
>I mean what if other device type enslaves, other than ethernet or infiniband.
>I'm not sure if we can set random mac address for these devices. Should we
>ignore all none ethernet device or devices that don't support
>ndo_set_mac_address?

	Devices without ndo_set_mac_address are already handled; they
are limited to active-backup mode and fail_over_mac is set to active
(just like Infiniband).

	I'm not aware of any network device types other than Ethernet
(which to bonding is anything with dev->type == ARPHRD_ETHER) or
Infiniband in use with bonding.  If there are any, and the driver
supports ndo_set_mac_address, and it fails for a random MAC if they try
to use fail_over_mac=follow, then I'll look forward to the bug report.

	If you're thinking of devices that are type ARPHRD_ETHER but
aren't actual ethernet (virtual devices, veth, et al, perhaps?), then
I'm not sure why those would require fail_over_mac=follow, as its reason
for existence is for multiport devices that can't handle multiple ports
programmed to the same MAC, which shouldn't matter for virtual devices
or single port physical devices.

	-J

---
	-Jay Vosburgh, [email-masked]