aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/gns/test_gns_gns2dns_cname_lookup.sh9
-rwxr-xr-xsrc/gns/test_gns_gns2dns_lookup.sh12
-rwxr-xr-xsrc/gns/test_gns_gns2dns_zkey_lookup.sh12
-rw-r--r--src/namestore/gnunet-service-namestore.c23
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
16 16
17rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` 17rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME`
18# IP address of 'www.gnunet.org' 18# IP address of 'www.gnunet.org'
19TEST_IP="131.159.74.67" 19TEST_IP="147.87.255.218"
20# IP address of 'gnunet.org'
21TEST_IPALT="131.159.74.67"
20# IPv6 address of 'gnunet.org' 22# IPv6 address of 'gnunet.org'
21TEST_IP6="2001:4ca0:2001:42:225:90ff:fe6b:d60" 23TEST_IP6="2a07:6b47:100:464::9357:ffdb"
22 24
23# main label used during resolution 25# main label used during resolution
24TEST_RECORD_NAME="homepage" 26TEST_RECORD_NAME="homepage"
@@ -46,7 +48,7 @@ TEST_DOMAIN="www.${TEST_RECORD_NAME}.$MY_EGO"
46which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 15" 48which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 15"
47 49
48gnunet-arm -s -c test_gns_lookup.conf 50gnunet-arm -s -c test_gns_lookup.conf
49OUT=`$DO_TIMEOUT gnunet-resolver -c test_gns_lookup.conf gnunet.org` 51OUT=`$DO_TIMEOUT gnunet-resolver -c test_gns_lookup.conf www.gnunet.org`
50echo $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; } 52echo $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; }
51echo $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; } 53echo $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; }
52 54
@@ -59,6 +61,7 @@ gnunet-namestore -p -z $MY_EGO -a -n $TEST_RECORD_NAME -t GNS2DNS -V $TEST_RECOR
59gnunet-namestore -p -z $MY_EGO -a -n $TEST_RECORD_NAME -t GNS2DNS -V $TEST_RECORD_GNS2DNS2 -e never -c test_gns_lookup.conf 61gnunet-namestore -p -z $MY_EGO -a -n $TEST_RECORD_NAME -t GNS2DNS -V $TEST_RECORD_GNS2DNS2 -e never -c test_gns_lookup.conf
60gnunet-namestore -p -z $MY_EGO -a -n $TEST_RECORD_NAME -t GNS2DNS -V $TEST_RECORD_GNS2DNS3 -e never -c test_gns_lookup.conf 62gnunet-namestore -p -z $MY_EGO -a -n $TEST_RECORD_NAME -t GNS2DNS -V $TEST_RECORD_GNS2DNS3 -e never -c test_gns_lookup.conf
61 63
64gnunet-namestore -z $MY_EGO -D -c test_gns_lookup.conf
62 65
63echo "EGOs:" 66echo "EGOs:"
64gnunet-identity -d 67gnunet-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`
17# IP address of 'docs.gnunet.org' 17# IP address of 'docs.gnunet.org'
18TEST_IP_ALT2="147.87.255.218" 18TEST_IP_ALT2="147.87.255.218"
19# IP address of 'www.gnunet.org' 19# IP address of 'www.gnunet.org'
20TEST_IP="131.159.74.67" 20TEST_IP="147.87.255.218"
21# IP address of 'gnunet.org'
22TEST_IP_ALT="131.159.74.67"
21# IPv6 address of 'gnunet.org' 23# IPv6 address of 'gnunet.org'
22TEST_IP6="2001:4ca0:2001:42:225:90ff:fe6b:d60" 24TEST_IP6="2a07:6b47:100:464::9357:ffdb"
23# permissive DNS resolver we will use for the test 25# permissive DNS resolver we will use for the test
24TEST_IP_GNS2DNS="8.8.8.8" 26TEST_IP_GNS2DNS="8.8.8.8"
25 27
@@ -49,7 +51,7 @@ which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 15"
49 51
50gnunet-arm -s -c test_gns_lookup.conf 52gnunet-arm -s -c test_gns_lookup.conf
51 53
52OUT=`$DO_TIMEOUT gnunet-resolver -c test_gns_lookup.conf gnunet.org` 54OUT=`$DO_TIMEOUT gnunet-resolver -c test_gns_lookup.conf www.gnunet.org`
53echo $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; } 55echo $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; }
54echo $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; } 56echo $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; }
55 57
@@ -69,7 +71,7 @@ gnunet-identity -d
69# lookup 'www.gnunet.org', IPv4 71# lookup 'www.gnunet.org', IPv4
70RES_IP=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN -t A -c test_gns_lookup.conf` 72RES_IP=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN -t A -c test_gns_lookup.conf`
71# lookup 'www.gnunet.org', IPv6 73# lookup 'www.gnunet.org', IPv6
72RES_IP6=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN -t AAAA -c test_gns_lookup.conf` 74RES_IP6=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN -t AAAA -c test_gns_lookup.conf | head -n1`
73# lookup 'gnunet.org', IPv4 75# lookup 'gnunet.org', IPv4
74RES_IP_ALT=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN_ALT -t A -c test_gns_lookup.conf` 76RES_IP_ALT=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN_ALT -t A -c test_gns_lookup.conf`
75# lookup 'docs.gnunet.org', IPv4 77# lookup 'docs.gnunet.org', IPv4
@@ -99,7 +101,7 @@ else
99 ret=1 101 ret=1
100fi 102fi
101 103
102if echo "$RES_IP_ALT" | grep "$TEST_IP" > /dev/null 104if echo "$RES_IP_ALT" | grep "$TEST_IP_ALT" > /dev/null
103then 105then
104 echo "PASS: Resolved $TEST_DOMAIN_ALT to $RES_IP_ALT." 106 echo "PASS: Resolved $TEST_DOMAIN_ALT to $RES_IP_ALT."
105else 107else
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`
17# IP address of 'docs.gnunet.org' 17# IP address of 'docs.gnunet.org'
18TEST_IP_ALT2="147.87.255.218" 18TEST_IP_ALT2="147.87.255.218"
19# IP address of 'www.gnunet.org' 19# IP address of 'www.gnunet.org'
20TEST_IP="131.159.74.67" 20TEST_IP="147.87.255.218"
21# IP address of 'www.gnunet.org'
22TEST_IP_ALT="131.159.74.67"
21# IPv6 address of 'gnunet.org' 23# IPv6 address of 'gnunet.org'
22TEST_IP6="2001:4ca0:2001:42:225:90ff:fe6b:d60" 24TEST_IP6="2a07:6b47:100:464::9357:ffdb"
23# permissive DNS resolver we will use for the test 25# permissive DNS resolver we will use for the test
24TEST_IP_GNS2DNS="8.8.8.8" 26TEST_IP_GNS2DNS="8.8.8.8"
25 27
@@ -46,7 +48,7 @@ which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 15"
46 48
47gnunet-arm -s -c test_gns_lookup.conf 49gnunet-arm -s -c test_gns_lookup.conf
48 50
49OUT=`$DO_TIMEOUT gnunet-resolver -c test_gns_lookup.conf gnunet.org` 51OUT=`$DO_TIMEOUT gnunet-resolver -c test_gns_lookup.conf www.gnunet.org`
50echo $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; } 52echo $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; }
51echo $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; } 53echo $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; }
52 54
@@ -66,7 +68,7 @@ gnunet-namestore -p -z $MY_EGO -a -n $TEST_RECORD_NAME -t GNS2DNS -V $TEST_RECOR
66# lookup 'www.gnunet.org', IPv4 68# lookup 'www.gnunet.org', IPv4
67RES_IP=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN -t A -c test_gns_lookup.conf` 69RES_IP=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN -t A -c test_gns_lookup.conf`
68# lookup 'www.gnunet.org', IPv6 70# lookup 'www.gnunet.org', IPv6
69RES_IP6=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN -t AAAA -c test_gns_lookup.conf` 71RES_IP6=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN -t AAAA -c test_gns_lookup.conf | head -n1`
70# lookup 'gnunet.org', IPv4 72# lookup 'gnunet.org', IPv4
71RES_IP_ALT=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN_ALT -t A -c test_gns_lookup.conf` 73RES_IP_ALT=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN_ALT -t A -c test_gns_lookup.conf`
72# lookup 'docs.gnunet.org', IPv4 74# lookup 'docs.gnunet.org', IPv4
@@ -96,7 +98,7 @@ else
96 ret=1 98 ret=1
97fi 99fi
98 100
99if echo "$RES_IP_ALT" | grep "$TEST_IP" > /dev/null 101if echo "$RES_IP_ALT" | grep "$TEST_IP_ALT" > /dev/null
100then 102then
101 echo "PASS: Resolved $TEST_DOMAIN_ALT to $RES_IP_ALT." 103 echo "PASS: Resolved $TEST_DOMAIN_ALT to $RES_IP_ALT."
102else 104else
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,
918 const struct GNUNET_GNSRECORD_Data *rd) 918 const struct GNUNET_GNSRECORD_Data *rd)
919{ 919{
920 struct GNUNET_GNSRECORD_Block *block; 920 struct GNUNET_GNSRECORD_Block *block;
921 struct GNUNET_GNSRECORD_Data rd_clean[rd_count];
921 struct CacheOperation *cop; 922 struct CacheOperation *cop;
922 struct GNUNET_IDENTITY_PublicKey pkey; 923 struct GNUNET_IDENTITY_PublicKey pkey;
923 struct GNUNET_GNSRECORD_Data *nick; 924 struct GNUNET_GNSRECORD_Data *nick;
924 struct GNUNET_GNSRECORD_Data *res; 925 struct GNUNET_GNSRECORD_Data *res;
925 unsigned int res_count; 926 unsigned int res_count;
927 unsigned int rd_count_clean;
926 struct GNUNET_TIME_Absolute exp_time; 928 struct GNUNET_TIME_Absolute exp_time;
927 929
930 /** Do not block-cache tombstones */
931 rd_count_clean = 0;
932 for (int i = 0; i < rd_count; i++)
933 {
934 if (GNUNET_GNSRECORD_TYPE_TOMBSTONE == rd[i].record_type)
935 continue;
936 rd_clean[rd_count_clean++] = rd[i];
937 }
938
928 nick = get_nick_record (zone_key); 939 nick = get_nick_record (zone_key);
929 res_count = rd_count; 940 res_count = rd_count_clean;
930 res = (struct GNUNET_GNSRECORD_Data *) rd; /* fixme: a bit unclean... */ 941 res = (struct GNUNET_GNSRECORD_Data *) rd_clean; /* fixme: a bit unclean... */
931 if ((NULL != nick) && (0 != strcmp (name, GNUNET_GNS_EMPTY_LABEL_AT))) 942 if ((NULL != nick) && (0 != strcmp (name, GNUNET_GNS_EMPTY_LABEL_AT)))
932 { 943 {
933 nick->flags = 944 nick->flags =
934 (nick->flags | GNUNET_GNSRECORD_RF_PRIVATE) ^ GNUNET_GNSRECORD_RF_PRIVATE; 945 (nick->flags | GNUNET_GNSRECORD_RF_PRIVATE) ^ GNUNET_GNSRECORD_RF_PRIVATE;
935 merge_with_nick_records (nick, rd_count, rd, &res_count, &res); 946 merge_with_nick_records (nick, rd_count_clean, rd_clean, &res_count, &res);
936 } 947 }
937 if (NULL != nick) 948 if (NULL != nick)
938 GNUNET_free (nick); 949 GNUNET_free (nick);
@@ -940,7 +951,7 @@ refresh_block (struct NamestoreClient *nc,
940 { 951 {
941 if (NULL != nc) 952 if (NULL != nc)
942 send_store_response (nc, GNUNET_OK, NULL, rid); 953 send_store_response (nc, GNUNET_OK, NULL, rid);
943 if (rd != res) 954 if (rd_clean != res)
944 GNUNET_free (res); 955 GNUNET_free (res);
945 return; /* no data, no need to update cache */ 956 return; /* no data, no need to update cache */
946 } 957 }
@@ -952,7 +963,7 @@ refresh_block (struct NamestoreClient *nc,
952 GNUNET_NO); 963 GNUNET_NO);
953 if (NULL != nc) 964 if (NULL != nc)
954 send_store_response (nc, GNUNET_OK, NULL, rid); 965 send_store_response (nc, GNUNET_OK, NULL, rid);
955 if (rd != res) 966 if (rd_clean != res)
956 GNUNET_free (res); 967 GNUNET_free (res);
957 return; 968 return;
958 } 969 }
@@ -991,7 +1002,7 @@ refresh_block (struct NamestoreClient *nc,
991 &finish_cache_operation, 1002 &finish_cache_operation,
992 cop); 1003 cop);
993 GNUNET_free (block); 1004 GNUNET_free (block);
994 if (rd != res) 1005 if (rd_clean != res)
995 GNUNET_free (res); 1006 GNUNET_free (res);
996} 1007}
997 1008