[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231002233946.16703-2-mcpratt@protonmail.com>
Date: Mon, 02 Oct 2023 23:40:02 +0000
From: Michael Pratt <mcpratt@...tonmail.com>
To: netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: "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: [PATCH 1/2] mac_pton: support MAC addresses with other delimiters
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]))
return false;
}
for (i = 0; i < ETH_ALEN; i++) {
--
2.30.2
Powered by blists - more mailing lists