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] [day] [month] [year] [list]
Message-ID: <e70fc28d-c6f6-422f-9678-64999aaf1514@kernel.org>
Date: Mon, 1 Dec 2025 19:48:14 -0700
From: David Ahern <dsahern@...nel.org>
To: Dmitry Skorodumov <skorodumov.dmitry@...wei.com>, netdev@...r.kernel.org
Cc: stephen@...workplumber.org
Subject: Re: [PATCH iproute2-next 1/3] helper funcs for ipvlan_mode <-> string
 conversion

On 11/21/25 8:52 AM, Dmitry Skorodumov wrote:
> +static int get_ipvlan_mode(const char *mode)
> +{
> +	if (strcmp(mode, "l2") == 0)
> +		return IPVLAN_MODE_L2;
> +	if (strcmp(mode, "l3") == 0)
> +		return IPVLAN_MODE_L3;
> +	if (strcmp(mode, "l3s") == 0)
> +		return IPVLAN_MODE_L3S;
> +	return -1;
> +}
> +
> +static const char *get_ipvlan_mode_name(__u16 mode)
> +{
> +	switch (mode) {
> +	case IPVLAN_MODE_L2:
> +		return "l2";
> +	case IPVLAN_MODE_L3:
> +		return "l3";
> +	case IPVLAN_MODE_L3S:
> +		return "l3s";
> +	default:
> +		return "unknown";
> +	}
> +}
> +

I like the direction, but let's use a table for both so the same strings
are used and add another function for the help usage.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ