On 03/29/2018 11:27 AM, John Ferlan wrote:
On 03/26/2018 04:29 PM, Jim Fehlig wrote:
When preparing for migration, the libxl driver creates a new TCP listen
socket for the incoming migration by calling virNetSocketNewListenTCP,
passing the destination host name. virNetSocketNewListenTCP calls
virSocketAddrParse to check if the host name is a wildcard address, in
which case it avoids adding the AI_ADDRCONFIG flag to the hints passed to
getaddrinfo. If the host name is not an IP address, virSocketAddrParse
reports an error
error : virSocketAddrParseInternal:121 : Cannot parse socket address
'myhost.example.com': Name or service not known
But virNetSocketNewListenTCP succeeds regardless and the overall migration
operation succeeds.
Introduce virSocketAddrParseAny and use it when simply testing if a host
name/addr is parsable.
Signed-off-by: Jim Fehlig <jfehlig@xxxxxxxx>
---
Essentially a V2 of
https://www.redhat.com/archives/libvir-list/2018-March/msg01120.html
It takes a slightly different approach by creating a function that can
parse host names or IP addresses.
src/libvirt_private.syms | 1 +
src/rpc/virnetsocket.c | 2 +-
src/util/virsocketaddr.c | 50 +++++++++++++++++++++++++++++++++++++++++++++---
src/util/virsocketaddr.h | 5 +++++
4 files changed, 54 insertions(+), 4 deletions(-)
Reviewed-by: John Ferlan <jferlan@xxxxxxxxxx>
Wait for 4.2.0 for this one...
John
BTW: Your call on whether to add to the new API comments something about
the API could be susceptible to a delay due to network name resolution
lookup pause. That is, from the getaddrinfo man page:
"The AI_NUMERICHOST flag suppresses any potentially lengthy network host
address lookups."
Good point. I squashed in the below comment to this patch before pushing both.
Regards,
Jim
diff --git a/src/util/virsocketaddr.c b/src/util/virsocketaddr.c
index 84610560f..99dc54830 100644
--- a/src/util/virsocketaddr.c
+++ b/src/util/virsocketaddr.c
@@ -173,7 +173,10 @@ int virSocketAddrParse(virSocketAddrPtr addr, const char
*val, int family)
*
* Mostly a wrapper for getaddrinfo() extracting the address storage
* from a host name like acme.example.com or a numeric string like 1.2.3.4
- * or 2001:db8:85a3:0:0:8a2e:370:7334
+ * or 2001:db8:85a3:0:0:8a2e:370:7334.
+ *
+ * When @val is a network host name, this function may be susceptible to a
+ * delay due to potentially lengthy netork host address lookups.
*
* Returns the length of the network address or -1 in case of error.
*/
--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list