[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aLBm5t5nZtILh8YN@krikkit>
Date: Thu, 28 Aug 2025 16:25:42 +0200
From: Sabrina Dubroca <sd@...asysnail.net>
To: Jakub Kicinski <kuba@...nel.org>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH net-next v2 06/13] macsec: use NLA_UINT for
MACSEC_SA_ATTR_PN
2025-08-27, 18:55:40 -0700, Jakub Kicinski wrote:
> On Wed, 27 Aug 2025 18:54:15 -0700 Jakub Kicinski wrote:
> > On Tue, 26 Aug 2025 15:16:24 +0200 Sabrina Dubroca wrote:
> > > MACSEC_SA_ATTR_PN is either a u32 or a u64, we can now use NLA_UINT
> > > for this instead of a custom binary type. We can then use a min check
> > > within the policy.
> > >
> > > We need to keep the length checks done in macsec_{add,upd}_{rx,tx}sa
> > > based on whether the device is set up for XPN (with 64b PNs instead of
> > > 32b).
> > >
> > > On the dump side, keep the existing custom code as userspace may
> > > expect a u64 when using XPN, and nla_put_uint may only output a u32
> > > attribute if the value fits.
> >
> > I think this is a slight functional change on big endian.
> > I suppose we don't care..
>
> we don't care == the change is not intentional, so in the unlikely case
> BE users exist aligning with LE is better in the first place.
I don't think this is changing the behavior. The previous check was
copying whatever bytes were in the attribute into a u64 (incorrectly
on BE) and setting the rest to 0, and then checking that this u64 is
!= 0. The new check is reading the value correctly and also checking
that it's != 0.
Converting the nla_get_u64(MACSEC_SA_ATTR_PN) in
macsec_{add,upd}_{rx,tx}sa to get_uint would change the behavior on
BE, but the current code hasn't worked correctly since XPN was
introduced? We use 1<<32 instead of 1 as our PN, which doesn't make
sense when using 32bit PNs. So I think we'll want to change all the
nla_get_u64(MACSEC_SA_ATTR_PN) into
nla_get_uint(MACSEC_SA_ATTR_PN). WDYT?
--
Sabrina
Powered by blists - more mailing lists