option to not do DNS lookup of hostname
authorChristian Grothoff <christian@grothoff.org>
Mon, 4 Jul 2011 08:18:00 +0000 (08:18 +0000)
committerChristian Grothoff <christian@grothoff.org>
Mon, 4 Jul 2011 08:18:00 +0000 (08:18 +0000)
contrib/defaults.conf
src/nat/nat.c

index a634988a17be9752e22a597768c5440d2c2f21e2..4a9b44dc80095969b9399ae51adca8ec8cc3f9b3 100644 (file)
@@ -34,6 +34,9 @@ ENABLE_UPNP = NO
 # Use addresses from the local network interfaces (inluding loopback, but also others)
 USE_LOCALADDR = YES
 
+# Use address obtained from a DNS lookup of our hostname
+USE_HOSTNAME = NO
+
 # External IP address of the NAT box (if known); IPv4 dotted-decimal ONLY at this time (should allow DynDNS!)
 # normal interface IP address for non-NATed peers; 
 # possibly auto-detected (using UPnP) if possible if not specified
index e55ea958ab0e2ad567e4b2654feb15bf91bddb44..b8c62739e114968f6c7be12d60a78c6949cacb7f 100644 (file)
@@ -280,6 +280,11 @@ struct GNUNET_NAT_Handle
    */
   int use_localaddresses;
 
+  /**
+   * Should we do a DNS lookup of our hostname to find out our own IP?
+   */
+  int use_hostname;
+
   /**
    * Is using IPv6 disabled?
    */
@@ -1144,6 +1149,9 @@ GNUNET_NAT_register (const struct GNUNET_CONFIGURATION_Handle *cfg,
   h->use_localaddresses = GNUNET_CONFIGURATION_get_value_yesno (cfg,
                                                                "nat",
                                                                "USE_LOCALADDR");
+  h->use_hostname = GNUNET_CONFIGURATION_get_value_yesno (cfg,
+                                                         "nat",
+                                                         "USE_HOSTNAME");
   if (h->use_localaddresses)
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "USE LOCALADDR enabled!\n");
   h->disable_ipv6 = GNUNET_CONFIGURATION_get_value_yesno(cfg,
@@ -1206,8 +1214,9 @@ GNUNET_NAT_register (const struct GNUNET_CONFIGURATION_Handle *cfg,
 
   if (NULL != h->address_callback)
     {
-      h->ifc_task = GNUNET_SCHEDULER_add_now (&list_interfaces, h);
-      h->hostname_task = GNUNET_SCHEDULER_add_now (&resolve_hostname, h);
+      h->ifc_task = GNUNET_SCHEDULER_add_now (&list_interfaces, h);    
+      if (GNUNET_YES == h->use_hostname)
+       h->hostname_task = GNUNET_SCHEDULER_add_now (&resolve_hostname, h);
     }
   return h;
 }