If the connection string is valid, and contains a DNS name, inet_open_passive will now return -ENODATA if dns resolution failed. DNS resolution failure may either mean the asynchronous resolver has not completed yet, or that the name does not resolve.
Signed-off-by: Frode Nordahl <[email protected]> --- lib/socket-util.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/socket-util.c b/lib/socket-util.c index 604fdbb49..1897c7523 100644 --- a/lib/socket-util.c +++ b/lib/socket-util.c @@ -711,8 +711,14 @@ inet_open_passive(int style, const char *target, int default_port, struct sockaddr_storage ss; int fd = 0, error; unsigned int yes = 1; + bool dns_failure; - if (!inet_parse_passive(target, default_port, &ss, true, NULL)) { + if (!inet_parse_passive(target, default_port, &ss, true, &dns_failure)) { + if (dns_failure) { + /* dns_failure means asynchronous DNS resolution is in progress, + * or that the name does currently not resolve. */ + return -ENODATA; + } return -EAFNOSUPPORT; } kernel_chooses_port = ss_get_port(&ss) == 0; -- 2.37.2 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
