lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZD/9YejX9YQsRwkH@corigine.com>
Date:   Wed, 19 Apr 2023 16:40:33 +0200
From:   Simon Horman <simon.horman@...igine.com>
To:     Zahari Doychev <zahari.doychev@...ux.com>
Cc:     netdev@...r.kernel.org, jhs@...atatu.com, xiyou.wangcong@...il.com,
        jiri@...nulli.us, davem@...emloft.net, edumazet@...gle.com,
        kuba@...nel.org, pabeni@...hat.com, hmehrtens@...linear.com,
        aleksander.lobakin@...el.com,
        Zahari Doychev <zdoychev@...linear.com>
Subject: Re: [PATCH net-next v3 2/3] net: flower: add support for matching
 cfm fields

On Mon, Apr 17, 2023 at 11:32:32PM +0200, Zahari Doychev wrote:
> From: Zahari Doychev <zdoychev@...linear.com>
> 
> Add support to the tc flower classifier to match based on fields in CFM
> information elements like level and opcode.
> 
> tc filter add dev ens6 ingress protocol 802.1q \
> 	flower vlan_id 698 vlan_ethtype 0x8902 cfm mdl 5 op 46 \
> 	action drop
> 
> Signed-off-by: Zahari Doychev <zdoychev@...linear.com>

...

> +static int fl_dump_key_cfm(struct sk_buff *skb,
> +			   struct flow_dissector_key_cfm *key,
> +			   struct flow_dissector_key_cfm *mask)
> +{
> +	struct nlattr *opts;
> +	int err;
> +	u8 mdl;
> +
> +	if (!memchr_inv(mask, 0, sizeof(mask)))

Perhaps this should be sizeof(*mask)

With that fixed feel free to add,

Reviewed-by: Simon Horman <simon.horman@...igine.com>


> +		return 0;
> +
> +	opts = nla_nest_start(skb, TCA_FLOWER_KEY_CFM);
> +	if (!opts)
> +		return -EMSGSIZE;
> +
> +	if (FIELD_GET(FLOW_DIS_CFM_MDL_MASK, mask->mdl_ver)) {
> +		mdl = FIELD_GET(FLOW_DIS_CFM_MDL_MASK, key->mdl_ver);
> +		err = nla_put_u8(skb, TCA_FLOWER_KEY_CFM_MD_LEVEL, mdl);
> +		if (err)
> +			goto err_cfm_opts;
> +	}
> +
> +	if (mask->opcode) {
> +		err = nla_put_u8(skb, TCA_FLOWER_KEY_CFM_OPCODE, key->opcode);
> +		if (err)
> +			goto err_cfm_opts;
> +	}
> +
> +	nla_nest_end(skb, opts);
> +
> +	return 0;
> +
> +err_cfm_opts:
> +	nla_nest_cancel(skb, opts);
> +	return err;
> +}

...

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ