Skip to content

nexthop: More fine-grained policies for netlink message validation

Petr Machata netdev 2 versions – Applied

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

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 3 repliesApplied 3/3
  2. v13 patches 11 repliesSuperseded

Changes in v2 from the cover letter

- Patches #1, #2 and #3:
- Do not specify size of the policy array. Use ARRAY_SIZE instead of NHA_MAX
- Patch #2:
- Convert manual setting of true to nla_get_flag().

Patches in v2 All 3 applied

#Subject and filesSizeRepliesApplied
1/3nexthop: Use a dedicated policy for nh_valid_get_del_req()net/ipv4/nexthop.c+9 -171 replyApplied
2/3nexthop: Use a dedicated policy for nh_valid_dump_req()net/ipv4/nexthop.c+27 -331 replyApplied
3/3nexthop: Specialize rtm_nh_policynet/ipv4/nexthop.c+9 -141 replyApplied

Reviews trailers per patch

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

PatchDavid Ahern
1/3R-b
2/3R-b
3/3R-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 0/3] nexthop: More fine-grained policies for netlink message validation

There is currently one policy that covers all attributes for next hop object management. Actual validation is then done in code, which makes it unobvious which attributes are acceptable when, and indeed that everything is rejected as necessary.

In this series, split rtm_nh_policy to several policies that cover various aspects of the next hop object configuration, and instead of open-coding the validation, defer to nlmsg_parse(). This should make extending the next hop code simpler as well, which will be relevant in near future for resilient hashing implementation.

This was tested by running tools/testing/selftests/net/fib_nexthops.sh. Additionally iproute2 was tweaked to issue "nexthop list id" as an RTM_GETNEXTHOP dump request, instead of a straight get to test that unexpected attributes are indeed rejected.

In patch #1, convert attribute validation in nh_valid_get_del_req().

In patch #2, convert nh_valid_dump_req().

In patch #3, rtm_nh_policy is cleaned up and renamed to rtm_nh_policy_new, because after the above two patches, that is the only context that it is used in.

v2:
- Patches #1, #2 and #3:
- Do not specify size of the policy array. Use ARRAY_SIZE instead of NHA_MAX
- Patch #2:
- Convert manual setting of true to nla_get_flag().

Petr Machata (3):
nexthop: Use a dedicated policy for nh_valid_get_del_req()
nexthop: Use a dedicated policy for nh_valid_dump_req()
nexthop: Specialize rtm_nh_policy

 net/ipv4/nexthop.c | 105 +++++++++++++++++++--------------------------
 1 file changed, 43 insertions(+), 62 deletions(-)
Signature · 1 line
2.26.2