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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Tue, 3 Oct 2023 09:58:32 -0700
From:   Stephen Hemminger <stephen@...workplumber.org>
To:     Michael Pratt <mcpratt@...tonmail.com>
Cc:     netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
        "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Paolo Abeni <pabeni@...hat.com>,
        Rafal Milecki <zajec5@...il.com>,
        Christian Marangi <ansuelsmth@...il.com>,
        Michael Pratt <mcpratt@...me>
Subject: Re: [PATCH 1/2] mac_pton: support MAC addresses with other
 delimiters

On Mon, 02 Oct 2023 23:40:02 +0000
Michael Pratt <mcpratt@...tonmail.com> wrote:

> From: Michael Pratt <mcpratt@...me>
> 
> Some network hardware vendors may do something unique
> when storing the MAC address into hardware in ASCII,
> like using hyphens as the delimiter.
> 
> Allow parsing of MAC addresses with a non-standard
> delimiter (punctuation other than a colon).
> 
> e.g. aa-bb-cc-dd-ee-ff
> 
> Signed-off-by: Michael Pratt <mcpratt@...me>
> ---
>  lib/net_utils.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/net_utils.c b/lib/net_utils.c
> index 42bb0473fb22..ecb7625e1dec 100644
> --- a/lib/net_utils.c
> +++ b/lib/net_utils.c
> @@ -18,7 +18,7 @@ bool mac_pton(const char *s, u8 *mac)
>  	for (i = 0; i < ETH_ALEN; i++) {
>  		if (!isxdigit(s[i * 3]) || !isxdigit(s[i * 3 + 1]))
>  			return false;
> -		if (i != ETH_ALEN - 1 && s[i * 3 + 2] != ':')
> +		if (i != ETH_ALEN - 1 && !ispunct(s[i * 3 + 2]))

Having looked at same thing in DPDK already, this looks overly broad.
There are only two common formats in the standards (isn't it fun
when standards disagree). IETF uses colon separator and IEEE uses
hyphen separator. Linux convention is colon, and  Windows convention
is hyphen. There is also the old Cisco 3 part format with periods
but adding that makes no sense.

Also, it would be bad to allow bogus values where two different
types of punctuation are used.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ