ofputil_port_from_string() does all the work already.

Signed-off-by: Jarno Rajahalme <jarno.rajaha...@nsn.com>
---
 lib/meta-flow.c |   10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/lib/meta-flow.c b/lib/meta-flow.c
index a75e526..e5809d5 100644
--- a/lib/meta-flow.c
+++ b/lib/meta-flow.c
@@ -2166,17 +2166,13 @@ mf_from_ofp_port_string(const struct mf_field *mf, 
const char *s,
     uint16_t port;
 
     ovs_assert(mf->n_bytes == sizeof(ovs_be16));
-    if (*s == '-') {
-        return xasprintf("%s: negative values not supported for %s",
-                         s, mf->name);
-    } else if (ofputil_port_from_string(s, &port)) {
+
+    if (ofputil_port_from_string(s, &port)) {
         *valuep = htons(port);
         *maskp = htons(UINT16_MAX);
         return NULL;
-    } else {
-        return mf_from_integer_string(mf, s,
-                                      (uint8_t *) valuep, (uint8_t *) maskp);
     }
+    return xasprintf("%s: port value out of range for %s", s, mf->name);
 }
 
 struct frag_handling {
-- 
1.7.10.4

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

Reply via email to