summaryrefslogtreecommitdiff
path: root/ovsdb
diff options
context:
space:
mode:
authorBen Pfaff <blp@ovn.org>2018-04-11 11:12:21 -0700
committerBen Pfaff <blp@ovn.org>2018-04-16 14:52:56 -0700
commit0b043300dbade23ce9435b7dd308473fea41e6fe (patch)
tree894f3f439c83e17b8d3806644eb7b19f8b13db89 /ovsdb
parent1bb011218d046b5de765658e9f5fe45289462eea (diff)
downloadopenvswitch-0b043300dbade23ce9435b7dd308473fea41e6fe.tar.gz
Make <host>:<port> parsing uniform treewide.
I didn't realize until now that the tree had two different ways of parsing strings in the form <host>:<port> and <port>:<host>. There are the long-standing inet_parse_active() and inet_parse_passive() functions, and more recently the ipv46_parse() function. This commit eliminates the latter and changes the code to use the former. The two implementations interpreted some input differently. In particular, the older functions required IPv6 addresses to be [bracketed], but the newer ones do not. For compatibility this patch changes the merged code to use the more liberal interpretation. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Mark Michelson <mmichels@redhat.com>
Diffstat (limited to 'ovsdb')
-rw-r--r--ovsdb/raft.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/ovsdb/raft.c b/ovsdb/raft.c
index edb22f2e7..c0c1e9897 100644
--- a/ovsdb/raft.c
+++ b/ovsdb/raft.c
@@ -335,9 +335,8 @@ raft_make_address_passive(const char *address_)
return xasprintf("p%s", address_);
} else {
char *address = xstrdup(address_);
- char *p = strchr(address, ':') + 1;
- char *host = inet_parse_token(&p);
- char *port = inet_parse_token(&p);
+ char *host, *port;
+ inet_parse_host_port_tokens(strchr(address, ':') + 1, &host, &port);
struct ds paddr = DS_EMPTY_INITIALIZER;
ds_put_format(&paddr, "p%.3s:%s:", address, port);