- {
- // Error: resolving ip addresses does not work
-#if DEBUG_RESOLVER
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _("gethostbyname() could not lookup IP address: %s\n"),
- hstrerror (h_errno));
-#endif
- GNUNET_break (0);
- return;
- }
- // Counting returned ip addresses
- int count_ips =0 ;
- while (rootserver->h_addr_list[count_ips]!=NULL)
- {
- count_ips++;
- }
- if ( count_ips > 1)
- {
-#if DEBUG_RESOLVER
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ip range for root name server, but a root nameserver has only 1 ip\n");
-#endif
- GNUNET_break (0);
- }
-
- // Comparing to resolved address to the address the root nameserver should have
- if ( strcmp(inet_ntoa( *(struct in_addr *) rootserver->h_addr_list[0]),ROOTSERVER_IP) !=0)
- {
- #if DEBUG_RESOLVER
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ip and ip for root name server differ\n");
- #endif
- GNUNET_break (0);
- }
-
- #if DEBUG_RESOLVER
- GNUNET_log (GNUNET_ERROR_TYPE_INFO, "System's own forward name resolution is working\n");
- #endif
-
- // Resolve the same using GNUNET
- GNUNET_RESOLVER_ip_get (sched, cfg, ROOTSERVER_NAME, AF_INET, timeout, &check_rootserver_ip, cls);
-
- // Success: forward lookups work as exptected
-
-
- // Next step: reverse lookups
-
- struct in_addr rootserver_addr;
- rootserver->h_name="";
- if ( 1 != inet_pton(AF_INET, ROOTSERVER_IP, &rootserver_addr))
- {
- #if DEBUG_RESOLVER
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Could not transform root nameserver ip addressr\n");
- #endif
- GNUNET_break (0);
- }
-
- rootserver = gethostbyaddr(&rootserver_addr, sizeof(rootserver_addr), AF_INET);
- if (rootserver == NULL)
- {
- // Error: resolving ip addresses does not work
- #if DEBUG_RESOLVER
- switch (h_errno)
- {
-
- case HOST_NOT_FOUND: GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "gethostbyaddr() could not lookup ip address: HOST_NOT_FOUND\n");break;
- case NO_ADDRESS: GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "gethostbyaddr() could not lookup ip address: NO_ADDRESS\n");break;
- case NO_RECOVERY: GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "gethostbyaddr() could not lookup ip address: NO_RECOVERY\n");break;
- case TRY_AGAIN: GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "gethostbyaddr() could not lookup ip address: TRY_AGAIN\n");break;
- }
- #endif
- GNUNET_break (0);
- }
+ {
+ /* Error: resolving ip addresses does not work */
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _("gethostbyname() could not lookup IP address: %s\n"),
+ hstrerror (h_errno));
+ FPRINTF (stderr,
+ "%s", "System seems to be off-line, will not run all DNS tests\n");
+ *ok = 0; /* mark test as passing anyway */
+ return;
+ }