net/vdev_netvsc: use new ethernet address parser
authorStephen Hemminger <stephen@networkplumber.org>
Fri, 5 Jul 2019 17:16:25 +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: Matan Azrad <matan@mellanox.com>
drivers/net/vdev_netvsc/vdev_netvsc.c

index 1fcf90d..be8f19c 100644 (file)
@@ -529,15 +529,7 @@ vdev_netvsc_netvsc_probe(const struct if_nameindex *iface,
                        } else if (!strcmp(pair->key, VDEV_NETVSC_ARG_MAC)) {
                                struct rte_ether_addr tmp;
 
-                               if (sscanf(pair->value,
-                                          "%" SCNx8 ":%" SCNx8 ":%" SCNx8 ":"
-                                          "%" SCNx8 ":%" SCNx8 ":%" SCNx8,
-                                          &tmp.addr_bytes[0],
-                                          &tmp.addr_bytes[1],
-                                          &tmp.addr_bytes[2],
-                                          &tmp.addr_bytes[3],
-                                          &tmp.addr_bytes[4],
-                                          &tmp.addr_bytes[5]) != 6) {
+                               if (rte_ether_unformat_addr(pair->value, &tmp) != 0) {
                                        DRV_LOG(ERR,
                                                "invalid MAC address format"
                                                " \"%s\"",