2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

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>
This commit is contained in:
Ben Pfaff
2018-04-11 11:12:21 -07:00
parent 1bb011218d
commit 0b043300db
7 changed files with 125 additions and 208 deletions

View File

@@ -46,7 +46,8 @@ int check_connection_completion(int fd);
void drain_fd(int fd, size_t n_packets);
ovs_be32 guess_netmask(ovs_be32 ip);
char *inet_parse_token(char **);
void inet_parse_host_port_tokens(char *s, char **hostp, char **portp);
void inet_parse_port_host_tokens(char *s, char **portp, char **hostp);
bool inet_parse_active(const char *target, int default_port,
struct sockaddr_storage *ssp);
int inet_open_active(int style, const char *target, int default_port,