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: <BY5PR12MB4322E41AB919F5F5AF4AF40CDCB69@BY5PR12MB4322.namprd12.prod.outlook.com>
Date:   Mon, 1 Feb 2021 20:50:33 +0000
From:   Parav Pandit <parav@...dia.com>
To:     David Ahern <dsahern@...il.com>,
        "stephen@...workplumber.org" <stephen@...workplumber.org>,
        "netdev@...r.kernel.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



> From: David Ahern <dsahern@...il.com>
> Sent: Sunday, January 31, 2021 11:01 PM
> 
> 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.
>
Yes. Will reuse the helper that I am introducing for port flavour in v2.
 
> >  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?
> 
Oops. Will add back.
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ