sks-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 7] Resolve addresses for hkp_address and recon_address (was: [Sks


From: Kim Minh Kaplan
Subject: [PATCH 7] Resolve addresses for hkp_address and recon_address (was: [Sks-devel] [CONTRIB] sks.pod text for enabling IPv6)
Date: Wed, 01 Apr 2009 08:27:02 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

Phil Pennock writes:

> On 2009-03-31 at 08:37 +0000, Kim Minh Kaplan wrote:
>> Regarding this, I once had a patch that would call Unix.getaddrinfo on
>> both hkp_address and recon_address but took it out because it did not
>> seem to add much.  In retrospect it could be useful as The Right Thing.

The patch is attached.

> Works for me.  Of course, that leads to the question of why is
> !Settings.hostname not used as the default?

As it used to be it was not really possible: hostname is a resolvable
domain name while hkp_address and recon_address were IP addresses...
But now should we do that ?

Kim Minh.

diff -r 9cf167ed1f0e -r da41e3a3c0a3 common.ml
--- a/common.ml Wed Apr 01 07:57:20 2009 +0000
+++ b/common.ml Wed Apr 01 08:07:41 2009 +0000
@@ -201,8 +201,10 @@
 let whitespace = Str.regexp "[ \t\n]+"
 let make_addr_list address_string port =
   let addrlist = Str.split whitespace address_string in
-  let f s = Unix.ADDR_INET (Unix.inet_addr_of_string s, port) in
-  List.map ~f addrlist
+  let servname = if port = 0 then "" else (string_of_int port) in
+  let resolver host = List.map ~f:(fun ai -> ai.Unix.ai_addr)
+      (Unix.getaddrinfo host servname [Unix.AI_SOCKTYPE Unix.SOCK_STREAM]) in
+  List.flatten (List.map ~f:resolver addrlist)
 
 let recon_port = !Settings.recon_port 
 let recon_address = !Settings.recon_address
diff -r 9cf167ed1f0e -r da41e3a3c0a3 sks.pod
--- a/sks.pod   Wed Apr 01 07:57:20 2009 +0000
+++ b/sks.pod   Wed Apr 01 08:07:41 2009 +0000
@@ -152,7 +152,7 @@
 
 =item -recon_address
 
-Set recon binding address.  Can be a list of whitespace separated IP addresses.
+Set recon binding addresses.  Can be a list of whitespace separated domain 
names.
 
 =item -hkp_port
 
@@ -160,7 +160,7 @@
 
 =item -hkp_address
 
-Set hkp binding address.  Can be a list of whitespace separated IP addresses.
+Set hkp binding addresses.  Can be a list of whitespace separated domain names.
 
 =item -use_port_80
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]