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]
Date:   Sun, 31 Jan 2021 10:30:39 -0700
From:   David Ahern <dsahern@...il.com>
To:     Parav Pandit <parav@...dia.com>, stephen@...workplumber.org,
        netdev@...r.kernel.org
Cc:     Jiri Pirko <jiri@...dia.com>
Subject: Re: [PATCH iproute2-next 5/5] devlink: Support set of port function
 state

On 1/29/21 9:56 AM, Parav Pandit wrote:
> @@ -1420,6 +1423,22 @@ static int port_flavour_parse(const char *flavour, uint16_t *value)
>  	}
>  }
>  
> +static int port_function_state_parse(const char *statestr, uint8_t *state)
> +{
> +	if (!statestr)
> +		return -EINVAL;
> +
> +	if (strcmp(statestr, "inactive") == 0) {
> +		*state = DEVLINK_PORT_FN_STATE_INACTIVE;
> +		return 0;
> +	} else if (strcmp(statestr, "active") == 0) {
> +		*state = DEVLINK_PORT_FN_STATE_ACTIVE;
> +		return 0;
> +	} else {
> +		return -EINVAL;
> +	}
> +}
> +

if another state gets added this too should be table driven - string to
type here and the inverse in the previous patch.

>  struct dl_args_metadata {
>  	uint64_t o_flag;
>  	char err_msg[DL_ARGS_REQUIRED_MAX_ERR_LEN];



> @@ -3897,7 +3934,6 @@ static void pr_out_port_function(struct dl *dl, struct nlattr **tb_port)
>  
>  		print_string(PRINT_ANY, "opstate", " opstate %s", port_function_opstate(state));
>  	}
> -
>  	if (!dl->json_output)
>  		__pr_out_indent_dec();
>  	pr_out_object_end(dl);

Removing the newline intentional?




Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ