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: <ZJFOGws2EcmGxLHZ@shredder>
Date: Tue, 20 Jun 2023 09:58:35 +0300
From: Ido Schimmel <idosch@...sch.org>
To: Zahari Doychev <zahari.doychev@...ux.com>
Cc: netdev@...r.kernel.org, dsahern@...il.com, stephen@...workplumber.org,
	hmehrtens@...linear.com, aleksander.lobakin@...el.com,
	simon.horman@...igine.com, Zahari Doychev <zdoychev@...linear.com>
Subject: Re: [PATCH iproute2-next] f_flower: add cfm support

On Mon, Jun 19, 2023 at 11:35:23PM +0200, Zahari Doychev wrote:
> +static int flower_parse_cfm(int *argc_p, char ***argv_p, __be16 eth_type,
> +			    struct nlmsghdr *n)
> +{
> +	struct rtattr *cfm_attr;
> +	char **argv = *argv_p;
> +	int argc = *argc_p;
> +	int ret;
> +
> +	if (eth_type != htons(ETH_P_CFM)) {
> +		fprintf(stderr,
> +			"Can't set attribute if ethertype isn't CFM\n");
> +		return -1;
> +	}
> +
> +	cfm_attr = addattr_nest(n, MAX_MSG, TCA_FLOWER_KEY_CFM | NLA_F_NESTED);
> +
> +	while (argc > 0) {
> +		if (matches(*argv, "mdl") == 0) {

New code is expected to use strcmp() instead of matches(). Looks good
otherwise.

> +			__u8 val;
> +
> +			NEXT_ARG();
> +			ret = get_u8(&val, *argv, 10);
> +			if (ret < 0) {
> +				fprintf(stderr, "Illegal \"cfm md level\"\n");
> +				return -1;
> +			}
> +			addattr8(n, MAX_MSG, TCA_FLOWER_KEY_CFM_MD_LEVEL, val);
> +		} else if (matches(*argv, "op") == 0) {

Likewise.

> +			__u8 val;
> +
> +			NEXT_ARG();
> +			ret = get_u8(&val, *argv, 10);
> +			if (ret < 0) {
> +				fprintf(stderr, "Illegal \"cfm opcode\"\n");
> +				return -1;
> +			}
> +			addattr8(n, MAX_MSG, TCA_FLOWER_KEY_CFM_OPCODE, val);
> +		} else {
> +			break;
> +		}
> +		argc--; argv++;
> +	}
> +
> +	addattr_nest_end(n, cfm_attr);
> +
> +	*argc_p = argc;
> +	*argv_p = argv;
> +
> +	return 0;
> +}
> +
>  static int flower_parse_opt(struct filter_util *qu, char *handle,
>  			    int argc, char **argv, struct nlmsghdr *n)
>  {
> @@ -2065,6 +2118,12 @@ static int flower_parse_opt(struct filter_util *qu, char *handle,
>  				return -1;
>  			}
>  			continue;
> +		} else if (matches(*argv, "cfm") == 0) {

Likewise.

> +			NEXT_ARG();
> +			ret = flower_parse_cfm(&argc, &argv, eth_type, n);
> +			if (ret < 0)
> +				return -1;
> +			continue;
>  		} else {
>  			if (strcmp(*argv, "help") != 0)
>  				fprintf(stderr, "What is \"%s\"?\n", *argv);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ