From 431a87f35729b42d6dcb6ba0bb2bdbef896acfd5 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 4 Jul 2011 08:18:00 +0000 Subject: [PATCH] option to not do DNS lookup of hostname --- contrib/defaults.conf | 3 +++ src/nat/nat.c | 13 +++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/contrib/defaults.conf b/contrib/defaults.conf index a634988a1..4a9b44dc8 100644 --- a/contrib/defaults.conf +++ b/contrib/defaults.conf @@ -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 diff --git a/src/nat/nat.c b/src/nat/nat.c index e55ea958a..b8c62739e 100644 --- a/src/nat/nat.c +++ b/src/nat/nat.c @@ -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; } -- 2.25.1