From: Stephen Hemminger Date: Fri, 5 Jul 2019 17:16:26 +0000 (-0700) Subject: net/memif: use new ethernet address parser X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=4a49dbd1b31b74a21cf022c14c689bf41a06c614;p=dpdk.git net/memif: use new ethernet address parser Use rte_ether_unformat_addr rather than sscanf. Signed-off-by: Stephen Hemminger Reviewed-by: Ferruh Yigit --- diff --git a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c index e9ddf64135..00c9b396ab 100644 --- a/drivers/net/memif/rte_eth_memif.c +++ b/drivers/net/memif/rte_eth_memif.c @@ -1224,13 +1224,8 @@ static int memif_set_mac(const char *key __rte_unused, const char *value, void *extra_args) { struct rte_ether_addr *ether_addr = (struct rte_ether_addr *)extra_args; - int ret = 0; - ret = sscanf(value, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", - ðer_addr->addr_bytes[0], ðer_addr->addr_bytes[1], - ðer_addr->addr_bytes[2], ðer_addr->addr_bytes[3], - ðer_addr->addr_bytes[4], ðer_addr->addr_bytes[5]); - if (ret != 6) + if (rte_ether_unformat_addr(value, ether_addr) < 0) MIF_LOG(WARNING, "Failed to parse mac '%s'.", value); return 0; }