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: <ZMtztGiOWV6bqCLg@Laptop-X1>
Date: Thu, 3 Aug 2023 17:30:28 +0800
From: Hangbin Liu <liuhangbin@...il.com>
To: Andrea Mayer <andrea.mayer@...roma2.it>
Cc: "David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	David Ahern <dsahern@...nel.org>, Shuah Khan <shuah@...nel.org>,
	linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
	linux-kselftest@...r.kernel.org,
	Stefano Salsano <stefano.salsano@...roma2.it>,
	Paolo Lungaroni <paolo.lungaroni@...roma2.it>,
	Ahmed Abdelsalam <ahabdels.dev@...il.com>
Subject: Re: [net-next 1/2] seg6: add NEXT-C-SID support for SRv6 End.X
 behavior

On Mon, Jul 31, 2023 at 07:51:16PM +0200, Andrea Mayer wrote:
> +/* Processing of SRv6 End, End.X, and End.T behaviors can be extended through
> + * the flavors framework. These behaviors must report the subset of (flavor)
> + * operations they currently implement. In this way, if a user specifies a
> + * flavor combination that is not supported by a given End* behavior, the
> + * kernel refuses to instantiate the tunnel reporting the error.
> + */
> +static int seg6_flv_supp_ops_by_action(int action, __u32 *fops)
> +{
> +	switch (action) {
> +	case SEG6_LOCAL_ACTION_END:
> +		*fops = SEG6_LOCAL_END_FLV_SUPP_OPS;
> +		break;
> +	case SEG6_LOCAL_ACTION_END_X:
> +		*fops = SEG6_LOCAL_END_X_FLV_SUPP_OPS;
> +		break;
> +	default:
> +		return -EOPNOTSUPP;
> +	}
> +
> +	return 0;
>  }
>  

...

> @@ -2070,7 +2131,8 @@ static int parse_nla_flavors(struct nlattr **attrs, struct seg6_local_lwt *slwt,
>  {
>  	struct seg6_flavors_info *finfo = &slwt->flv_info;
>  	struct nlattr *tb[SEG6_LOCAL_FLV_MAX + 1];
> -	unsigned long fops;
> +	int action = slwt->action;
> +	__u32 fops, supp_fops = 0;
>  	int rc;
>  
>  	rc = nla_parse_nested_deprecated(tb, SEG6_LOCAL_FLV_MAX,
> @@ -2086,7 +2148,8 @@ static int parse_nla_flavors(struct nlattr **attrs, struct seg6_local_lwt *slwt,
>  		return -EINVAL;
>  
>  	fops = nla_get_u32(tb[SEG6_LOCAL_FLV_OPERATION]);
> -	if (fops & ~SEG6_LOCAL_FLV_SUPP_OPS) {
> +	rc = seg6_flv_supp_ops_by_action(action, &supp_fops);
> +	if (rc < 0 || !supp_fops || (fops & ~supp_fops)) {

if rc == 0, the supp_fops won't be 0.

Thanks
Hangbin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ