[PATCH main 1/1] macsec: Fix set offload capability for MACsec

Sabrina Dubroca sd at queasysnail.net
Tue Feb 14 02:52:54 PST 2023


2023-02-14, 11:30:55 +0200, Emeel Hakim wrote:
> Currently, rtnl_link_macsec_set_offload rejects any value
> greater than 1 limiting the MACSEC_ATTR_OFFLOAD attribute
> to the values 0 and 1 where 2 is also a legal value.
> Fix by allowing all legal values for MACSEC_ATTR_OFFLOAD.
> 
> Fixes: b6cc13d76b29 ("Supporting Hardware offload capability for MACsec")
> Signed-off-by: Emeel Hakim <ehakim at nvidia.com>
> ---
>  lib/route/link/macsec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/route/link/macsec.c b/lib/route/link/macsec.c
> index 16b65b0..62b711f 100644
> --- a/lib/route/link/macsec.c
> +++ b/lib/route/link/macsec.c
> @@ -652,7 +652,7 @@ int rtnl_link_macsec_set_offload(struct rtnl_link *link, uint8_t offload)
>  
>  	IS_MACSEC_LINK_ASSERT(link);
>  
> -	if (offload > 1)
> +	if (offload > 2)

Wouldn't it make more sense to sync the UAPI headers from the kernel
(at least the macsec_offload section of if_link.h, maybe if_macsec.h),
and then use MACSEC_OFFLOAD_MAX here?

>  		return -NLE_INVAL;
>  
>  	info->offload = offload;
> -- 
> 2.21.3
> 

-- 
Sabrina




More information about the libnl mailing list