Commit 534a19b (dpctl: Add support for using UFID to add/del flows.)
introduced string parsing functions for UFIDs, but provided a broken
implementation where the upper 64 bits would be ignored, then the lower
64 bits would be read into both the lower and upper UFID positions. Fix
the implementation to read the upper bits properly.

Signed-off-by: Joe Stringer <joestrin...@nicira.com>
---
v2: Use "%16", combine both reads into one ovs_scan() call.
---
 lib/odp-util.c |   10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/lib/odp-util.c b/lib/odp-util.c
index 1dc63ef..5f598d9 100644
--- a/lib/odp-util.c
+++ b/lib/odp-util.c
@@ -2017,15 +2017,11 @@ odp_ufid_from_string(const char *s_, ovs_u128 *ufid)
             return -EINVAL;
         }
 
-        if (!ovs_scan(s, "%"SCNx64, &ufid->u64.hi)) {
+        if (!ovs_scan(s, "%16"SCNx64"%16"SCNx64, &ufid->u64.hi,
+                      &ufid->u64.lo)) {
             return -EINVAL;
         }
-        s += 16;
-
-        if (!ovs_scan(s, "%"SCNx64, &ufid->u64.lo)) {
-            return -EINVAL;
-        }
-        s += 16;
+        s += 32;
         s += strspn(s, delimiters);
 
         return s - s_;
-- 
1.7.10.4

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to