From 33ab38d9b861ab07fc4a291b77ce426bb3a1609e Mon Sep 17 00:00:00 2001 From: Jarno Rajahalme Date: Fri, 10 May 2013 22:54:35 +0300 Subject: [PATCH] meta-flow: Simplify mf_from_ofp_port_string() ofputil_port_from_string() does all the work already. Signed-off-by: Jarno Rajahalme Signed-off-by: Ben Pfaff --- 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 c3f198cd3..16850ec35 100644 --- a/lib/meta-flow.c +++ b/lib/meta-flow.c @@ -2168,17 +2168,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 { -- 2.43.0