aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSchanzenbach, Martin <mschanzenbach@posteo.de>2017-08-03 19:21:28 +0900
committerSchanzenbach, Martin <mschanzenbach@posteo.de>2017-08-03 19:21:28 +0900
commit02c92c69ab4193b81ac6f90b52fecb40b94b9208 (patch)
tree0cbbfc249451abd23b238a811f42015df95bbe2a
parentb6755fe23d258a4dc971d8fabc3fae1873e31271 (diff)
parent6bcc73a1cbb1d4a609884762eab1b6de761ad1d9 (diff)
downloadgnunet-02c92c69ab4193b81ac6f90b52fecb40b94b9208.tar.gz
gnunet-02c92c69ab4193b81ac6f90b52fecb40b94b9208.zip
Merge remote-tracking branch 'origin/master' into identity_abe
-rw-r--r--configure.ac47
-rw-r--r--src/fs/gnunet-search.c2
-rwxr-xr-xsrc/fs/test_gnunet_fs_psd.py.in6
-rw-r--r--src/gns/Makefile.am2
-rw-r--r--src/gns/nss/Makefile.am26
-rwxr-xr-xsrc/gns/nss/install-nss-plugin.sh8
-rwxr-xr-xsrc/gns/nss/uninstall-nss-plugin.sh8
-rw-r--r--src/include/gnunet_common.h15
-rw-r--r--src/multicast/Makefile.am17
-rw-r--r--src/multicast/gnunet-service-multicast.c24
-rw-r--r--src/multicast/test_multicast.conf11
-rw-r--r--src/multicast/test_multicast_line.conf63
-rw-r--r--src/multicast/test_multicast_multipeer.c195
-rw-r--r--src/multicast/test_multicast_star.conf64
-rw-r--r--src/util/Makefile.am8
-rw-r--r--src/util/common_logging.c21
-rw-r--r--src/util/resolver_api.c85
17 files changed, 373 insertions, 229 deletions
diff --git a/configure.ac b/configure.ac
index bfde625d2..027724774 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1137,45 +1137,6 @@ AC_SUBST(SUDO_BINARY)
1137AM_CONDITIONAL([HAVE_SUDO], [test "x$SUDO_BINARY" != "x" -o -w /]) 1137AM_CONDITIONAL([HAVE_SUDO], [test "x$SUDO_BINARY" != "x" -o -w /])
1138 1138
1139 1139
1140# test for nssdir
1141AC_MSG_CHECKING(with nssdir)
1142AC_ARG_WITH(nssdir,
1143 [ --with-nssdir=PATH where to install NSS plugins],
1144 [AC_MSG_RESULT("$with_nssdir")
1145 case $with_nssdir in
1146 no)
1147 NSS_DIR=
1148 install_nss=0
1149 ;;
1150 yes)
1151 NSS_DIR="/lib"
1152 install_nss=1
1153 ;;
1154 *)
1155 NSS_DIR=$with_nssdir
1156 install_nss=1
1157 ;;
1158 esac
1159 ],
1160 [
1161# This test is inappropriate when installation with DESTDIR is
1162# run much later and uid will be root when needed. Enabling this
1163# code breaks the gnunet.ebuild for gentoo.
1164#
1165# if test "x$SUDO_BINARY" != "x" -o -w /
1166# then
1167 NSS_DIR="/lib"
1168 install_nss=1
1169 AC_MSG_RESULT([yes, to /lib])
1170# else
1171# NSS_DIR=
1172# install_nss=0
1173# AC_MSG_RESULT([no])
1174# fi
1175 ])
1176AC_SUBST(NSS_DIR)
1177AM_CONDITIONAL([INSTALL_NSS], [test "x$install_nss" != "x0"])
1178
1179# test for gnunetdns group name 1140# test for gnunetdns group name
1180GNUNETDNS_GROUP=gnunetdns 1141GNUNETDNS_GROUP=gnunetdns
1181AC_MSG_CHECKING(for gnunetdns group name) 1142AC_MSG_CHECKING(for gnunetdns group name)
@@ -1816,14 +1777,6 @@ then
1816 AC_MSG_NOTICE([Mac OS X framework build enabled.]) 1777 AC_MSG_NOTICE([Mac OS X framework build enabled.])
1817fi 1778fi
1818 1779
1819if test "x$install_nss" = "x0"
1820then
1821 AC_MSG_NOTICE([WARNING: Will not install GNS NSS library])
1822else
1823 AC_MSG_NOTICE([NOTICE: Will install GNS NSS library to $NSS_DIR])
1824fi
1825
1826
1827AC_MSG_NOTICE([******************************************** 1780AC_MSG_NOTICE([********************************************
1828Please make sure NOW that you have created a user and group 'gnunet' 1781Please make sure NOW that you have created a user and group 'gnunet'
1829and additionally a group 'gnunetdns'. On Debian and Ubuntu GNU/Linux, type: 1782and additionally a group 'gnunetdns'. On Debian and Ubuntu GNU/Linux, type:
diff --git a/src/fs/gnunet-search.c b/src/fs/gnunet-search.c
index ef1743436..89811669f 100644
--- a/src/fs/gnunet-search.c
+++ b/src/fs/gnunet-search.c
@@ -164,7 +164,7 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info)
164 info->value.search.specifics.result.meta, 164 info->value.search.specifics.result.meta,
165 NULL); 165 NULL);
166 uri = GNUNET_FS_uri_to_string (info->value.search.specifics.result.uri); 166 uri = GNUNET_FS_uri_to_string (info->value.search.specifics.result.uri);
167 printf ("#%u:\n", cnt++); 167 printf ("#%u:\n", ++cnt);
168 filename = 168 filename =
169 GNUNET_CONTAINER_meta_data_get_by_type (info->value.search. 169 GNUNET_CONTAINER_meta_data_get_by_type (info->value.search.
170 specifics.result.meta, 170 specifics.result.meta,
diff --git a/src/fs/test_gnunet_fs_psd.py.in b/src/fs/test_gnunet_fs_psd.py.in
index 2efac58ae..87fcf1130 100755
--- a/src/fs/test_gnunet_fs_psd.py.in
+++ b/src/fs/test_gnunet_fs_psd.py.in
@@ -24,6 +24,11 @@ import subprocess
24import re 24import re
25import shutil 25import shutil
26 26
27# Force encoding to utf-8, as this test otherwise fails
28# on some systems (see #5094).
29reload(sys)
30sys.setdefaultencoding('utf8')
31
27srcdir = "../.." 32srcdir = "../.."
28gnunet_pyexpect_dir = os.path.join (srcdir, "contrib") 33gnunet_pyexpect_dir = os.path.join (srcdir, "contrib")
29if gnunet_pyexpect_dir not in sys.path: 34if gnunet_pyexpect_dir not in sys.path:
@@ -62,7 +67,6 @@ try:
62 s = pexpect () 67 s = pexpect ()
63 s.spawn (None, [search, '-V', '-t', '1000 ms', '-N', '1', '-c', 'test_gnunet_fs_psd_data.conf', 'tst'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 68 s.spawn (None, [search, '-V', '-t', '1000 ms', '-N', '1', '-c', 'test_gnunet_fs_psd_data.conf', 'tst'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
64 s.expect ("stdout", re.compile (r'gnunet-download -o "test_gnunet_fs_rec_data.tgz" gnunet://fs/chk/2ZMHKPV74CB6GB1GFKQRR95BXJQA2SER25FN48GAW7WSBPA0GDEM5Y74V1ZJHM0NA6919TVW376BHTFDRE3RYS0KRY92M1QJVKPHFCR\.49BT3V5C10KA1695JF71FCT8ZZG4JMJSH04BD9CT22R6KEM915A7CEST17RD0QYTHXV5M4HHEGJMEZSFRDB7JAYC0EMJAN2V781E9DG\.17822\r?\n')) 69 s.expect ("stdout", re.compile (r'gnunet-download -o "test_gnunet_fs_rec_data.tgz" gnunet://fs/chk/2ZMHKPV74CB6GB1GFKQRR95BXJQA2SER25FN48GAW7WSBPA0GDEM5Y74V1ZJHM0NA6919TVW376BHTFDRE3RYS0KRY92M1QJVKPHFCR\.49BT3V5C10KA1695JF71FCT8ZZG4JMJSH04BD9CT22R6KEM915A7CEST17RD0QYTHXV5M4HHEGJMEZSFRDB7JAYC0EMJAN2V781E9DG\.17822\r?\n'))
65 s.expect ("stdout", re.compile (r"\s*description: Test archive\r?\n"))
66 70
67 down = pexpect () 71 down = pexpect ()
68 down.spawn (None, [download, '-c', 'test_gnunet_fs_psd_data.conf', '-o', 'test_gnunet_fs_rec_data.tar.gz', 'gnunet://fs/chk/2ZMHKPV74CB6GB1GFKQRR95BXJQA2SER25FN48GAW7WSBPA0GDEM5Y74V1ZJHM0NA6919TVW376BHTFDRE3RYS0KRY92M1QJVKPHFCR.49BT3V5C10KA1695JF71FCT8ZZG4JMJSH04BD9CT22R6KEM915A7CEST17RD0QYTHXV5M4HHEGJMEZSFRDB7JAYC0EMJAN2V781E9DG.17822'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 72 down.spawn (None, [download, '-c', 'test_gnunet_fs_psd_data.conf', '-o', 'test_gnunet_fs_rec_data.tar.gz', 'gnunet://fs/chk/2ZMHKPV74CB6GB1GFKQRR95BXJQA2SER25FN48GAW7WSBPA0GDEM5Y74V1ZJHM0NA6919TVW376BHTFDRE3RYS0KRY92M1QJVKPHFCR.49BT3V5C10KA1695JF71FCT8ZZG4JMJSH04BD9CT22R6KEM915A7CEST17RD0QYTHXV5M4HHEGJMEZSFRDB7JAYC0EMJAN2V781E9DG.17822'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
diff --git a/src/gns/Makefile.am b/src/gns/Makefile.am
index 464bbbca1..977eb87e3 100644
--- a/src/gns/Makefile.am
+++ b/src/gns/Makefile.am
@@ -2,10 +2,8 @@
2AM_CPPFLAGS = -I$(top_srcdir)/src/include 2AM_CPPFLAGS = -I$(top_srcdir)/src/include
3 3
4if HAVE_GLIBCNSS 4if HAVE_GLIBCNSS
5if INSTALL_NSS
6NSS_SUBDIR = nss 5NSS_SUBDIR = nss
7endif 6endif
8endif
9 7
10SUBDIRS = . $(NSS_SUBDIR) 8SUBDIRS = . $(NSS_SUBDIR)
11 9
diff --git a/src/gns/nss/Makefile.am b/src/gns/nss/Makefile.am
index 2551b9562..5d42f777f 100644
--- a/src/gns/nss/Makefile.am
+++ b/src/gns/nss/Makefile.am
@@ -18,28 +18,17 @@
18# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 18# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19# USA. 19# USA.
20 20
21EXTRA_DIST = map-file \ 21EXTRA_DIST = map-file
22 install-nss-plugin.sh \
23 uninstall-nss-plugin.sh
24 22
25AM_LDFLAGS=-avoid-version -module -export-dynamic 23AM_LDFLAGS=-avoid-version -module -export-dynamic
26 24
27nssdir = $(NSS_DIR) 25nssdir = $(libdir)/gnunet/nss
28
29LIBTOOL = $(LIBTOOL_SUDO_BINARY) $(SHELL) $(top_builddir)/libtool
30 26
31if !MINGW 27if !MINGW
32if INSTALL_NSS
33nss_LTLIBRARIES = \ 28nss_LTLIBRARIES = \
34 libnss_gns.la \ 29 libnss_gns.la \
35 libnss_gns4.la \ 30 libnss_gns4.la \
36 libnss_gns6.la 31 libnss_gns6.la
37
38install-nssLTLIBRARIES:
39 LIBTOOL_SUDO_BINARY=$(SUDO_BINARY)
40uninstall-nssLTLIBRARIES:
41 LIBTOOL_SUDO_BINARY=$(SUDO_BINARY)
42endif
43endif 32endif
44 33
45sources = nss_gns_query.h nss_gns_query.c 34sources = nss_gns_query.h nss_gns_query.c
@@ -57,14 +46,3 @@ libnss_gns6_la_SOURCES=$(libnss_gns_la_SOURCES)
57libnss_gns6_la_CFLAGS=$(libnss_gns_la_CFLAGS) -DNSS_IPV6_ONLY=1 46libnss_gns6_la_CFLAGS=$(libnss_gns_la_CFLAGS) -DNSS_IPV6_ONLY=1
58libnss_gns6_la_LDFLAGS=$(libnss_gns_la_LDFLAGS) 47libnss_gns6_la_LDFLAGS=$(libnss_gns_la_LDFLAGS)
59 48
60if INSTALL_NSS
61if !MINGW
62install-data-hook:
63 $(top_srcdir)/src/gns/nss/install-nss-plugin.sh $(SHELL) $(top_builddir) $(DESTDIR)$(nssdir) $(SUDO_BINARY)
64
65uninstall-hook:
66 $(top_srcdir)/src/gns/nss/uninstall-nss-plugin.sh $(SHELL) $(top_builddir) "rm -f $(nssdir)/libnss_gns.so.2" $(SUDO_BINARY)
67 $(top_srcdir)/src/gns/nss/uninstall-nss-plugin.sh $(SHELL) $(top_builddir) "rm -f $(nssdir)/libnss_gns4.so.2" $(SUDO_BINARY)
68 $(top_srcdir)/src/gns/nss/uninstall-nss-plugin.sh $(SHELL) $(top_builddir) "rm -f $(nssdir)/libnss_gns6.so.2" $(SUDO_BINARY)
69endif
70endif
diff --git a/src/gns/nss/install-nss-plugin.sh b/src/gns/nss/install-nss-plugin.sh
deleted file mode 100755
index 1aab8ca69..000000000
--- a/src/gns/nss/install-nss-plugin.sh
+++ /dev/null
@@ -1,8 +0,0 @@
1#!/bin/sh
2# $1 - shell
3# $2 - top_builddir
4# $3 - nssdir
5# $4 - sudo binary (empty if root)
6$4 $1 $2/libtool --mode=finish $3
7echo LTINST: $4 $1 $2/libtool --mode=finish $3
8$4 rm -f $3/libnss_gns.la $3/libnss_gns4.la $3/libnss_gns6.la
diff --git a/src/gns/nss/uninstall-nss-plugin.sh b/src/gns/nss/uninstall-nss-plugin.sh
deleted file mode 100755
index 3d8cec110..000000000
--- a/src/gns/nss/uninstall-nss-plugin.sh
+++ /dev/null
@@ -1,8 +0,0 @@
1#!/bin/sh
2# $1 - shell
3# $2 - top_builddir
4# $3 - nssdir+path of library to remove
5# $4 - sudo binary (empty if root)
6$4 $1 $2/libtool --mode=uninstall $3
7
8
diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h
index bda011fb2..d7f7b76ff 100644
--- a/src/include/gnunet_common.h
+++ b/src/include/gnunet_common.h
@@ -585,6 +585,21 @@ GNUNET_h2s (const struct GNUNET_HashCode * hc);
585/** 585/**
586 * @ingroup logging 586 * @ingroup logging
587 * Convert a hash value to a string (for printing debug messages). 587 * Convert a hash value to a string (for printing debug messages).
588 * This is one of the very few calls in the entire API that is
589 * NOT reentrant! Identical to #GNUNET_h2s(), except that another
590 * buffer is used so both #GNUNET_h2s() and #GNUNET_h2s2() can be
591 * used within the same log statement.
592 *
593 * @param hc the hash code
594 * @return string
595 */
596const char *
597GNUNET_h2s2 (const struct GNUNET_HashCode * hc);
598
599
600/**
601 * @ingroup logging
602 * Convert a hash value to a string (for printing debug messages).
588 * This prints all 104 characters of a hashcode! 603 * This prints all 104 characters of a hashcode!
589 * This is one of the very few calls in the entire API that is 604 * This is one of the very few calls in the entire API that is
590 * NOT reentrant! 605 * NOT reentrant!
diff --git a/src/multicast/Makefile.am b/src/multicast/Makefile.am
index a680a9d5a..13212bca3 100644
--- a/src/multicast/Makefile.am
+++ b/src/multicast/Makefile.am
@@ -50,13 +50,13 @@ gnunet_service_multicast_LDADD = \
50 $(GN_LIBINTL) 50 $(GN_LIBINTL)
51 51
52check_PROGRAMS = \ 52check_PROGRAMS = \
53 test_multicast_multipeer 53 test_multicast \
54# test_multicast 54 test_multicast_multipeer_star \
55 test_multicast_multipeer_line
55# test_multicast_2peers 56# test_multicast_2peers
56 57
57if ENABLE_TEST_RUN 58if ENABLE_TEST_RUN
58AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@}; export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH; unset XDG_DATA_HOME; unset XDG_CONFIG_HOME; 59AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@}; export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH; unset XDG_DATA_HOME; unset XDG_CONFIG_HOME;
59#AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@}; export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH; unset XDG_DATA_HOME; unset XDG_CONFIG_HOME; export GNUNET_FORCE_LOG=';;;;INFO';
60TESTS = $(check_PROGRAMS) 60TESTS = $(check_PROGRAMS)
61endif 61endif
62 62
@@ -66,10 +66,15 @@ test_multicast_LDADD = \
66 libgnunetmulticast.la \ 66 libgnunetmulticast.la \
67 $(top_builddir)/src/testing/libgnunettesting.la \ 67 $(top_builddir)/src/testing/libgnunettesting.la \
68 $(top_builddir)/src/util/libgnunetutil.la 68 $(top_builddir)/src/util/libgnunetutil.la
69 69test_multicast_multipeer_star_SOURCES = \
70test_multicast_multipeer_SOURCES = \ 70 test_multicast_multipeer.c
71test_multicast_multipeer_star_LDADD = \
72 libgnunetmulticast.la \
73 $(top_builddir)/src/testbed/libgnunettestbed.la \
74 $(top_builddir)/src/util/libgnunetutil.la
75test_multicast_multipeer_line_SOURCES = \
71 test_multicast_multipeer.c 76 test_multicast_multipeer.c
72test_multicast_multipeer_LDADD = \ 77test_multicast_multipeer_line_LDADD = \
73 libgnunetmulticast.la \ 78 libgnunetmulticast.la \
74 $(top_builddir)/src/testbed/libgnunettestbed.la \ 79 $(top_builddir)/src/testbed/libgnunettestbed.la \
75 $(top_builddir)/src/util/libgnunetutil.la 80 $(top_builddir)/src/util/libgnunetutil.la
diff --git a/src/multicast/gnunet-service-multicast.c b/src/multicast/gnunet-service-multicast.c
index 39623e7b1..2f4dc8a14 100644
--- a/src/multicast/gnunet-service-multicast.c
+++ b/src/multicast/gnunet-service-multicast.c
@@ -767,10 +767,11 @@ cadet_send_join_decision_cb (void *cls,
767 { 767 {
768 chn->join_status = JOIN_REFUSED; 768 chn->join_status = JOIN_REFUSED;
769 } 769 }
770
771 cadet_send_channel (chn, &hdcsn->header); 770 cadet_send_channel (chn, &hdcsn->header);
772 return GNUNET_NO; 771 return GNUNET_YES;
773 } 772 }
773
774 // return GNUNET_YES to continue the multihashmap_get iteration
774 return GNUNET_YES; 775 return GNUNET_YES;
775} 776}
776 777
@@ -845,13 +846,13 @@ cadet_notify_connect (void *cls,
845 struct GNUNET_CADET_Channel *channel, 846 struct GNUNET_CADET_Channel *channel,
846 const struct GNUNET_PeerIdentity *source) 847 const struct GNUNET_PeerIdentity *source)
847{ 848{
848 struct Channel *chn = GNUNET_malloc (sizeof *chn); 849 struct Channel *chn = GNUNET_malloc (sizeof (struct Channel));
849 chn->group = cls; 850 chn->group = cls;
850 chn->channel = channel; 851 chn->channel = channel;
851 chn->direction = DIR_INCOMING; 852 chn->direction = DIR_INCOMING;
852 chn->join_status = JOIN_NOT_ASKED; 853 chn->join_status = JOIN_NOT_ASKED;
853 854
854 GNUNET_CONTAINER_multihashmap_put (channels_in, &chn->group_pub_hash, chn, 855 GNUNET_CONTAINER_multihashmap_put (channels_in, &chn->group->pub_key_hash, chn,
855 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); 856 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
856 return chn; 857 return chn;
857} 858}
@@ -1395,7 +1396,7 @@ handle_client_origin_start (void *cls,
1395 orig->cadet_port = GNUNET_CADET_open_port (cadet, 1396 orig->cadet_port = GNUNET_CADET_open_port (cadet,
1396 &grp->cadet_port_hash, 1397 &grp->cadet_port_hash,
1397 cadet_notify_connect, 1398 cadet_notify_connect,
1398 NULL, 1399 grp,
1399 cadet_notify_window_change, 1400 cadet_notify_window_change,
1400 cadet_notify_disconnect, 1401 cadet_notify_disconnect,
1401 cadet_handlers); 1402 cadet_handlers);
@@ -1458,7 +1459,7 @@ handle_client_member_join (void *cls,
1458 GNUNET_CRYPTO_ecdsa_key_get_public (&msg->member_key, &mem_pub_key); 1459 GNUNET_CRYPTO_ecdsa_key_get_public (&msg->member_key, &mem_pub_key);
1459 GNUNET_CRYPTO_hash (&mem_pub_key, sizeof (mem_pub_key), &mem_pub_key_hash); 1460 GNUNET_CRYPTO_hash (&mem_pub_key, sizeof (mem_pub_key), &mem_pub_key_hash);
1460 GNUNET_CRYPTO_hash (&msg->group_pub_key, sizeof (msg->group_pub_key), &pub_key_hash); 1461 GNUNET_CRYPTO_hash (&msg->group_pub_key, sizeof (msg->group_pub_key), &pub_key_hash);
1461 1462
1462 struct GNUNET_CONTAINER_MultiHashMap * 1463 struct GNUNET_CONTAINER_MultiHashMap *
1463 grp_mem = GNUNET_CONTAINER_multihashmap_get (group_members, &pub_key_hash); 1464 grp_mem = GNUNET_CONTAINER_multihashmap_get (group_members, &pub_key_hash);
1464 struct Member *mem = NULL; 1465 struct Member *mem = NULL;
@@ -1468,6 +1469,7 @@ handle_client_member_join (void *cls,
1468 { 1469 {
1469 mem = GNUNET_CONTAINER_multihashmap_get (grp_mem, &mem_pub_key_hash); 1470 mem = GNUNET_CONTAINER_multihashmap_get (grp_mem, &mem_pub_key_hash);
1470 } 1471 }
1472
1471 if (NULL == mem) 1473 if (NULL == mem)
1472 { 1474 {
1473 mem = GNUNET_new (struct Member); 1475 mem = GNUNET_new (struct Member);
@@ -1483,7 +1485,7 @@ handle_client_member_join (void *cls,
1483 grp->pub_key = msg->group_pub_key; 1485 grp->pub_key = msg->group_pub_key;
1484 grp->pub_key_hash = pub_key_hash; 1486 grp->pub_key_hash = pub_key_hash;
1485 group_set_cadet_port_hash (grp); 1487 group_set_cadet_port_hash (grp);
1486 1488
1487 if (NULL == grp_mem) 1489 if (NULL == grp_mem)
1488 { 1490 {
1489 grp_mem = GNUNET_CONTAINER_multihashmap_create (1, GNUNET_YES); 1491 grp_mem = GNUNET_CONTAINER_multihashmap_create (1, GNUNET_YES);
@@ -1492,6 +1494,7 @@ handle_client_member_join (void *cls,
1492 } 1494 }
1493 GNUNET_CONTAINER_multihashmap_put (grp_mem, &mem->pub_key_hash, mem, 1495 GNUNET_CONTAINER_multihashmap_put (grp_mem, &mem->pub_key_hash, mem,
1494 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); 1496 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST);
1497
1495 GNUNET_CONTAINER_multihashmap_put (members, &grp->pub_key_hash, mem, 1498 GNUNET_CONTAINER_multihashmap_put (members, &grp->pub_key_hash, mem,
1496 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); 1499 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
1497 } 1500 }
@@ -1508,7 +1511,7 @@ handle_client_member_join (void *cls,
1508 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1511 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1509 "Client connected to group %s as member %s (%s).\n", 1512 "Client connected to group %s as member %s (%s).\n",
1510 GNUNET_h2s (&grp->pub_key_hash), 1513 GNUNET_h2s (&grp->pub_key_hash),
1511 GNUNET_h2s (&mem->pub_key_hash), 1514 GNUNET_h2s2 (&mem->pub_key_hash),
1512 str); 1515 str);
1513 GNUNET_free (str); 1516 GNUNET_free (str);
1514 1517
@@ -1636,7 +1639,8 @@ handle_client_join_decision (void *cls,
1636 "%p ..and member %s: %p\n", 1639 "%p ..and member %s: %p\n",
1637 grp, GNUNET_h2s (&member_key_hash), mem); 1640 grp, GNUNET_h2s (&member_key_hash), mem);
1638 } 1641 }
1639 if (NULL != mem) 1642
1643 if (NULL != mem)
1640 { /* Found local member */ 1644 { /* Found local member */
1641 client_send_join_decision (mem, hdcsn); 1645 client_send_join_decision (mem, hdcsn);
1642 } 1646 }
diff --git a/src/multicast/test_multicast.conf b/src/multicast/test_multicast.conf
index 8e80650db..1b50e0893 100644
--- a/src/multicast/test_multicast.conf
+++ b/src/multicast/test_multicast.conf
@@ -1,15 +1,12 @@
1[testbed] 1[testbed]
2HOSTNAME = localhost 2HOSTNAME = localhost
3OVERLAY_TOPOLOGY = STAR
4 3
5[arm] 4[arm]
6GLOBAL_POSTFIX=-L ERROR 5GLOBAL_POSTFIX=-L ERROR
7 6
8[hostlist]
9SERVERS =
10
11[multicast] 7[multicast]
12#PREFIX = tmux split-window -v gdb -x ./cmd.gdb --args 8#PREFIX = tmux new-window gdb -x ./cmd.gdb --args
9#PREFIX = valgrind --leak-check=full
13UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-multicast.sock 10UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-multicast.sock
14 11
15[vpn] 12[vpn]
@@ -23,6 +20,10 @@ USE_INCLUDED_HELLOS = NO
23# (large-scale experiments); disables persistence of HELLOs! 20# (large-scale experiments); disables persistence of HELLOs!
24NO_IO = YES 21NO_IO = YES
25 22
23[hostlist]
24FORCESTART = NO
25AUTOSTART = NO
26
26[nat] 27[nat]
27ENABLE_UPNP = NO 28ENABLE_UPNP = NO
28 29
diff --git a/src/multicast/test_multicast_line.conf b/src/multicast/test_multicast_line.conf
new file mode 100644
index 000000000..1047205cb
--- /dev/null
+++ b/src/multicast/test_multicast_line.conf
@@ -0,0 +1,63 @@
1[testbed]
2HOSTNAME = localhost
3OVERLAY_TOPOLOGY = LINE
4
5[arm]
6GLOBAL_POSTFIX=-L ERROR
7
8[multicast]
9#PREFIX = tmux new-window gdb -x ./cmd.gdb --args
10#PREFIX = valgrind --leak-check=full
11UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-multicast.sock
12
13[vpn]
14AUTOSTART = NO
15
16[peerinfo]
17# Do not use shipped gnunet HELLOs
18USE_INCLUDED_HELLOS = NO
19
20# Option to disable all disk IO; only useful for testbed runs
21# (large-scale experiments); disables persistence of HELLOs!
22NO_IO = YES
23
24[cadet]
25ID_ANNOUNCE_TIME = 5 s
26
27[hostlist]
28FORCESTART = NO
29AUTOSTART = NO
30
31[nat]
32ENABLE_UPNP = NO
33
34[fs]
35FORCESTART = NO
36AUTOSTART = NO
37
38[vpn]
39FORCESTART = NO
40AUTOSTART = NO
41
42[revocation]
43FORCESTART = NO
44AUTOSTART = NO
45
46[gns]
47FORCESTART = NO
48AUTOSTART = NO
49
50[namestore]
51FORCESTART = NO
52AUTOSTART = NO
53
54[namecache]
55FORCESTART = NO
56AUTOSTART = NO
57
58[topology]
59FORCESTART = NO
60AUTOSTART = NO
61
62[nse]
63WORKBITS = 0
diff --git a/src/multicast/test_multicast_multipeer.c b/src/multicast/test_multicast_multipeer.c
index 5c3664f35..5f4493993 100644
--- a/src/multicast/test_multicast_multipeer.c
+++ b/src/multicast/test_multicast_multipeer.c
@@ -33,7 +33,7 @@
33#include "gnunet_testbed_service.h" 33#include "gnunet_testbed_service.h"
34#include "gnunet_multicast_service.h" 34#include "gnunet_multicast_service.h"
35 35
36#define NUM_PEERS 2 36#define PEERS_REQUESTED 12
37 37
38struct multicast_peer 38struct multicast_peer
39{ 39{
@@ -44,6 +44,18 @@ struct multicast_peer
44 int test_ok; 44 int test_ok;
45}; 45};
46 46
47enum pingpong
48{
49 PING = 1,
50 PONG = 2
51};
52
53struct pingpong_msg
54{
55 int peer;
56 enum pingpong msg;
57};
58
47static void service_connect (void *cls, 59static void service_connect (void *cls,
48 struct GNUNET_TESTBED_Operation *op, 60 struct GNUNET_TESTBED_Operation *op,
49 void *ca_result, 61 void *ca_result,
@@ -53,19 +65,20 @@ static struct multicast_peer **mc_peers;
53static struct GNUNET_TESTBED_Peer **peers; 65static struct GNUNET_TESTBED_Peer **peers;
54 66
55// FIXME: refactor 67// FIXME: refactor
56static struct GNUNET_TESTBED_Operation *op[NUM_PEERS]; 68static struct GNUNET_TESTBED_Operation *op[PEERS_REQUESTED];
57static struct GNUNET_TESTBED_Operation *pi_op[NUM_PEERS]; 69static struct GNUNET_TESTBED_Operation *pi_op[PEERS_REQUESTED];
58 70
59static struct GNUNET_MULTICAST_Origin *origin; 71static struct GNUNET_MULTICAST_Origin *origin;
60static struct GNUNET_MULTICAST_Member *member[NUM_PEERS]; /* first element always empty */ 72static struct GNUNET_MULTICAST_Member *member[PEERS_REQUESTED]; /* first element always empty */
61 73
62static struct GNUNET_SCHEDULER_Task *timeout_tid; 74static struct GNUNET_SCHEDULER_Task *timeout_tid;
63 75
64static struct GNUNET_CRYPTO_EddsaPrivateKey *group_key; 76static struct GNUNET_CRYPTO_EddsaPrivateKey group_key;
65static struct GNUNET_CRYPTO_EddsaPublicKey *group_pub_key; 77static struct GNUNET_CRYPTO_EddsaPublicKey group_pub_key;
78static struct GNUNET_HashCode group_pub_key_hash;
66 79
67static struct GNUNET_CRYPTO_EcdsaPrivateKey *member_key[NUM_PEERS]; 80static struct GNUNET_CRYPTO_EcdsaPrivateKey *member_key[PEERS_REQUESTED];
68static struct GNUNET_CRYPTO_EcdsaPublicKey *member_pub_key[NUM_PEERS]; 81static struct GNUNET_CRYPTO_EcdsaPublicKey *member_pub_key[PEERS_REQUESTED];
69 82
70 83
71/** 84/**
@@ -80,7 +93,7 @@ static int result;
80static void 93static void
81shutdown_task (void *cls) 94shutdown_task (void *cls)
82{ 95{
83 for (int i=0;i<NUM_PEERS;i++) 96 for (int i=0;i<PEERS_REQUESTED;i++)
84 { 97 {
85 if (NULL != op[i]) 98 if (NULL != op[i])
86 { 99 {
@@ -96,7 +109,7 @@ shutdown_task (void *cls)
96 109
97 if (NULL != mc_peers) 110 if (NULL != mc_peers)
98 { 111 {
99 for (int i=0; i < NUM_PEERS; i++) 112 for (int i=0; i < PEERS_REQUESTED; i++)
100 { 113 {
101 GNUNET_free (mc_peers[i]); 114 GNUNET_free (mc_peers[i]);
102 mc_peers[i] = NULL; 115 mc_peers[i] = NULL;
@@ -143,12 +156,15 @@ notify (void *cls,
143{ 156{
144 struct multicast_peer *mc_peer = (struct multicast_peer*)cls; 157 struct multicast_peer *mc_peer = (struct multicast_peer*)cls;
145 158
146 char text[] = "ping"; 159 struct pingpong_msg *pp_msg = GNUNET_new (struct pingpong_msg);
147 *data_size = strlen(text)+1; 160 pp_msg->peer = mc_peer->peer;
148 GNUNET_memcpy(data, text, *data_size); 161 pp_msg->msg = PING;
162
163 *data_size = sizeof (struct pingpong_msg);
164 GNUNET_memcpy(data, pp_msg, *data_size);
149 165
150 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 166 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
151 "Peer #%u sents message to origin: %s\n", mc_peer->peer, text); 167 "Peer #%u sents ping to origin\n", mc_peer->peer);
152 168
153 return GNUNET_YES; 169 return GNUNET_YES;
154} 170}
@@ -203,29 +219,20 @@ member_message (void *cls,
203 const struct GNUNET_MULTICAST_MessageHeader *msg) 219 const struct GNUNET_MULTICAST_MessageHeader *msg)
204{ 220{
205 struct multicast_peer *mc_peer = (struct multicast_peer*)cls; 221 struct multicast_peer *mc_peer = (struct multicast_peer*)cls;
222 struct pingpong_msg *pp_msg = (struct pingpong_msg*) &(msg[1]);
206 223
207 if (0 != strncmp ("pong", (char *)&msg[1], 4)) 224 if (PONG == pp_msg->msg && mc_peer->peer == pp_msg->peer)
208 { 225 {
209 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 226 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
210 "peer #%i (%s) did not receive pong\n", 227 "peer #%i (%s) receives a pong\n",
211 mc_peer->peer, 228 mc_peer->peer,
212 GNUNET_i2s (mc_peers[mc_peer->peer]->id)); 229 GNUNET_i2s (mc_peers[mc_peer->peer]->id));
213 230
214 result = GNUNET_SYSERR; 231 mc_peer->test_ok = GNUNET_OK;
215 GNUNET_SCHEDULER_shutdown ();
216 } 232 }
217 233
218 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 234 // Test for completeness of received PONGs
219 "peer #%i (%s) receives: %s\n", 235 for (int i=1; i<PEERS_REQUESTED; i++)
220 mc_peer->peer,
221 GNUNET_i2s (mc_peers[mc_peer->peer]->id),
222 (char *)&msg[1]);
223
224 mc_peer->test_ok = GNUNET_OK;
225
226 // FIXME: ugly test function
227 // (we start with 1 because 0 is origin)
228 for (int i=1; i<NUM_PEERS; i++)
229 if (GNUNET_NO == mc_peers[i]->test_ok) 236 if (GNUNET_NO == mc_peers[i]->test_ok)
230 return; 237 return;
231 238
@@ -298,11 +305,15 @@ origin_notify (void *cls,
298 size_t *data_size, 305 size_t *data_size,
299 void *data) 306 void *data)
300{ 307{
301 char text[] = "pong"; 308 struct pingpong_msg *rcv_pp_msg = (struct pingpong_msg*)cls;
302 *data_size = strlen(text)+1; 309 struct pingpong_msg *pp_msg = GNUNET_new (struct pingpong_msg);
303 memcpy(data, text, *data_size);
304 310
305 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "origin sends (to all): %s\n", text); 311 pp_msg->peer = rcv_pp_msg->peer;
312 pp_msg->msg = PONG;
313 *data_size = sizeof (struct pingpong_msg);
314 memcpy(data, pp_msg, *data_size);
315
316 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "origin sends pong\n");
306 317
307 return GNUNET_YES; 318 return GNUNET_YES;
308} 319}
@@ -312,9 +323,12 @@ static void
312origin_request (void *cls, 323origin_request (void *cls,
313 const struct GNUNET_MULTICAST_RequestHeader *req) 324 const struct GNUNET_MULTICAST_RequestHeader *req)
314{ 325{
315 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "origin receives: %s\n", (char *)&req[1]); 326 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "origin receives a msg\n");
327
328 req++;
329 struct pingpong_msg *pp_msg = (struct pingpong_msg *) req;
316 330
317 if (0 != strncmp ("ping", (char *)&req[1], 4)) { 331 if (1 != pp_msg->msg) {
318 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "origin didn't reveice a correct request"); 332 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "origin didn't reveice a correct request");
319 } 333 }
320 334
@@ -322,7 +336,7 @@ origin_request (void *cls,
322 0, 336 0,
323 0, 337 0,
324 origin_notify, 338 origin_notify,
325 cls); 339 pp_msg);
326} 340}
327 341
328 342
@@ -366,15 +380,17 @@ multicast_ca (void *cls,
366 struct multicast_peer *mc_peer = (struct multicast_peer*)cls; 380 struct multicast_peer *mc_peer = (struct multicast_peer*)cls;
367 struct GNUNET_MessageHeader *join_msg; 381 struct GNUNET_MessageHeader *join_msg;
368 char data[64]; 382 char data[64];
369 383
370 if (0 == mc_peer->peer) 384 if (0 == mc_peer->peer)
371 { 385 {
372 group_pub_key = GNUNET_new (struct GNUNET_CRYPTO_EddsaPublicKey); 386 struct GNUNET_CRYPTO_EddsaPrivateKey *key = GNUNET_CRYPTO_eddsa_key_create ();
373 group_key = GNUNET_CRYPTO_eddsa_key_create (); 387 GNUNET_CRYPTO_eddsa_key_get_public (key, &group_pub_key);
374 GNUNET_CRYPTO_eddsa_key_get_public (group_key, group_pub_key); 388 GNUNET_CRYPTO_hash (&group_pub_key, sizeof (group_pub_key), &group_pub_key_hash);
375 389
376 return GNUNET_MULTICAST_origin_start (cfg, 390 group_key = *key;
377 group_key, 391
392 origin = GNUNET_MULTICAST_origin_start (cfg,
393 &group_key,
378 0, 394 0,
379 origin_join_request, 395 origin_join_request,
380 origin_replay_frag, 396 origin_replay_frag,
@@ -382,6 +398,20 @@ multicast_ca (void *cls,
382 origin_request, 398 origin_request,
383 origin_message, 399 origin_message,
384 cls); 400 cls);
401
402 if (NULL == origin) {
403 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
404 "Peer #%u could not create a multicast group",
405 mc_peer->peer);
406 return NULL;
407 }
408
409 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
410 "Peer #%u connected as origin to group %s\n",
411 mc_peer->peer,
412 GNUNET_h2s (&group_pub_key_hash));
413
414 return origin;
385 } 415 }
386 else 416 else
387 { 417 {
@@ -401,23 +431,25 @@ multicast_ca (void *cls,
401 GNUNET_memcpy (&join_msg[1], data, data_size); 431 GNUNET_memcpy (&join_msg[1], data, data_size);
402 432
403 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 433 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
404 "Peer #%u (%s) tries to join multicast group\n", 434 "Peer #%u (%s) tries to join multicast group %s\n",
405 mc_peer->peer, 435 mc_peer->peer,
406 GNUNET_i2s (mc_peers[mc_peer->peer]->id)); 436 GNUNET_i2s (mc_peers[mc_peer->peer]->id),
407 437 GNUNET_h2s (&group_pub_key_hash));
408 return GNUNET_MULTICAST_member_join (cfg, 438
409 group_pub_key, 439 member[mc_peer->peer] = GNUNET_MULTICAST_member_join (cfg,
410 member_key[mc_peer->peer], 440 &group_pub_key,
411 mc_peers[0]->id, 441 member_key[mc_peer->peer],
412 0, 442 mc_peers[0]->id,
413 NULL, 443 0,
414 join_msg, /* join message */ 444 NULL,
415 member_join_request, 445 join_msg, /* join message */
416 member_join_decision, 446 member_join_request,
417 member_replay_frag, 447 member_join_decision,
418 member_replay_msg, 448 member_replay_frag,
419 member_message, 449 member_replay_msg,
420 cls); 450 member_message,
451 cls);
452 return member[mc_peer->peer];
421 } 453 }
422} 454}
423 455
@@ -485,20 +517,10 @@ service_connect (void *cls,
485 GNUNET_SCHEDULER_shutdown(); 517 GNUNET_SCHEDULER_shutdown();
486 } 518 }
487 519
488 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
489 "Connected to multicast service of peer #%u (%s)\n",
490 mc_peer->peer,
491 GNUNET_i2s (mc_peers[mc_peer->peer]->id));
492
493 if (0 == mc_peer->peer) 520 if (0 == mc_peer->peer)
494 { 521 {
495 origin = ca_result; 522 // Get GNUnet identity of members
496 523 for (int i = 0; i<PEERS_REQUESTED; i++)
497 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
498 "Connected to multicast service of origin\n");
499
500 // Get GNUnet identity of members
501 for (int i = 0; i<NUM_PEERS; i++)
502 { 524 {
503 pi_op[i] = GNUNET_TESTBED_peer_get_information (peers[i], 525 pi_op[i] = GNUNET_TESTBED_peer_get_information (peers[i],
504 GNUNET_TESTBED_PIT_IDENTITY, 526 GNUNET_TESTBED_PIT_IDENTITY,
@@ -506,10 +528,6 @@ service_connect (void *cls,
506 mc_peers[i]); 528 mc_peers[i]);
507 } 529 }
508 } 530 }
509 else
510 {
511 member[mc_peer->peer] = ca_result;
512 }
513} 531}
514 532
515 533
@@ -526,11 +544,10 @@ service_connect (void *cls,
526 * @param cls closure 544 * @param cls closure
527 * @param h the run handle 545 * @param h the run handle
528 * @param peers started peers for the test 546 * @param peers started peers for the test
529 * @param num_peers size of the 'peers' array 547 * @param PEERS_REQUESTED size of the 'peers' array
530 * @param links_succeeded number of links between peers that were created 548 * @param links_succeeded number of links between peers that were created
531 * @param links_failed number of links testbed was unable to establish 549 * @param links_failed number of links testbed was unable to establish
532 */ 550 */ static void
533static void
534testbed_master (void *cls, 551testbed_master (void *cls,
535 struct GNUNET_TESTBED_RunHandle *h, 552 struct GNUNET_TESTBED_RunHandle *h,
536 unsigned int num_peers, 553 unsigned int num_peers,
@@ -546,10 +563,10 @@ testbed_master (void *cls,
546 563
547 peers = p; 564 peers = p;
548 565
549 mc_peers = GNUNET_new_array (NUM_PEERS, struct multicast_peer*); 566 mc_peers = GNUNET_new_array (PEERS_REQUESTED, struct multicast_peer*);
550 567
551 // Create test contexts for members 568 // Create test contexts for members
552 for (int i = 0; i<NUM_PEERS; i++) 569 for (int i = 0; i<PEERS_REQUESTED; i++)
553 { 570 {
554 mc_peers[i] = GNUNET_new (struct multicast_peer); 571 mc_peers[i] = GNUNET_new (struct multicast_peer);
555 mc_peers[i]->peer = i; 572 mc_peers[i]->peer = i;
@@ -583,12 +600,26 @@ int
583main (int argc, char *argv[]) 600main (int argc, char *argv[])
584{ 601{
585 int ret; 602 int ret;
603 char const *config_file;
604
605 if (strstr (argv[0], "_line") != NULL)
606 {
607 config_file = "test_multicast_line.conf";
608 }
609 else if (strstr(argv[0], "_star") != NULL)
610 {
611 config_file = "test_multicast_star.conf";
612 }
613 else
614 {
615 config_file = "test_multicast_star.conf";
616 }
586 617
587 result = GNUNET_SYSERR; 618 result = GNUNET_SYSERR;
588 ret = GNUNET_TESTBED_test_run 619 ret = GNUNET_TESTBED_test_run
589 ("test-multicast-multipeer", /* test case name */ 620 ("test-multicast-multipeer", /* test case name */
590 "test_multicast.conf", /* template configuration */ 621 config_file, /* template configuration */
591 NUM_PEERS, /* number of peers to start */ 622 PEERS_REQUESTED, /* number of peers to start */
592 0LL, /* Event mask - set to 0 for no event notifications */ 623 0LL, /* Event mask - set to 0 for no event notifications */
593 NULL, /* Controller event callback */ 624 NULL, /* Controller event callback */
594 NULL, /* Closure for controller event callback */ 625 NULL, /* Closure for controller event callback */
diff --git a/src/multicast/test_multicast_star.conf b/src/multicast/test_multicast_star.conf
new file mode 100644
index 000000000..ed690d95d
--- /dev/null
+++ b/src/multicast/test_multicast_star.conf
@@ -0,0 +1,64 @@
1[testbed]
2HOSTNAME = localhost
3OVERLAY_TOPOLOGY = STAR
4
5[arm]
6GLOBAL_POSTFIX=-L ERROR
7
8[multicast]
9#PREFIX = tmux new-window gdb -x ./cmd.gdb --args
10#PREFIX = valgrind --leak-check=full
11UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-multicast.sock
12
13[vpn]
14AUTOSTART = NO
15
16[peerinfo]
17# Do not use shipped gnunet HELLOs
18USE_INCLUDED_HELLOS = NO
19
20# Option to disable all disk IO; only useful for testbed runs
21# (large-scale experiments); disables persistence of HELLOs!
22NO_IO = YES
23
24[cadet]
25ID_ANNOUNCE_TIME = 5 s
26
27[hostlist]
28FORCESTART = NO
29AUTOSTART = NO
30
31[nat]
32ENABLE_UPNP = NO
33
34[fs]
35FORCESTART = NO
36AUTOSTART = NO
37
38[vpn]
39FORCESTART = NO
40AUTOSTART = NO
41
42[revocation]
43FORCESTART = NO
44AUTOSTART = NO
45
46[gns]
47FORCESTART = NO
48AUTOSTART = NO
49
50[namestore]
51FORCESTART = NO
52AUTOSTART = NO
53
54[namecache]
55FORCESTART = NO
56AUTOSTART = NO
57
58[topology]
59FORCESTART = NO
60AUTOSTART = NO
61
62[nse]
63WORKBITS = 0
64
diff --git a/src/util/Makefile.am b/src/util/Makefile.am
index 62cf03684..cc9ff4745 100644
--- a/src/util/Makefile.am
+++ b/src/util/Makefile.am
@@ -347,10 +347,10 @@ test_client_unix_nc_SOURCES = \
347test_client_unix_nc_LDADD = \ 347test_client_unix_nc_LDADD = \
348 libgnunetutil.la 348 libgnunetutil.la
349 349
350test_socks_nc_SOURCES = \ 350#test_socks_nc_SOURCES = \
351 test_socks.c 351# test_socks.c
352test_socks_nc_LDADD = \ 352#test_socks_nc_LDADD = \
353 libgnunetutil.la 353# libgnunetutil.la
354 354
355test_common_allocation_SOURCES = \ 355test_common_allocation_SOURCES = \
356 test_common_allocation.c 356 test_common_allocation.c
diff --git a/src/util/common_logging.c b/src/util/common_logging.c
index 34481fe13..3e71fa476 100644
--- a/src/util/common_logging.c
+++ b/src/util/common_logging.c
@@ -1156,6 +1156,27 @@ GNUNET_h2s (const struct GNUNET_HashCode * hc)
1156 1156
1157 1157
1158/** 1158/**
1159 * Convert a hash to a string (for printing debug messages).
1160 * This is one of the very few calls in the entire API that is
1161 * NOT reentrant! Identical to #GNUNET_h2s(), except that another
1162 * buffer is used so both #GNUNET_h2s() and #GNUNET_h2s2() can be
1163 * used within the same log statement.
1164 *
1165 * @param hc the hash code
1166 * @return string form; will be overwritten by next call to GNUNET_h2s.
1167 */
1168const char *
1169GNUNET_h2s2 (const struct GNUNET_HashCode * hc)
1170{
1171 static struct GNUNET_CRYPTO_HashAsciiEncoded ret;
1172
1173 GNUNET_CRYPTO_hash_to_enc (hc, &ret);
1174 ret.encoding[8] = '\0';
1175 return (const char *) ret.encoding;
1176}
1177
1178
1179/**
1159 * @ingroup logging 1180 * @ingroup logging
1160 * Convert a short hash value to a string (for printing debug messages). 1181 * Convert a short hash value to a string (for printing debug messages).
1161 * This is one of the very few calls in the entire API that is 1182 * This is one of the very few calls in the entire API that is
diff --git a/src/util/resolver_api.c b/src/util/resolver_api.c
index e7bba3000..33a340729 100644
--- a/src/util/resolver_api.c
+++ b/src/util/resolver_api.c
@@ -179,7 +179,6 @@ static int
179check_config () 179check_config ()
180{ 180{
181 char *hostname; 181 char *hostname;
182 unsigned int i;
183 struct sockaddr_in v4; 182 struct sockaddr_in v4;
184 struct sockaddr_in6 v6; 183 struct sockaddr_in6 v6;
185 184
@@ -206,15 +205,16 @@ check_config ()
206 "resolver"); 205 "resolver");
207 return GNUNET_SYSERR; 206 return GNUNET_SYSERR;
208 } 207 }
209 if ((1 == inet_pton (AF_INET, hostname, &v4)) || 208 if ( (1 == inet_pton (AF_INET, hostname, &v4)) ||
210 (1 == inet_pton (AF_INET6, hostname, &v6))) 209 (1 == inet_pton (AF_INET6, hostname, &v6)) )
211 { 210 {
212 GNUNET_free (hostname); 211 GNUNET_free (hostname);
213 return GNUNET_OK; 212 return GNUNET_OK;
214 } 213 }
215 i = 0; 214 for (unsigned int i = 0;
216 while (NULL != loopback[i]) 215 NULL != loopback[i];
217 if (0 == strcasecmp (loopback[i++], hostname)) 216 i++)
217 if (0 == strcasecmp (loopback[i], hostname))
218 { 218 {
219 GNUNET_free (hostname); 219 GNUNET_free (hostname);
220 return GNUNET_OK; 220 return GNUNET_OK;
@@ -297,9 +297,9 @@ shutdown_task (void *cls)
297static void 297static void
298check_disconnect () 298check_disconnect ()
299{ 299{
300 struct GNUNET_RESOLVER_RequestHandle *rh; 300 for (struct GNUNET_RESOLVER_RequestHandle *rh = req_head;
301 301 NULL != rh;
302 for (rh = req_head; NULL != rh; rh = rh->next) 302 rh = rh->next)
303 if (GNUNET_SYSERR != rh->was_transmitted) 303 if (GNUNET_SYSERR != rh->was_transmitted)
304 return; 304 return;
305 if (NULL != r_task) 305 if (NULL != r_task)
@@ -336,7 +336,10 @@ no_resolve (int af,
336 if (ip_len != sizeof (struct in_addr)) 336 if (ip_len != sizeof (struct in_addr))
337 return NULL; 337 return NULL;
338 if (NULL == 338 if (NULL ==
339 inet_ntop (AF_INET, ip, buf, sizeof (buf))) 339 inet_ntop (AF_INET,
340 ip,
341 buf,
342 sizeof (buf)))
340 { 343 {
341 LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, 344 LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING,
342 "inet_ntop"); 345 "inet_ntop");
@@ -347,7 +350,10 @@ no_resolve (int af,
347 if (ip_len != sizeof (struct in6_addr)) 350 if (ip_len != sizeof (struct in6_addr))
348 return NULL; 351 return NULL;
349 if (NULL == 352 if (NULL ==
350 inet_ntop (AF_INET6, ip, buf, sizeof (buf))) 353 inet_ntop (AF_INET6,
354 ip,
355 buf,
356 sizeof (buf)))
351 { 357 {
352 LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, 358 LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING,
353 "inet_ntop"); 359 "inet_ntop");
@@ -422,8 +428,8 @@ process_requests ()
422 msg->direction = htonl (rh->direction); 428 msg->direction = htonl (rh->direction);
423 msg->af = htonl (rh->af); 429 msg->af = htonl (rh->af);
424 GNUNET_memcpy (&msg[1], 430 GNUNET_memcpy (&msg[1],
425 &rh[1], 431 &rh[1],
426 rh->data_len); 432 rh->data_len);
427 LOG (GNUNET_ERROR_TYPE_DEBUG, 433 LOG (GNUNET_ERROR_TYPE_DEBUG,
428 "Transmitting DNS resolution request to DNS service\n"); 434 "Transmitting DNS resolution request to DNS service\n");
429 GNUNET_MQ_send (mq, 435 GNUNET_MQ_send (mq,
@@ -611,14 +617,19 @@ numeric_resolution (void *cls)
611 v6.sin6_len = sizeof (v6); 617 v6.sin6_len = sizeof (v6);
612#endif 618#endif
613 hostname = (const char *) &rh[1]; 619 hostname = (const char *) &rh[1];
614 if (((rh->af == AF_UNSPEC) || (rh->af == AF_INET)) && 620 if ( ( (rh->af == AF_UNSPEC) ||
615 (1 == inet_pton (AF_INET, hostname, &v4.sin_addr))) 621 (rh->af == AF_INET) ) &&
622 (1 == inet_pton (AF_INET,
623 hostname,
624 &v4.sin_addr)) )
616 { 625 {
617 rh->addr_callback (rh->cls, 626 rh->addr_callback (rh->cls,
618 (const struct sockaddr *) &v4, 627 (const struct sockaddr *) &v4,
619 sizeof (v4)); 628 sizeof (v4));
620 if ((rh->af == AF_UNSPEC) && 629 if ( (rh->af == AF_UNSPEC) &&
621 (1 == inet_pton (AF_INET6, hostname, &v6.sin6_addr))) 630 (1 == inet_pton (AF_INET6,
631 hostname,
632 &v6.sin6_addr)) )
622 { 633 {
623 /* this can happen on some systems IF "hostname" is "localhost" */ 634 /* this can happen on some systems IF "hostname" is "localhost" */
624 rh->addr_callback (rh->cls, 635 rh->addr_callback (rh->cls,
@@ -872,7 +883,6 @@ GNUNET_RESOLVER_ip_get (const char *hostname,
872{ 883{
873 struct GNUNET_RESOLVER_RequestHandle *rh; 884 struct GNUNET_RESOLVER_RequestHandle *rh;
874 size_t slen; 885 size_t slen;
875 unsigned int i;
876 struct in_addr v4; 886 struct in_addr v4;
877 struct in6_addr v6; 887 struct in6_addr v6;
878 888
@@ -897,19 +907,26 @@ GNUNET_RESOLVER_ip_get (const char *hostname,
897 rh->timeout = GNUNET_TIME_relative_to_absolute (timeout); 907 rh->timeout = GNUNET_TIME_relative_to_absolute (timeout);
898 rh->direction = GNUNET_NO; 908 rh->direction = GNUNET_NO;
899 /* first, check if this is a numeric address */ 909 /* first, check if this is a numeric address */
900 if (((1 == inet_pton (AF_INET, hostname, &v4)) && 910 if ( ( (1 == inet_pton (AF_INET,
901 ((af == AF_INET) || (af == AF_UNSPEC))) || 911 hostname,
902 ((1 == inet_pton (AF_INET6, hostname, &v6)) && 912 &v4)) &&
903 ((af == AF_INET6) || (af == AF_UNSPEC)))) 913 ( (af == AF_INET) ||
914 (af == AF_UNSPEC) ) ) ||
915 ( (1 == inet_pton (AF_INET6,
916 hostname,
917 &v6)) &&
918 ( (af == AF_INET6) ||
919 (af == AF_UNSPEC)) ) )
904 { 920 {
905 rh->task = GNUNET_SCHEDULER_add_now (&numeric_resolution, 921 rh->task = GNUNET_SCHEDULER_add_now (&numeric_resolution,
906 rh); 922 rh);
907 return rh; 923 return rh;
908 } 924 }
909 /* then, check if this is a loopback address */ 925 /* then, check if this is a loopback address */
910 i = 0; 926 for (unsigned int i = 0;
911 while (NULL != loopback[i]) 927 NULL != loopback[i];
912 if (0 == strcasecmp (loopback[i++], 928 i++)
929 if (0 == strcasecmp (loopback[i],
913 hostname)) 930 hostname))
914 { 931 {
915 rh->task = GNUNET_SCHEDULER_add_now (&loopback_resolution, 932 rh->task = GNUNET_SCHEDULER_add_now (&loopback_resolution,
@@ -1029,8 +1046,8 @@ GNUNET_RESOLVER_hostname_get (const struct sockaddr *sa,
1029 rh->af = sa->sa_family; 1046 rh->af = sa->sa_family;
1030 rh->timeout = GNUNET_TIME_relative_to_absolute (timeout); 1047 rh->timeout = GNUNET_TIME_relative_to_absolute (timeout);
1031 GNUNET_memcpy (&rh[1], 1048 GNUNET_memcpy (&rh[1],
1032 ip, 1049 ip,
1033 ip_len); 1050 ip_len);
1034 rh->data_len = ip_len; 1051 rh->data_len = ip_len;
1035 rh->direction = GNUNET_YES; 1052 rh->direction = GNUNET_YES;
1036 rh->received_response = GNUNET_NO; 1053 rh->received_response = GNUNET_NO;
@@ -1067,7 +1084,8 @@ GNUNET_RESOLVER_local_fqdn_get ()
1067{ 1084{
1068 char hostname[GNUNET_OS_get_hostname_max_length () + 1]; 1085 char hostname[GNUNET_OS_get_hostname_max_length () + 1];
1069 1086
1070 if (0 != gethostname (hostname, sizeof (hostname) - 1)) 1087 if (0 != gethostname (hostname,
1088 sizeof (hostname) - 1))
1071 { 1089 {
1072 LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, 1090 LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
1073 "gethostname"); 1091 "gethostname");
@@ -1082,7 +1100,10 @@ GNUNET_RESOLVER_local_fqdn_get ()
1082 int ret; 1100 int ret;
1083 char *rval; 1101 char *rval;
1084 1102
1085 if (0 != (ret = getaddrinfo (hostname, NULL, NULL, &ai))) 1103 if (0 != (ret = getaddrinfo (hostname,
1104 NULL,
1105 NULL,
1106 &ai)))
1086 { 1107 {
1087 LOG (GNUNET_ERROR_TYPE_ERROR, 1108 LOG (GNUNET_ERROR_TYPE_ERROR,
1088 _("Could not resolve our FQDN: %s\n"), 1109 _("Could not resolve our FQDN: %s\n"),
@@ -1100,9 +1121,11 @@ GNUNET_RESOLVER_local_fqdn_get ()
1100 { 1121 {
1101 struct hostent *host; 1122 struct hostent *host;
1102 1123
1103 host = gethostbyname2 (hostname, AF_INET); 1124 host = gethostbyname2 (hostname,
1125 AF_INET);
1104 if (NULL == host) 1126 if (NULL == host)
1105 host = gethostbyname2 (hostname, AF_INET6); 1127 host = gethostbyname2 (hostname,
1128 AF_INET6);
1106 if (NULL == host) 1129 if (NULL == host)
1107 { 1130 {
1108 LOG (GNUNET_ERROR_TYPE_ERROR, 1131 LOG (GNUNET_ERROR_TYPE_ERROR,