gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet] branch master updated: GNS/NAMESTORE: Fix GNS2DNS delegations


From: gnunet
Subject: [gnunet] branch master updated: GNS/NAMESTORE: Fix GNS2DNS delegations
Date: Mon, 14 Feb 2022 16:00:18 +0100

This is an automated email from the git hooks/post-receive script.

martin-schanzenbach pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new 336acc330 GNS/NAMESTORE: Fix GNS2DNS delegations
336acc330 is described below

commit 336acc33010eb725c873791ed6eb9039cb1aedd2
Author: Martin Schanzenbach <schanzen@gnunet.org>
AuthorDate: Mon Feb 14 16:00:15 2022 +0100

    GNS/NAMESTORE: Fix GNS2DNS delegations
---
 src/gns/test_gns_gns2dns_cname_lookup.sh |  9 ++++++---
 src/gns/test_gns_gns2dns_lookup.sh       | 12 +++++++-----
 src/gns/test_gns_gns2dns_zkey_lookup.sh  | 12 +++++++-----
 src/namestore/gnunet-service-namestore.c | 23 +++++++++++++++++------
 4 files changed, 37 insertions(+), 19 deletions(-)

diff --git a/src/gns/test_gns_gns2dns_cname_lookup.sh 
b/src/gns/test_gns_gns2dns_cname_lookup.sh
index ce1afacf4..9315f6b2f 100755
--- a/src/gns/test_gns_gns2dns_cname_lookup.sh
+++ b/src/gns/test_gns_gns2dns_cname_lookup.sh
@@ -16,9 +16,11 @@ fi
 
 rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME`
 # IP address of 'www.gnunet.org'
-TEST_IP="131.159.74.67"
+TEST_IP="147.87.255.218"
+# IP address of 'gnunet.org'
+TEST_IPALT="131.159.74.67"
 # IPv6 address of 'gnunet.org'
-TEST_IP6="2001:4ca0:2001:42:225:90ff:fe6b:d60"
+TEST_IP6="2a07:6b47:100:464::9357:ffdb"
 
 # main label used during resolution
 TEST_RECORD_NAME="homepage"
@@ -46,7 +48,7 @@ TEST_DOMAIN="www.${TEST_RECORD_NAME}.$MY_EGO"
 which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 15"
 
 gnunet-arm -s -c test_gns_lookup.conf
-OUT=`$DO_TIMEOUT gnunet-resolver -c test_gns_lookup.conf gnunet.org`
+OUT=`$DO_TIMEOUT gnunet-resolver -c test_gns_lookup.conf www.gnunet.org`
 echo $OUT | grep $TEST_IP - > /dev/null || { gnunet-arm -e -c 
test_gns_lookup.conf ; echo "IPv4 for gnunet.org not found ($OUT), skipping 
test"; exit 77; }
 echo $OUT | grep $TEST_IP6 - > /dev/null || { gnunet-arm -e -c 
test_gns_lookup.conf ; echo "IPv6 for gnunet.org not found ($OUT), skipping 
test"; exit 77; }
 
@@ -59,6 +61,7 @@ gnunet-namestore -p -z $MY_EGO -a -n $TEST_RECORD_NAME -t 
GNS2DNS -V $TEST_RECOR
 gnunet-namestore -p -z $MY_EGO -a -n $TEST_RECORD_NAME -t GNS2DNS -V 
$TEST_RECORD_GNS2DNS2 -e never -c test_gns_lookup.conf
 gnunet-namestore -p -z $MY_EGO -a -n $TEST_RECORD_NAME -t GNS2DNS -V 
$TEST_RECORD_GNS2DNS3 -e never -c test_gns_lookup.conf
 
+gnunet-namestore -z $MY_EGO -D -c test_gns_lookup.conf
 
 echo "EGOs:"
 gnunet-identity -d
diff --git a/src/gns/test_gns_gns2dns_lookup.sh 
b/src/gns/test_gns_gns2dns_lookup.sh
index dcad594b3..6cb1cc43e 100755
--- a/src/gns/test_gns_gns2dns_lookup.sh
+++ b/src/gns/test_gns_gns2dns_lookup.sh
@@ -17,9 +17,11 @@ rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o 
GNUNET_TEST_HOME`
 # IP address of 'docs.gnunet.org'
 TEST_IP_ALT2="147.87.255.218"
 # IP address of 'www.gnunet.org'
-TEST_IP="131.159.74.67"
+TEST_IP="147.87.255.218"
+# IP address of 'gnunet.org'
+TEST_IP_ALT="131.159.74.67"
 # IPv6 address of 'gnunet.org'
-TEST_IP6="2001:4ca0:2001:42:225:90ff:fe6b:d60"
+TEST_IP6="2a07:6b47:100:464::9357:ffdb"
 # permissive DNS resolver we will use for the test
 TEST_IP_GNS2DNS="8.8.8.8"
 
@@ -49,7 +51,7 @@ which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 15"
 
 gnunet-arm -s -c test_gns_lookup.conf
 
-OUT=`$DO_TIMEOUT gnunet-resolver -c test_gns_lookup.conf gnunet.org`
+OUT=`$DO_TIMEOUT gnunet-resolver -c test_gns_lookup.conf www.gnunet.org`
 echo $OUT | grep $TEST_IP - > /dev/null || { gnunet-arm -e -c 
test_gns_lookup.conf ; echo "IPv4 for gnunet.org not found ($OUT), skipping 
test"; exit 77; }
 echo $OUT | grep $TEST_IP6 - > /dev/null || { gnunet-arm -e -c 
test_gns_lookup.conf ; echo "IPv6 for gnunet.org not found ($OUT), skipping 
test"; exit 77; }
 
@@ -69,7 +71,7 @@ gnunet-identity -d
 # lookup 'www.gnunet.org', IPv4
 RES_IP=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN -t A -c 
test_gns_lookup.conf`
 # lookup 'www.gnunet.org', IPv6
-RES_IP6=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN -t AAAA -c 
test_gns_lookup.conf`
+RES_IP6=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN -t AAAA -c 
test_gns_lookup.conf | head -n1`
 # lookup 'gnunet.org', IPv4
 RES_IP_ALT=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN_ALT -t A -c 
test_gns_lookup.conf`
 # lookup 'docs.gnunet.org', IPv4
@@ -99,7 +101,7 @@ else
   ret=1
 fi
 
-if echo "$RES_IP_ALT" | grep "$TEST_IP" > /dev/null
+if echo "$RES_IP_ALT" | grep "$TEST_IP_ALT" > /dev/null
 then
   echo "PASS: Resolved $TEST_DOMAIN_ALT to $RES_IP_ALT."
 else
diff --git a/src/gns/test_gns_gns2dns_zkey_lookup.sh 
b/src/gns/test_gns_gns2dns_zkey_lookup.sh
index 1f8e34c42..c5a7fe4a0 100755
--- a/src/gns/test_gns_gns2dns_zkey_lookup.sh
+++ b/src/gns/test_gns_gns2dns_zkey_lookup.sh
@@ -17,9 +17,11 @@ rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o 
GNUNET_TEST_HOME`
 # IP address of 'docs.gnunet.org'
 TEST_IP_ALT2="147.87.255.218"
 # IP address of 'www.gnunet.org'
-TEST_IP="131.159.74.67"
+TEST_IP="147.87.255.218"
+# IP address of 'www.gnunet.org'
+TEST_IP_ALT="131.159.74.67"
 # IPv6 address of 'gnunet.org'
-TEST_IP6="2001:4ca0:2001:42:225:90ff:fe6b:d60"
+TEST_IP6="2a07:6b47:100:464::9357:ffdb"
 # permissive DNS resolver we will use for the test
 TEST_IP_GNS2DNS="8.8.8.8"
 
@@ -46,7 +48,7 @@ which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 15"
 
 gnunet-arm -s -c test_gns_lookup.conf
 
-OUT=`$DO_TIMEOUT gnunet-resolver -c test_gns_lookup.conf gnunet.org`
+OUT=`$DO_TIMEOUT gnunet-resolver -c test_gns_lookup.conf www.gnunet.org`
 echo $OUT | grep $TEST_IP - > /dev/null || { gnunet-arm -e -c 
test_gns_lookup.conf ; echo "IPv4 for gnunet.org not found ($OUT), skipping 
test"; exit 77; }
 echo $OUT | grep $TEST_IP6 - > /dev/null || { gnunet-arm -e -c 
test_gns_lookup.conf ; echo "IPv6 for gnunet.org not found ($OUT), skipping 
test"; exit 77; }
 
@@ -66,7 +68,7 @@ gnunet-namestore -p -z $MY_EGO -a -n $TEST_RECORD_NAME -t 
GNS2DNS -V $TEST_RECOR
 # lookup 'www.gnunet.org', IPv4
 RES_IP=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN -t A -c 
test_gns_lookup.conf`
 # lookup 'www.gnunet.org', IPv6
-RES_IP6=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN -t AAAA -c 
test_gns_lookup.conf`
+RES_IP6=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN -t AAAA -c 
test_gns_lookup.conf | head -n1`
 # lookup 'gnunet.org', IPv4
 RES_IP_ALT=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN_ALT -t A -c 
test_gns_lookup.conf`
 # lookup 'docs.gnunet.org', IPv4
@@ -96,7 +98,7 @@ else
   ret=1
 fi
 
-if echo "$RES_IP_ALT" | grep "$TEST_IP" > /dev/null
+if echo "$RES_IP_ALT" | grep "$TEST_IP_ALT" > /dev/null
 then
   echo "PASS: Resolved $TEST_DOMAIN_ALT to $RES_IP_ALT."
 else
diff --git a/src/namestore/gnunet-service-namestore.c 
b/src/namestore/gnunet-service-namestore.c
index 8c93b9a0d..c3482cd6a 100644
--- a/src/namestore/gnunet-service-namestore.c
+++ b/src/namestore/gnunet-service-namestore.c
@@ -918,21 +918,32 @@ refresh_block (struct NamestoreClient *nc,
                const struct GNUNET_GNSRECORD_Data *rd)
 {
   struct GNUNET_GNSRECORD_Block *block;
+  struct GNUNET_GNSRECORD_Data rd_clean[rd_count];
   struct CacheOperation *cop;
   struct GNUNET_IDENTITY_PublicKey pkey;
   struct GNUNET_GNSRECORD_Data *nick;
   struct GNUNET_GNSRECORD_Data *res;
   unsigned int res_count;
+  unsigned int rd_count_clean;
   struct GNUNET_TIME_Absolute exp_time;
 
+  /** Do not block-cache tombstones */
+  rd_count_clean = 0;
+  for (int i = 0; i < rd_count; i++)
+  {
+    if (GNUNET_GNSRECORD_TYPE_TOMBSTONE == rd[i].record_type)
+      continue;
+    rd_clean[rd_count_clean++] = rd[i];
+  }
+
   nick = get_nick_record (zone_key);
-  res_count = rd_count;
-  res = (struct GNUNET_GNSRECORD_Data *) rd;  /* fixme: a bit unclean... */
+  res_count = rd_count_clean;
+  res = (struct GNUNET_GNSRECORD_Data *) rd_clean;  /* fixme: a bit unclean... 
*/
   if ((NULL != nick) && (0 != strcmp (name, GNUNET_GNS_EMPTY_LABEL_AT)))
   {
     nick->flags =
       (nick->flags | GNUNET_GNSRECORD_RF_PRIVATE) ^ 
GNUNET_GNSRECORD_RF_PRIVATE;
-    merge_with_nick_records (nick, rd_count, rd, &res_count, &res);
+    merge_with_nick_records (nick, rd_count_clean, rd_clean, &res_count, &res);
   }
   if (NULL != nick)
     GNUNET_free (nick);
@@ -940,7 +951,7 @@ refresh_block (struct NamestoreClient *nc,
   {
     if (NULL != nc)
       send_store_response (nc, GNUNET_OK, NULL, rid);
-    if (rd != res)
+    if (rd_clean != res)
       GNUNET_free (res);
     return;   /* no data, no need to update cache */
   }
@@ -952,7 +963,7 @@ refresh_block (struct NamestoreClient *nc,
                               GNUNET_NO);
     if (NULL != nc)
       send_store_response (nc, GNUNET_OK, NULL, rid);
-    if (rd != res)
+    if (rd_clean != res)
       GNUNET_free (res);
     return;
   }
@@ -991,7 +1002,7 @@ refresh_block (struct NamestoreClient *nc,
                                           &finish_cache_operation,
                                           cop);
   GNUNET_free (block);
-  if (rd != res)
+  if (rd_clean != res)
     GNUNET_free (res);
 }
 

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]