net/failsafe: use new ethernet address parser
authorStephen Hemminger <stephen@networkplumber.org>
Fri, 5 Jul 2019 17:16:24 +0000 (10:16 -0700)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 8 Jul 2019 19:26:52 +0000 (21:26 +0200)
Use rte_ether_unformat_addr rather than sscanf.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
drivers/net/failsafe/failsafe_args.c

index d2e725b..707490b 100644 (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