Subject: Re: [PATCH bpf-next 1/4] netkit: Add option for scrubbing skb meta data

From: Jakub Kicinski <[email-masked]>
Date: Thu, 3 Oct 2024 15:16:01 -0700

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.