Signed-off-by: nickcooper-zhangtonghao <nickcooper-zhangtong...@opencloud.tech> --- lib/packets.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/lib/packets.c b/lib/packets.c index 990c407..1d2d452 100644 --- a/lib/packets.c +++ b/lib/packets.c @@ -436,15 +436,12 @@ char * OVS_WARN_UNUSED_RESULT ip_parse_port(const char *s, ovs_be32 *ip, ovs_be16 *port) { int n = 0; - if (!ovs_scan_len(s, &n, IP_PORT_SCAN_FMT, - IP_PORT_SCAN_ARGS(ip, port))) { - return xasprintf("%s: invalid IP address or port number", s); + if (ovs_scan(s, IP_PORT_SCAN_FMT"%n", IP_PORT_SCAN_ARGS(ip, port), &n) + && !s[n]) { + return NULL; } - if (s[n]) { - return xasprintf("%s: invalid IP address or port number", s); - } - return NULL; + return xasprintf("%s: invalid IP address or port number", s); } /* Parses string 's', which must be an IP address with an optional netmask or -- 1.8.3.1 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev