net/failsafe: use new ethernet address parser

Use rte_ether_unformat_addr rather than sscanf.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
This commit is contained in:
Stephen Hemminger 2019-07-05 10:16:24 -07:00 committed by Ferruh Yigit
parent 8eb49a1860
commit 1cf34a4e39

View File

@ -368,15 +368,11 @@ fs_get_mac_addr_arg(const char *key __rte_unused,
const char *value, void *out)
{
struct rte_ether_addr *ea = out;
int ret;
if ((value == NULL) || (out == NULL))
return -EINVAL;
ret = sscanf(value, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx",
&ea->addr_bytes[0], &ea->addr_bytes[1],
&ea->addr_bytes[2], &ea->addr_bytes[3],
&ea->addr_bytes[4], &ea->addr_bytes[5]);
return ret != RTE_ETHER_ADDR_LEN;
return rte_ether_unformat_addr(value, ea);
}
int