Skip to content

macsec: replace custom netlink attribute checks with policy-level checks

Sabrina Dubroca netdev 1 version Applied

Status from this message: This series was applied to netdev/net-next.git (main)

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest13 patches 19 repliesApplied 13/13

Patches in v2 All 13 applied

#Subject and filesSizeRepliesApplied
1/13macsec: replace custom checks on MACSEC_SA_ATTR_AN with NLA_POLICY_MAXdrivers/net/macsec.c+1 -141 replyApplied
2/13macsec: replace custom checks on MACSEC_*_ATTR_ACTIVE with NLA_POLICY_MAXdrivers/net/macsec.c+2 -231 replyApplied
3/13macsec: replace custom checks on MACSEC_SA_ATTR_SALT with NLA_POLICY_EXACT_LENdrivers/net/macsec.c+1 -181 replyApplied
4/13macsec: replace custom checks on MACSEC_SA_ATTR_KEYID with NLA_POLICY_EXACT_LENdrivers/net/macsec.c+1 -81 replyApplied
5/13macsec: use NLA_POLICY_MAX_LEN for MACSEC_SA_ATTR_KEYdrivers/net/macsec.c+1 -21 replyApplied
6/13macsec: use NLA_UINT for MACSEC_SA_ATTR_PNdrivers/net/macsec.c+1 -115 repliesApplied
7/13macsec: remove validate_add_rxscdrivers/net/macsec.c+2 -101 replyApplied
8/13macsec: add NLA_POLICY_MAX for MACSEC_OFFLOAD_ATTR_TYPE and IFLA_MACSEC_OFFLOADdrivers/net/macsec.c+2 -23 repliesApplied
9/13macsec: replace custom checks on IFLA_MACSEC_ICV_LEN with NLA_POLICY_RANGEdrivers/net/macsec.c+1 -41 replyApplied
10/13macsec: use NLA_POLICY_VALIDATE_FN to validate IFLA_MACSEC_CIPHER_SUITEdrivers/net/macsec.c+18 -161 replyApplied
11/13macsec: validate IFLA_MACSEC_VALIDATION with NLA_POLICY_MAXdrivers/net/macsec.c+1 -51 replyApplied
12/13macsec: replace custom checks for IFLA_MACSEC_* flags with NLA_POLICY_MAXdrivers/net/macsec.c+6 -161 replyApplied
13/13macsec: replace custom check on IFLA_MACSEC_ENCODING_SA with NLA_POLICY_MAXdrivers/net/macsec.c+1 -61 replyApplied

Reviews trailers per patch

All 13 patches have a Reviewed-by or Acked-by.

PatchSimon Horman
1/13R-b
2/13R-b
3/13R-b
4/13R-b
5/13R-b
6/13R-b
7/13R-b
8/13R-b
9/13R-b
10/13R-b
11/13R-b
12/13R-b
13/13R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH net-next v2 00/13] macsec: replace custom netlink attribute checks with policy-level checks

We can simplify attribute validation a lot by describing the accepted ranges more precisely in the policies, using NLA_POLICY_MAX etc.

Some of the checks still need to be done later on, because the attribute length and acceptable range can vary based on values that can't be known when the policy is validated (cipher suite determines the key length and valid ICV length, presence of XPN changes the PN length, detection of duplicate SCIs or ANs, etc).

As a bonus, we get a few extack messages from the policy validation. I'll add extack to the rest of the checks (mostly in the genl commands) in an future series.

v2: remove no-longer-unused csid variable (thanks Jakub)
rebase on top of net-next
use NLA_UINT for PN
v1: https://lore.kernel.org/netdev/[email protected]/

Sabrina Dubroca (13):
macsec: replace custom checks on MACSEC_SA_ATTR_AN with NLA_POLICY_MAX
macsec: replace custom checks on MACSEC_*_ATTR_ACTIVE with
NLA_POLICY_MAX
macsec: replace custom checks on MACSEC_SA_ATTR_SALT with
NLA_POLICY_EXACT_LEN
macsec: replace custom checks on MACSEC_SA_ATTR_KEYID with
NLA_POLICY_EXACT_LEN
macsec: use NLA_POLICY_MAX_LEN for MACSEC_SA_ATTR_KEY
macsec: use NLA_UINT for MACSEC_SA_ATTR_PN
macsec: remove validate_add_rxsc
macsec: add NLA_POLICY_MAX for MACSEC_OFFLOAD_ATTR_TYPE and
IFLA_MACSEC_OFFLOAD
macsec: replace custom checks on IFLA_MACSEC_ICV_LEN with
NLA_POLICY_RANGE
macsec: use NLA_POLICY_VALIDATE_FN to validate
IFLA_MACSEC_CIPHER_SUITE
macsec: validate IFLA_MACSEC_VALIDATION with NLA_POLICY_MAX
macsec: replace custom checks for IFLA_MACSEC_* flags with
NLA_POLICY_MAX
macsec: replace custom check on IFLA_MACSEC_ENCODING_SA with
NLA_POLICY_MAX

 drivers/net/macsec.c | 173 ++++++++++---------------------------------
 1 file changed, 38 insertions(+), 135 deletions(-)
Signature · 1 line
2.50.0