dirmngr: Avoid network queries for literal IP addresses.
authorWerner Koch <wk@gnupg.org>
Mon, 16 Jan 2017 08:10:46 +0000 (09:10 +0100)
committerWerner Koch <wk@gnupg.org>
Mon, 16 Jan 2017 18:12:03 +0000 (19:12 +0100)
* dirmngr/dns-stuff.c (resolve_name_libdns): USe flags AI_NUMERICHOST
for literal IP addresses.
(resolve_name_standard): Ditto.

Signed-off-by: Werner Koch <wk@gnupg.org>
dirmngr/dns-stuff.c

index 1b30c2c..2debdca 100644 (file)
@@ -685,6 +685,8 @@ resolve_name_libdns (const char *name, unsigned short port,
   hints.ai_flags = AI_ADDRCONFIG;
   if (r_canonname)
     hints.ai_flags |= AI_CANONNAME;
+  if (is_ip_address (name))
+    hints.ai_flags |= AI_NUMERICHOST;
 
   if (port)
     {
@@ -806,6 +808,8 @@ resolve_name_standard (const char *name, unsigned short port,
   hints.ai_flags = AI_ADDRCONFIG;
   if (r_canonname)
     hints.ai_flags |= AI_CANONNAME;
+  if (is_ip_address (name))
+    hints.ai_flags |= AI_NUMERICHOST;
 
   if (port)
     snprintf (portstr, sizeof portstr, "%hu", port);