On 10/4/24 12:16 AM, Jakub Kicinski wrote:
On Thu, 3 Oct 2024 20:03:17 +0200 Daniel Borkmann wrote:
+static int netkit_check_scrub(int scrub, struct nlattr *tb,
+ struct netlink_ext_ack *extack)
+{
+ switch (scrub) {
+ case NETKIT_SCRUB_DEFAULT:
+ case NETKIT_SCRUB_NONE:
+ return 0;
+ default:
+ NL_SET_ERR_MSG_ATTR(extack, tb,
+ "Provided device scrub setting can only be default/none");
+ return -EINVAL;
+ }
+}
Set the parsing policy to NLA_POLICY_MAX(NLA_U32, NETKIT_SCRUB_NONE)
and delete this open coded checking, please.
Ok, if this is preferred I can also convert the IFLA_NETKIT_MODE over
to use NLA_POLICY_MAX() instead of open-coding.