diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-04-01 08:10:58 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-04-01 08:10:58 +0000 |
commit | ef3b217d7330495dec514027e75e758ebdd4085e (patch) | |
tree | 2aca4c12aaac367af26530156a30f86f205067db /src/util/test_resolver_api.c | |
parent | 4ef94875c1e50499513fd50f6a0feee479a07812 (diff) | |
download | gnunet-ef3b217d7330495dec514027e75e758ebdd4085e.tar.gz gnunet-ef3b217d7330495dec514027e75e758ebdd4085e.zip |
style
Diffstat (limited to 'src/util/test_resolver_api.c')
-rw-r--r-- | src/util/test_resolver_api.c | 41 |
1 files changed, 18 insertions, 23 deletions
diff --git a/src/util/test_resolver_api.c b/src/util/test_resolver_api.c index 0ac31da04..5fcf53210 100644 --- a/src/util/test_resolver_api.c +++ b/src/util/test_resolver_api.c | |||
@@ -32,9 +32,11 @@ | |||
32 | 32 | ||
33 | #define VERBOSE GNUNET_NO | 33 | #define VERBOSE GNUNET_NO |
34 | 34 | ||
35 | // Using dns rootservers to check gnunet's resolver service | 35 | /** |
36 | // a.root-servers.net <-> 198.41.0.4 is a fix 1:1 mapping that should not change over years | 36 | * Using dns rootservers to check gnunet's resolver service |
37 | // For more information have a look at IANA's website http://www.root-servers.org/ | 37 | * a.root-servers.net <-> 198.41.0.4 is a fix 1:1 mapping that should not change over years |
38 | * For more information have a look at IANA's website http://www.root-servers.org/ | ||
39 | */ | ||
38 | #define ROOTSERVER_NAME "a.root-servers.net" | 40 | #define ROOTSERVER_NAME "a.root-servers.net" |
39 | #define ROOTSERVER_IP "198.41.0.4" | 41 | #define ROOTSERVER_IP "198.41.0.4" |
40 | 42 | ||
@@ -219,20 +221,14 @@ run (void *cls, | |||
219 | if (rootserver == NULL) | 221 | if (rootserver == NULL) |
220 | { | 222 | { |
221 | // Error: resolving ip addresses does not work | 223 | // Error: resolving ip addresses does not work |
222 | #if DEBUG_RESOLVER | 224 | #if DEBUG_RESOLVER |
223 | switch (h_errno) | 225 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
224 | { | 226 | _("gethostbyname() could not lookup IP address: %s\n"), |
225 | 227 | hstrerror (h_errno)); | |
226 | case HOST_NOT_FOUND: GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "gethostbyname() could not lookup ip address: HOST_NOT_FOUND\n");break; | 228 | #endif |
227 | case NO_ADDRESS: GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "gethostbyname() could not lookup ip address: NO_ADDRESS\n");break; | ||
228 | case NO_RECOVERY: GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "gethostbyname() could not lookup ip address: NO_RECOVERY\n");break; | ||
229 | case TRY_AGAIN: GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "gethostbyname() could not lookup ip address: TRY_AGAIN\n");break; | ||
230 | } | ||
231 | #endif | ||
232 | GNUNET_break (0); | 229 | GNUNET_break (0); |
230 | return; | ||
233 | } | 231 | } |
234 | else | ||
235 | { | ||
236 | // Counting returned ip addresses | 232 | // Counting returned ip addresses |
237 | int count_ips =0 ; | 233 | int count_ips =0 ; |
238 | while (rootserver->h_addr_list[count_ips]!=NULL) | 234 | while (rootserver->h_addr_list[count_ips]!=NULL) |
@@ -240,12 +236,12 @@ run (void *cls, | |||
240 | count_ips++; | 236 | count_ips++; |
241 | } | 237 | } |
242 | if ( count_ips > 1) | 238 | if ( count_ips > 1) |
243 | { | 239 | { |
244 | #if DEBUG_RESOLVER | 240 | #if DEBUG_RESOLVER |
245 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ip range for root name server, but a root nameserver has only 1 ip\n"); | 241 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ip range for root name server, but a root nameserver has only 1 ip\n"); |
246 | #endif | 242 | #endif |
247 | GNUNET_break (0); | 243 | GNUNET_break (0); |
248 | } | 244 | } |
249 | 245 | ||
250 | // Comparing to resolved address to the address the root nameserver should have | 246 | // Comparing to resolved address to the address the root nameserver should have |
251 | if ( strcmp(inet_ntoa( *(struct in_addr *) rootserver->h_addr_list[0]),ROOTSERVER_IP) !=0) | 247 | if ( strcmp(inet_ntoa( *(struct in_addr *) rootserver->h_addr_list[0]),ROOTSERVER_IP) !=0) |
@@ -318,9 +314,8 @@ run (void *cls, | |||
318 | sizeof (struct sockaddr), | 314 | sizeof (struct sockaddr), |
319 | GNUNET_YES, | 315 | GNUNET_YES, |
320 | timeout, &check_rootserver_name, cls); | 316 | timeout, &check_rootserver_name, cls); |
321 | 317 | ||
322 | // Success: reverse lookups work as exptected | 318 | |
323 | } | ||
324 | } | 319 | } |
325 | 320 | ||
326 | static int | 321 | static int |