diff mbox series

[net] bonding: fix ad_actor_system option setting to default

Message ID 20211217182846.6910-1-ffmancera@riseup.net (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [net] bonding: fix ad_actor_system option setting to default | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net
netdev/fixes_present fail Series targets non-next tree, but doesn't contain any Fixes tags
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1 this patch: 1
netdev/cc_maintainers fail 5 maintainers not CCed: j.vosburgh@gmail.com vfalico@gmail.com kuba@kernel.org davem@davemloft.net andy@greyhouse.net
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 1 this patch: 1
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Fernando F. Mancera Dec. 17, 2021, 6:28 p.m. UTC
When 802.3ad bond mode is configured the ad_actor_system option is set
to "00:00:00:00:00:00". But when trying to set the default value
manually it was failing with EINVAL.

A zero ethernet address is valid, only multicast addresses are not valid
values.

Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
---
 drivers/net/bonding/bond_options.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jay Vosburgh Dec. 17, 2021, 10:22 p.m. UTC | #1
Fernando Fernandez Mancera <ffmancera@riseup.net> wrote:

>When 802.3ad bond mode is configured the ad_actor_system option is set
>to "00:00:00:00:00:00". But when trying to set the default value
>manually it was failing with EINVAL.
>
>A zero ethernet address is valid, only multicast addresses are not valid
>values.

	Your intent here by setting ad_actor_system to all zeroes is to
induce bonding to actually set ad_actor_system to the MAC of the bond
itself?

	If so, please also update Documentation/networking/bonding.rst,
as the current text says

        In an AD system, this specifies the mac-address for the actor in
        protocol packet exchanges (LACPDUs). The value cannot be NULL or
        multicast. It is preferred to have the local-admin bit set for this
        mac but driver does not enforce it. If the value is not given then
        system defaults to using the masters' mac address as actors' system
        address.

	I'd suggest something like "The value cannot be a multicast
address.  If the all-zeroes MAC is specified, bonding will internally
use the MAC of the bond itself."

	-J

>Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
>---
> drivers/net/bonding/bond_options.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c
>index a8fde3bc458f..b93337b5a721 100644
>--- a/drivers/net/bonding/bond_options.c
>+++ b/drivers/net/bonding/bond_options.c
>@@ -1526,7 +1526,7 @@ static int bond_option_ad_actor_system_set(struct bonding *bond,
> 		mac = (u8 *)&newval->value;
> 	}
> 
>-	if (!is_valid_ether_addr(mac))
>+	if (is_multicast_ether_addr(mac))
> 		goto err;
> 
> 	netdev_dbg(bond->dev, "Setting ad_actor_system to %pM\n", mac);
>-- 
>2.30.2
>

---
	-Jay Vosburgh, jay.vosburgh@canonical.com
Fernando F. Mancera Dec. 18, 2021, 1:28 a.m. UTC | #2
On 12/17/21 23:22, Jay Vosburgh wrote:
> Fernando Fernandez Mancera <ffmancera@riseup.net> wrote:
> 
>> When 802.3ad bond mode is configured the ad_actor_system option is set
>> to "00:00:00:00:00:00". But when trying to set the default value
>> manually it was failing with EINVAL.
>>
>> A zero ethernet address is valid, only multicast addresses are not valid
>> values.
> 
> 	Your intent here by setting ad_actor_system to all zeroes is to
> induce bonding to actually set ad_actor_system to the MAC of the bond
> itself?

Yes, as the user should be able to set it back to the MAC of the bond 
itself. Basically, restore it to the default value.

> 
> 	If so, please also update Documentation/networking/bonding.rst,
> as the current text says
> 
>          In an AD system, this specifies the mac-address for the actor in
>          protocol packet exchanges (LACPDUs). The value cannot be NULL or
>          multicast. It is preferred to have the local-admin bit set for this
>          mac but driver does not enforce it. If the value is not given then
>          system defaults to using the masters' mac address as actors' system
>          address.
> 
> 	I'd suggest something like "The value cannot be a multicast
> address.  If the all-zeroes MAC is specified, bonding will internally
> use the MAC of the bond itself."

Sure, that would be good. I will do it. Thank you!

> 
> 	-J
> 
>> Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
>> ---
>> drivers/net/bonding/bond_options.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c
>> index a8fde3bc458f..b93337b5a721 100644
>> --- a/drivers/net/bonding/bond_options.c
>> +++ b/drivers/net/bonding/bond_options.c
>> @@ -1526,7 +1526,7 @@ static int bond_option_ad_actor_system_set(struct bonding *bond,
>> 		mac = (u8 *)&newval->value;
>> 	}
>>
>> -	if (!is_valid_ether_addr(mac))
>> +	if (is_multicast_ether_addr(mac))
>> 		goto err;
>>
>> 	netdev_dbg(bond->dev, "Setting ad_actor_system to %pM\n", mac);
>> -- 
>> 2.30.2
>>
> 
> ---
> 	-Jay Vosburgh, jay.vosburgh@canonical.com
>
diff mbox series

Patch

diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c
index a8fde3bc458f..b93337b5a721 100644
--- a/drivers/net/bonding/bond_options.c
+++ b/drivers/net/bonding/bond_options.c
@@ -1526,7 +1526,7 @@  static int bond_option_ad_actor_system_set(struct bonding *bond,
 		mac = (u8 *)&newval->value;
 	}
 
-	if (!is_valid_ether_addr(mac))
+	if (is_multicast_ether_addr(mac))
 		goto err;
 
 	netdev_dbg(bond->dev, "Setting ad_actor_system to %pM\n", mac);