aboutsummaryrefslogtreecommitdiff
path: root/src/nat/nat.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-12-13 19:38:18 +0000
committerChristian Grothoff <christian@grothoff.org>2013-12-13 19:38:18 +0000
commit11db9d8466a4581b231cac6a4bebb01719db5f28 (patch)
tree246f6797a9f1ef3914c5ba067457a6548a1deb41 /src/nat/nat.c
parente00e6a9687028f1e7a31ede8d413ecc981d6bf64 (diff)
downloadgnunet-11db9d8466a4581b231cac6a4bebb01719db5f28.tar.gz
gnunet-11db9d8466a4581b231cac6a4bebb01719db5f28.zip
remove external IP address from previous DNS lookup only after DNS lookup for new iteration has completed (#3213)
Diffstat (limited to 'src/nat/nat.c')
-rw-r--r--src/nat/nat.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/nat/nat.c b/src/nat/nat.c
index 1d2afdfbd..2b2d1df53 100644
--- a/src/nat/nat.c
+++ b/src/nat/nat.c
@@ -71,6 +71,13 @@ enum LocalAddressSource
71 LAL_EXTERNAL_IP, 71 LAL_EXTERNAL_IP,
72 72
73 /** 73 /**
74 * Address was obtained by DNS resolution of the external hostname
75 * given in the configuration (i.e. hole-punched DynDNS setup)
76 * during the previous iteration (see #3213).
77 */
78 LAL_EXTERNAL_IP_OLD,
79
80 /**
74 * Address was obtained by looking up our own hostname in DNS. 81 * Address was obtained by looking up our own hostname in DNS.
75 */ 82 */
76 LAL_HOSTNAME_DNS, 83 LAL_HOSTNAME_DNS,
@@ -579,6 +586,8 @@ process_external_ip (void *cls,
579 if (NULL == addr) 586 if (NULL == addr)
580 { 587 {
581 h->ext_dns = NULL; 588 h->ext_dns = NULL;
589 /* Current iteration is over, remove 'old' IPs now */
590 remove_from_address_list_by_source (h, LAL_EXTERNAL_IP);
582 if (1 == inet_pton (AF_INET, 591 if (1 == inet_pton (AF_INET,
583 h->external_address, 592 h->external_address,
584 &dummy)) 593 &dummy))
@@ -967,10 +976,12 @@ resolve_dns (void *cls,
967 const struct GNUNET_SCHEDULER_TaskContext *tc) 976 const struct GNUNET_SCHEDULER_TaskContext *tc)
968{ 977{
969 struct GNUNET_NAT_Handle *h = cls; 978 struct GNUNET_NAT_Handle *h = cls;
979 struct LocalAddressList *pos;
970 980
971 h->dns_task = GNUNET_SCHEDULER_NO_TASK; 981 h->dns_task = GNUNET_SCHEDULER_NO_TASK;
972 /* NOTE #3213, bugnote #7878 */ 982 for (pos = h->lal_head; NULL != pos; pos = pos->next)
973 remove_from_address_list_by_source (h, LAL_EXTERNAL_IP); 983 if (pos->source == LAL_EXTERNAL_IP)
984 pos->source = LAL_EXTERNAL_IP_OLD;
974 h->ext_dns = 985 h->ext_dns =
975 GNUNET_RESOLVER_ip_get (h->external_address, AF_INET, 986 GNUNET_RESOLVER_ip_get (h->external_address, AF_INET,
976 GNUNET_TIME_UNIT_MINUTES, 987 GNUNET_TIME_UNIT_MINUTES,