aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--TODO3
-rw-r--r--contrib/defaults.conf8
-rw-r--r--src/arm/gnunet-service-arm_interceptor.c10
-rw-r--r--src/core/test_core_api_peer1.conf5
-rw-r--r--src/core/test_core_api_peer2.conf6
-rw-r--r--src/hostlist/test_gnunet_daemon_hostlist_peer1.conf6
-rw-r--r--src/hostlist/test_gnunet_daemon_hostlist_peer2.conf8
-rw-r--r--src/include/gnunet_connection_lib.h23
-rw-r--r--src/include/platform.h1
-rw-r--r--src/testing/test_testing_connect_peer1.conf6
-rw-r--r--src/testing/test_testing_connect_peer2.conf6
-rw-r--r--src/testing/testing_group.c42
-rw-r--r--src/transport/test_transport_api_http_peer1.conf5
-rw-r--r--src/transport/test_transport_api_http_peer2.conf7
-rw-r--r--src/transport/test_transport_api_tcp_peer1.conf7
-rw-r--r--src/transport/test_transport_api_tcp_peer2.conf5
-rw-r--r--src/transport/test_transport_api_udp_nat_peer1.conf35
-rw-r--r--src/transport/test_transport_api_udp_nat_peer2.conf38
-rw-r--r--src/transport/test_transport_api_udp_peer1.conf15
-rw-r--r--src/transport/test_transport_api_udp_peer2.conf16
-rw-r--r--src/util/bandwidth.c2
-rw-r--r--src/util/client.c47
-rw-r--r--src/util/common_logging.c13
-rw-r--r--src/util/connection.c66
-rw-r--r--src/util/network.c11
-rw-r--r--src/util/service.c190
-rw-r--r--src/util/test_resolver_api.c2
28 files changed, 454 insertions, 133 deletions
diff --git a/ChangeLog b/ChangeLog
index 7cb118fbd..861d8bd25 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
1Sat Jun 5 18:08:39 CEST 2010
2 Added support for UNIX domain sockets, code also defaults to
3 them when available.
4
1Sun May 2 13:49:10 CEST 2010 5Sun May 2 13:49:10 CEST 2010
2 Fixed problem with platform-dependence of format for IP addresses 6 Fixed problem with platform-dependence of format for IP addresses
3 in HELLOs for TCP and UDP transport. 7 in HELLOs for TCP and UDP transport.
diff --git a/TODO b/TODO
index 184c04a9f..e536258a4 100644
--- a/TODO
+++ b/TODO
@@ -21,7 +21,6 @@
21* UTIL: 21* UTIL:
22 - only connect() sockets that are ready (select()) [Nils] 22 - only connect() sockets that are ready (select()) [Nils]
23 [On W32, we need to select after calling socket before doing connect etc.] 23 [On W32, we need to select after calling socket before doing connect etc.]
24 - add support for UNIX domain sockets [CG]
25* GNUNET-GTK: 24* GNUNET-GTK:
26 - search events: 25 - search events:
27 + results 26 + results
@@ -70,8 +69,8 @@
70 - better crash management (attach debugging support, capture and analyze 69 - better crash management (attach debugging support, capture and analyze
71 debug output, detect random vs. deterministic crashes) 70 debug output, detect random vs. deterministic crashes)
72 - discover dependencies between services 71 - discover dependencies between services
73 => need UNIX domain sockets first!
74 - handle gnunet-arm -k in combination with auto-start magic (what is the right thing here?) 72 - handle gnunet-arm -k in combination with auto-start magic (what is the right thing here?)
73 - add listen socket forwarding to child processes on supported platforms
75* FS: [CG] 74* FS: [CG]
76 - datastore reservation (publishing) 75 - datastore reservation (publishing)
77 - location URIs (publish, search, download) 76 - location URIs (publish, search, download)
diff --git a/contrib/defaults.conf b/contrib/defaults.conf
index b4a3ddd72..c250ebe87 100644
--- a/contrib/defaults.conf
+++ b/contrib/defaults.conf
@@ -36,6 +36,7 @@ BINARY = gnunet-service-arm
36ACCEPT_FROM = 127.0.0.1; 36ACCEPT_FROM = 127.0.0.1;
37ACCEPT_FROM6 = ::1; 37ACCEPT_FROM6 = ::1;
38DEFAULTSERVICES = resolver transport core topology hostlist 38DEFAULTSERVICES = resolver transport core topology hostlist
39UNIXPATH = /tmp/gnunet-service-arm.sock
39# GLOBAL_POSTFIX = -l $SERVICEHOME/{}-logs 40# GLOBAL_POSTFIX = -l $SERVICEHOME/{}-logs
40# GLOBAL_PREFIX = 41# GLOBAL_PREFIX =
41# USERNAME = 42# USERNAME =
@@ -56,6 +57,7 @@ CONFIG = $DEFAULTCONFIG
56BINARY = gnunet-service-statistics 57BINARY = gnunet-service-statistics
57ACCEPT_FROM = 127.0.0.1; 58ACCEPT_FROM = 127.0.0.1;
58ACCEPT_FROM6 = ::1; 59ACCEPT_FROM6 = ::1;
60UNIXPATH = /tmp/gnunet-service-statistics.sock
59# USERNAME = 61# USERNAME =
60# MAXBUF = 62# MAXBUF =
61# TIMEOUT = 63# TIMEOUT =
@@ -74,6 +76,7 @@ CONFIG = $DEFAULTCONFIG
74BINARY = gnunet-service-resolver 76BINARY = gnunet-service-resolver
75ACCEPT_FROM = 127.0.0.1; 77ACCEPT_FROM = 127.0.0.1;
76ACCEPT_FROM6 = ::1; 78ACCEPT_FROM6 = ::1;
79UNIXPATH = /tmp/gnunet-service-resolver.sock
77# USERNAME = 80# USERNAME =
78# MAXBUF = 81# MAXBUF =
79# TIMEOUT = 82# TIMEOUT =
@@ -92,6 +95,7 @@ CONFIG = $DEFAULTCONFIG
92BINARY = gnunet-service-peerinfo 95BINARY = gnunet-service-peerinfo
93ACCEPT_FROM = 127.0.0.1; 96ACCEPT_FROM = 127.0.0.1;
94ACCEPT_FROM6 = ::1; 97ACCEPT_FROM6 = ::1;
98UNIXPATH = /tmp/gnunet-service-peerinfo.sock
95# USERNAME = 99# USERNAME =
96# MAXBUF = 100# MAXBUF =
97# TIMEOUT = 101# TIMEOUT =
@@ -115,6 +119,7 @@ NEIGHBOUR_LIMIT = 50
115ACCEPT_FROM = 127.0.0.1; 119ACCEPT_FROM = 127.0.0.1;
116ACCEPT_FROM6 = ::1; 120ACCEPT_FROM6 = ::1;
117PLUGINS = tcp 121PLUGINS = tcp
122UNIXPATH = /tmp/gnunet-service-transport.sock
118# USERNAME = 123# USERNAME =
119# MAXBUF = 124# MAXBUF =
120# TIMEOUT = 125# TIMEOUT =
@@ -136,6 +141,7 @@ ACCEPT_FROM6 = ::1;
136# quotas are in bytes per second now! 141# quotas are in bytes per second now!
137TOTAL_QUOTA_IN = 65536 142TOTAL_QUOTA_IN = 65536
138TOTAL_QUOTA_OUT = 65536 143TOTAL_QUOTA_OUT = 65536
144UNIXPATH = /tmp/gnunet-service-core.sock
139# DEBUG = YES 145# DEBUG = YES
140# USERNAME = 146# USERNAME =
141# MAXBUF = 147# MAXBUF =
@@ -172,6 +178,7 @@ HTTP-PROXY =
172 178
173[datastore] 179[datastore]
174AUTOSTART = YES 180AUTOSTART = YES
181UNIXPATH = /tmp/gnunet-service-datastore.sock
175PORT = 2093 182PORT = 2093
176HOSTNAME = localhost 183HOSTNAME = localhost
177HOME = $SERVICEHOME 184HOME = $SERVICEHOME
@@ -199,5 +206,6 @@ BINARY = gnunet-service-fs
199ACCEPT_FROM = 127.0.0.1; 206ACCEPT_FROM = 127.0.0.1;
200ACCEPT_FROM6 = ::1; 207ACCEPT_FROM6 = ::1;
201ACTIVEMIGRATION = YES 208ACTIVEMIGRATION = YES
209UNIXPATH = /tmp/gnunet-service-fs.sock
202# DEBUG = YES 210# DEBUG = YES
203 211
diff --git a/src/arm/gnunet-service-arm_interceptor.c b/src/arm/gnunet-service-arm_interceptor.c
index 10847c2ba..afefe4e48 100644
--- a/src/arm/gnunet-service-arm_interceptor.c
+++ b/src/arm/gnunet-service-arm_interceptor.c
@@ -936,15 +936,21 @@ createListeningSocket (struct sockaddr *sa,
936 case AF_INET6: 936 case AF_INET6:
937 sock = GNUNET_NETWORK_socket_create (PF_INET6, SOCK_STREAM, 0); 937 sock = GNUNET_NETWORK_socket_create (PF_INET6, SOCK_STREAM, 0);
938 break; 938 break;
939 case AF_UNIX:
940 sock = GNUNET_NETWORK_socket_create (PF_UNIX, SOCK_STREAM, 0);
941 break;
939 default: 942 default:
943 GNUNET_break (0);
940 sock = NULL; 944 sock = NULL;
945 errno = EAFNOSUPPORT;
941 break; 946 break;
942 } 947 }
943 if (NULL == sock) 948 if (NULL == sock)
944 { 949 {
945 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 950 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
946 _("Unable to create socket for service `%s'"), 951 _("Unable to create socket for service `%s': %s\n"),
947 serviceName); 952 serviceName,
953 STRERROR (errno));
948 GNUNET_free (sa); 954 GNUNET_free (sa);
949 return; 955 return;
950 } 956 }
diff --git a/src/core/test_core_api_peer1.conf b/src/core/test_core_api_peer1.conf
index 21bb7481b..a33893a39 100644
--- a/src/core/test_core_api_peer1.conf
+++ b/src/core/test_core_api_peer1.conf
@@ -4,10 +4,12 @@ DEFAULTCONFIG = test_core_api_peer1.conf
4 4
5[resolver] 5[resolver]
6PORT = 12464 6PORT = 12464
7UNIXPATH = /tmp/gnunet-p1-service-resolver.sock
7#PREFIX = xterm -T resolver1 -e valgrind --tool=memcheck 8#PREFIX = xterm -T resolver1 -e valgrind --tool=memcheck
8 9
9[transport] 10[transport]
10PORT = 12465 11PORT = 12465
12UNIXPATH = /tmp/gnunet-p1-service-transport.sock
11PLUGINS = tcp 13PLUGINS = tcp
12#PREFIX = xterm -T transport1 -e 14#PREFIX = xterm -T transport1 -e
13#PREFIX= xterm -e xterm -T transport1 -e gdb --args 15#PREFIX= xterm -e xterm -T transport1 -e gdb --args
@@ -17,6 +19,7 @@ PLUGINS = tcp
17 19
18[arm] 20[arm]
19PORT = 12466 21PORT = 12466
22UNIXPATH = /tmp/gnunet-p1-service-arm.sock
20DEFAULTSERVICES = 23DEFAULTSERVICES =
21#GLOBAL_PREFIX = xterm -e valgrind --tool=memcheck 24#GLOBAL_PREFIX = xterm -e valgrind --tool=memcheck
22 25
@@ -31,12 +34,14 @@ BINDTO = 127.0.0.1
31 34
32[peerinfo] 35[peerinfo]
33PORT = 12469 36PORT = 12469
37UNIXPATH = /tmp/gnunet-p1-service-peerinfo.sock
34#PREFIX = xterm -T peerinfo1 -e valgrind --tool=memcheck 38#PREFIX = xterm -T peerinfo1 -e valgrind --tool=memcheck
35#PREFIX = xterm -T peerinfo1 -e 39#PREFIX = xterm -T peerinfo1 -e
36#DEBUG = YES 40#DEBUG = YES
37 41
38[core] 42[core]
39PORT = 12470 43PORT = 12470
44UNIXPATH = /tmp/gnunet-p1-service-core.sock
40#PREFIX = valgrind --tool=memcheck 45#PREFIX = valgrind --tool=memcheck
41#OPTIONS = -l log-core-1 46#OPTIONS = -l log-core-1
42#PREFIX = xterm -e xterm -T core1 -e gdb --args 47#PREFIX = xterm -e xterm -T core1 -e gdb --args
diff --git a/src/core/test_core_api_peer2.conf b/src/core/test_core_api_peer2.conf
index 71a167e73..7389d68f6 100644
--- a/src/core/test_core_api_peer2.conf
+++ b/src/core/test_core_api_peer2.conf
@@ -4,10 +4,12 @@ DEFAULTCONFIG = test_core_api_peer2.conf
4 4
5[resolver] 5[resolver]
6PORT = 22464 6PORT = 22464
7UNIXPATH = /tmp/gnunet-p2-service-resolver.sock
7#PREFIX = xterm -T resolver2 -e valgrind --tool=memcheck 8#PREFIX = xterm -T resolver2 -e valgrind --tool=memcheck
8 9
9[transport] 10[transport]
10PORT = 22465 11PORT = 22465
12UNIXPATH = /tmp/gnunet-p2-service-transport.sock
11PLUGINS = tcp 13PLUGINS = tcp
12#PREFIX = xterm -T transport2 -e gdb --args 14#PREFIX = xterm -T transport2 -e gdb --args
13#PREFIX = xterm -e xterm -T transport2 -e gdb --args 15#PREFIX = xterm -e xterm -T transport2 -e gdb --args
@@ -17,11 +19,13 @@ PLUGINS = tcp
17 19
18[arm] 20[arm]
19PORT = 22466 21PORT = 22466
22UNIXPATH = /tmp/gnunet-p2-service-arm.sock
20DEFAULTSERVICES = 23DEFAULTSERVICES =
21#GLOBAL_PREFIX = xterm -e valgrind --tool=memcheck 24#GLOBAL_PREFIX = xterm -e valgrind --tool=memcheck
22 25
23[statistics] 26[statistics]
24PORT = 22467 27PORT = 22467
28UNIXPATH = /tmp/gnunet-p2-service-statistics.sock
25#PREFIX = xterm -T statistics2 -e valgrind --tool=memcheck 29#PREFIX = xterm -T statistics2 -e valgrind --tool=memcheck
26 30
27[transport-tcp] 31[transport-tcp]
@@ -31,12 +35,14 @@ BINDTO = 127.0.0.1
31 35
32[peerinfo] 36[peerinfo]
33PORT = 22469 37PORT = 22469
38UNIXPATH = /tmp/gnunet-p2-service-peerinfo.sock
34#PREFIX = xterm -T peerinfo2 -e valgrind --tool=memcheck 39#PREFIX = xterm -T peerinfo2 -e valgrind --tool=memcheck
35#PREFIX = xterm -T peerinfo2 -e 40#PREFIX = xterm -T peerinfo2 -e
36#DEBUG = YES 41#DEBUG = YES
37 42
38[core] 43[core]
39PORT = 22470 44PORT = 22470
45UNIXPATH = /tmp/gnunet-p2-service-core.sock
40#PREFIX = xterm -T core2 -e 46#PREFIX = xterm -T core2 -e
41#PREFIX = valgrind --tool=memcheck 47#PREFIX = valgrind --tool=memcheck
42#DEBUG = YES 48#DEBUG = YES
diff --git a/src/hostlist/test_gnunet_daemon_hostlist_peer1.conf b/src/hostlist/test_gnunet_daemon_hostlist_peer1.conf
index 19874f022..be5db7582 100644
--- a/src/hostlist/test_gnunet_daemon_hostlist_peer1.conf
+++ b/src/hostlist/test_gnunet_daemon_hostlist_peer1.conf
@@ -4,20 +4,24 @@ DEFAULTCONFIG = test_gnunet_daemon_hostlist_peer1.conf
4 4
5[resolver] 5[resolver]
6PORT = 12964 6PORT = 12964
7UNIXPATH = /tmp/gnunet-p1-service-resolver.sock
7 8
8[transport] 9[transport]
9PORT = 12965 10PORT = 12965
11UNIXPATH = /tmp/gnunet-p1-service-transport.sock
10PLUGINS = tcp 12PLUGINS = tcp
11#DEBUG = YES 13#DEBUG = YES
12DEBUG = NO 14DEBUG = NO
13 15
14[arm] 16[arm]
15PORT = 12966 17PORT = 12966
18UNIXPATH = /tmp/gnunet-p1-service-arm.sock
16DEFAULTSERVICES = hostlist topology 19DEFAULTSERVICES = hostlist topology
17#GLOBAL_PREFIX = xterm -e gdb -x cmd --args 20#GLOBAL_PREFIX = xterm -e gdb -x cmd --args
18 21
19[statistics] 22[statistics]
20PORT = 12967 23PORT = 12967
24UNIXPATH = /tmp/gnunet-p1-service-statistics.sock
21 25
22[transport-tcp] 26[transport-tcp]
23PORT = 12968 27PORT = 12968
@@ -25,9 +29,11 @@ DEBUG = NO
25 29
26[peerinfo] 30[peerinfo]
27PORT = 12969 31PORT = 12969
32UNIXPATH = /tmp/gnunet-p1-service-peerinfo.sock
28 33
29[core] 34[core]
30PORT = 12970 35PORT = 12970
36UNIXPATH = /tmp/gnunet-p1-service-core.sock
31#DEBUG = YES 37#DEBUG = YES
32#PREFIX = valgrind --tool=memcheck\ 38#PREFIX = valgrind --tool=memcheck\
33DEBUG = NO 39DEBUG = NO
diff --git a/src/hostlist/test_gnunet_daemon_hostlist_peer2.conf b/src/hostlist/test_gnunet_daemon_hostlist_peer2.conf
index c256c2829..dd47a27e6 100644
--- a/src/hostlist/test_gnunet_daemon_hostlist_peer2.conf
+++ b/src/hostlist/test_gnunet_daemon_hostlist_peer2.conf
@@ -4,21 +4,25 @@ DEFAULTCONFIG = test_gnunet_daemon_hostlist_peer2.conf
4 4
5[resolver] 5[resolver]
6PORT = 22964 6PORT = 22964
7UNIXPATH = /tmp/gnunet-p2-service-resolver.sock
7DEBUG = NO 8DEBUG = NO
8 9
9[transport] 10[transport]
10PORT = 22965 11PORT = 22965
12UNIXPATH = /tmp/gnunet-p2-service-transport.sock
11PLUGINS = tcp 13PLUGINS = tcp
12DEBUG = NO 14DEBUG = NO
13 15
14[arm] 16[arm]
15PORT = 22966 17PORT = 22966
18UNIXPATH = /tmp/gnunet-p2-service-arm.sock
16DEFAULTSERVICES = hostlist topology 19DEFAULTSERVICES = hostlist topology
17#GLOBAL_PREFIX = xterm -e gdb -x cmd --args 20#GLOBAL_PREFIX = xterm -e gdb -x cmd --args
18DEBUG = NO 21DEBUG = NO
19 22
20[statistics] 23[statistics]
21PORT = 22967 24PORT = 22967
25UNIXPATH = /tmp/gnunet-p2-service-statistics.sock
22 26
23[transport-tcp] 27[transport-tcp]
24PORT = 22968 28PORT = 22968
@@ -26,9 +30,11 @@ DEBUG = NO
26 30
27[peerinfo] 31[peerinfo]
28PORT = 22969 32PORT = 22969
33UNIXPATH = /tmp/gnunet-p2-service-peerinfo.sock
29 34
30[core] 35[core]
31PORT = 22970 36PORT = 22970
37UNIXPATH = /tmp/gnunet-p2-service-core.sock
32DEBUG = NO 38DEBUG = NO
33#PREFIX = valgrind --tool=memcheck 39#PREFIX = valgrind --tool=memcheck
34 40
@@ -52,4 +58,4 @@ DEBUG = NO
52AUTOSTART = NO 58AUTOSTART = NO
53 59
54[datastore] 60[datastore]
55AUTOSTART = NO \ No newline at end of file 61AUTOSTART = NO
diff --git a/src/include/gnunet_connection_lib.h b/src/include/gnunet_connection_lib.h
index 9701eb149..1230c10c8 100644
--- a/src/include/gnunet_connection_lib.h
+++ b/src/include/gnunet_connection_lib.h
@@ -155,7 +155,28 @@ struct GNUNET_CONNECTION_Handle
155 const struct GNUNET_CONFIGURATION_Handle *cfg, 155 const struct GNUNET_CONFIGURATION_Handle *cfg,
156 const char *hostname, 156 const char *hostname,
157 uint16_t port, 157 uint16_t port,
158 size_t maxbuf); 158 size_t maxbuf);
159
160
161/**
162 * Create a socket handle by connecting to a UNIX domain service.
163 * This function returns immediately, even if the connection has not
164 * yet been established. This function only creates UNIX connections.
165 *
166 * @param sched scheduler to use
167 * @param cfg configuration to use
168 * @param unixpath path to connect to
169 * @param maxbuf maximum write buffer size for the socket (use
170 * 0 for sockets that need no write buffers, such as listen sockets)
171 * @return the socket handle, NULL on systems without UNIX support
172 */
173struct GNUNET_CONNECTION_Handle *
174GNUNET_CONNECTION_create_from_connect_to_unixpath (struct GNUNET_SCHEDULER_Handle *sched,
175 const struct
176 GNUNET_CONFIGURATION_Handle *cfg,
177 const char *unixpath,
178 size_t maxbuf);
179
159 180
160 181
161 182
diff --git a/src/include/platform.h b/src/include/platform.h
index 0d39eaf10..fb9c992ec 100644
--- a/src/include/platform.h
+++ b/src/include/platform.h
@@ -82,6 +82,7 @@
82#ifndef MINGW 82#ifndef MINGW
83#include <netdb.h> 83#include <netdb.h>
84#include <sys/socket.h> 84#include <sys/socket.h>
85#include <sys/un.h>
85#include <netinet/in.h> 86#include <netinet/in.h>
86#include <netinet/ip.h> /* superset of previous */ 87#include <netinet/ip.h> /* superset of previous */
87#include <arpa/inet.h> 88#include <arpa/inet.h>
diff --git a/src/testing/test_testing_connect_peer1.conf b/src/testing/test_testing_connect_peer1.conf
index 76e5ee536..9b240c855 100644
--- a/src/testing/test_testing_connect_peer1.conf
+++ b/src/testing/test_testing_connect_peer1.conf
@@ -4,10 +4,12 @@ DEFAULTCONFIG = test_testing_connect_peer1.conf
4 4
5[resolver] 5[resolver]
6PORT = 12564 6PORT = 12564
7UNIXPATH = /tmp/gnunet-p1-service-resolver.sock
7HOSTNAME = localhost 8HOSTNAME = localhost
8 9
9[transport] 10[transport]
10PORT = 12565 11PORT = 12565
12UNIXPATH = /tmp/gnunet-p1-service-transport.sock
11HOSTNAME = localhost 13HOSTNAME = localhost
12PLUGINS = tcp 14PLUGINS = tcp
13#PREFIX = xterm -e xterm -T transport -e gdb -x cmd --args 15#PREFIX = xterm -e xterm -T transport -e gdb -x cmd --args
@@ -15,12 +17,14 @@ PLUGINS = tcp
15 17
16[arm] 18[arm]
17PORT = 12566 19PORT = 12566
20UNIXPATH = /tmp/gnunet-p1-service-arm.sock
18HOSTNAME = localhost 21HOSTNAME = localhost
19DEFAULTSERVICES = 22DEFAULTSERVICES =
20#DEBUG = YES 23#DEBUG = YES
21 24
22[statistics] 25[statistics]
23PORT = 12567 26PORT = 12567
27UNIXPATH = /tmp/gnunet-p1-service-statistics.sock
24HOSTNAME = localhost 28HOSTNAME = localhost
25 29
26[transport-tcp] 30[transport-tcp]
@@ -28,10 +32,12 @@ PORT = 12568
28 32
29[peerinfo] 33[peerinfo]
30PORT = 12569 34PORT = 12569
35UNIXPATH = /tmp/gnunet-p1-service-peerinfo.sock
31HOSTNAME = localhost 36HOSTNAME = localhost
32 37
33[core] 38[core]
34PORT = 12570 39PORT = 12570
40UNIXPATH = /tmp/gnunet-p1-service-core.sock
35HOSTNAME = localhost 41HOSTNAME = localhost
36#DEBUG = YES 42#DEBUG = YES
37 43
diff --git a/src/testing/test_testing_connect_peer2.conf b/src/testing/test_testing_connect_peer2.conf
index 5e8ae7a18..5d4237343 100644
--- a/src/testing/test_testing_connect_peer2.conf
+++ b/src/testing/test_testing_connect_peer2.conf
@@ -4,10 +4,12 @@ DEFAULTCONFIG = test_testing_connect_peer2.conf
4 4
5[resolver] 5[resolver]
6PORT = 22564 6PORT = 22564
7UNIXPATH = /tmp/gnunet-p2-service-resolver.sock
7HOSTNAME = localhost 8HOSTNAME = localhost
8 9
9[transport] 10[transport]
10PORT = 22565 11PORT = 22565
12UNIXPATH = /tmp/gnunet-p2-service-transport.sock
11HOSTNAME = localhost 13HOSTNAME = localhost
12PLUGINS = tcp 14PLUGINS = tcp
13#PREFIX = xterm -e xterm -T transport -e gdb -x cmd --args 15#PREFIX = xterm -e xterm -T transport -e gdb -x cmd --args
@@ -15,12 +17,14 @@ PLUGINS = tcp
15 17
16[arm] 18[arm]
17PORT = 22566 19PORT = 22566
20UNIXPATH = /tmp/gnunet-p2-service-arm.sock
18DEFAULTSERVICES = 21DEFAULTSERVICES =
19HOSTNAME = localhost 22HOSTNAME = localhost
20#DEBUG = YES 23#DEBUG = YES
21 24
22[statistics] 25[statistics]
23PORT = 22567 26PORT = 22567
27UNIXPATH = /tmp/gnunet-p2-service-statistics.sock
24HOSTNAME = localhost 28HOSTNAME = localhost
25 29
26[transport-tcp] 30[transport-tcp]
@@ -28,10 +32,12 @@ PORT = 22568
28 32
29[peerinfo] 33[peerinfo]
30PORT = 22569 34PORT = 22569
35UNIXPATH = /tmp/gnunet-p2-service-peerinfo.sock
31HOSTNAME = localhost 36HOSTNAME = localhost
32 37
33[core] 38[core]
34PORT = 22570 39PORT = 22570
40UNIXPATH = /tmp/gnunet-p2-service-core.sock
35HOSTNAME = localhost 41HOSTNAME = localhost
36#DEBUG = YES 42#DEBUG = YES
37 43
diff --git a/src/testing/testing_group.c b/src/testing/testing_group.c
index bf90ea4b0..2920594c5 100644
--- a/src/testing/testing_group.c
+++ b/src/testing/testing_group.c
@@ -313,8 +313,9 @@ uid_from_hash (const GNUNET_HashCode *hash, uint32_t *uid)
313struct UpdateContext 313struct UpdateContext
314{ 314{
315 struct GNUNET_CONFIGURATION_Handle *ret; 315 struct GNUNET_CONFIGURATION_Handle *ret;
316 unsigned int nport;
317 const char *hostname; 316 const char *hostname;
317 unsigned int nport;
318 unsigned int upnum;
318}; 319};
319 320
320 321
@@ -351,11 +352,25 @@ update_config (void *cls,
351 struct UpdateContext *ctx = cls; 352 struct UpdateContext *ctx = cls;
352 unsigned int ival; 353 unsigned int ival;
353 char cval[12]; 354 char cval[12];
355 char uval[128];
354 356
355 if ((0 == strcmp (option, "PORT")) && (1 == sscanf (value, "%u", &ival))) 357 if ((0 == strcmp (option, "PORT")) && (1 == sscanf (value, "%u", &ival)))
356 { 358 {
357 GNUNET_snprintf (cval, sizeof (cval), "%u", ctx->nport++); 359 if (ival != 0)
358 value = cval; 360 {
361 GNUNET_snprintf (cval, sizeof (cval), "%u", ctx->nport++);
362 value = cval;
363 }
364 }
365
366 if (0 == strcmp (option, "UNIXPATH"))
367 {
368 GNUNET_snprintf (uval,
369 sizeof (uval),
370 "/tmp/test-service-%s-%u",
371 section,
372 ctx->upnum++);
373 value = uval;
359 } 374 }
360 375
361 if ((0 == strcmp (option, "HOSTNAME")) && (ctx->hostname != NULL)) 376 if ((0 == strcmp (option, "HOSTNAME")) && (ctx->hostname != NULL))
@@ -376,12 +391,16 @@ update_config (void *cls,
376 * @param cfg template configuration 391 * @param cfg template configuration
377 * @param port port numbers to use, update to reflect 392 * @param port port numbers to use, update to reflect
378 * port numbers that were used 393 * port numbers that were used
394 * @param upnum number to make unix domain socket names unique
379 * @param hostname hostname of the controlling host, to allow control connections from 395 * @param hostname hostname of the controlling host, to allow control connections from
380 * 396 *
381 * @return new configuration, NULL on error 397 * @return new configuration, NULL on error
382 */ 398 */
383static struct GNUNET_CONFIGURATION_Handle * 399static struct GNUNET_CONFIGURATION_Handle *
384make_config (const struct GNUNET_CONFIGURATION_Handle *cfg, uint16_t * port, const char *hostname) 400make_config (const struct GNUNET_CONFIGURATION_Handle *cfg,
401 uint16_t * port,
402 uint32_t * upnum,
403 const char *hostname)
385{ 404{
386 struct UpdateContext uc; 405 struct UpdateContext uc;
387 uint16_t orig; 406 uint16_t orig;
@@ -390,6 +409,7 @@ make_config (const struct GNUNET_CONFIGURATION_Handle *cfg, uint16_t * port, con
390 409
391 orig = *port; 410 orig = *port;
392 uc.nport = *port; 411 uc.nport = *port;
412 uc.upnum = *upnum;
393 uc.ret = GNUNET_CONFIGURATION_create (); 413 uc.ret = GNUNET_CONFIGURATION_create ();
394 uc.hostname = hostname; 414 uc.hostname = hostname;
395 415
@@ -420,6 +440,7 @@ make_config (const struct GNUNET_CONFIGURATION_Handle *cfg, uint16_t * port, con
420 } 440 }
421 441
422 *port = (uint16_t) uc.nport; 442 *port = (uint16_t) uc.nport;
443 *upnum = uc.upnum;
423 return uc.ret; 444 return uc.ret;
424} 445}
425 446
@@ -2499,13 +2520,14 @@ GNUNET_TESTING_daemons_start (struct GNUNET_SCHEDULER_Handle *sched,
2499 unsigned int off; 2520 unsigned int off;
2500 unsigned int hostcnt; 2521 unsigned int hostcnt;
2501 uint16_t minport; 2522 uint16_t minport;
2523 uint32_t upnum;
2502 2524
2503 if (0 == total) 2525 if (0 == total)
2504 { 2526 {
2505 GNUNET_break (0); 2527 GNUNET_break (0);
2506 return NULL; 2528 return NULL;
2507 } 2529 }
2508 2530 upnum = 0;
2509 pg = GNUNET_malloc (sizeof (struct GNUNET_TESTING_PeerGroup)); 2531 pg = GNUNET_malloc (sizeof (struct GNUNET_TESTING_PeerGroup));
2510 pg->sched = sched; 2532 pg->sched = sched;
2511 pg->cfg = cfg; 2533 pg->cfg = cfg;
@@ -2571,12 +2593,18 @@ GNUNET_TESTING_daemons_start (struct GNUNET_SCHEDULER_Handle *sched,
2571 if (hostcnt > 0) 2593 if (hostcnt > 0)
2572 { 2594 {
2573 hostname = pg->hosts[off % hostcnt].hostname; 2595 hostname = pg->hosts[off % hostcnt].hostname;
2574 pcfg = make_config (cfg, &pg->hosts[off % hostcnt].minport, hostname); 2596 pcfg = make_config (cfg,
2597 &pg->hosts[off % hostcnt].minport,
2598 &upnum,
2599 hostname);
2575 } 2600 }
2576 else 2601 else
2577 { 2602 {
2578 hostname = NULL; 2603 hostname = NULL;
2579 pcfg = make_config (cfg, &minport, hostname); 2604 pcfg = make_config (cfg,
2605 &minport,
2606 &upnum,
2607 hostname);
2580 } 2608 }
2581 2609
2582 if (NULL == pcfg) 2610 if (NULL == pcfg)
diff --git a/src/transport/test_transport_api_http_peer1.conf b/src/transport/test_transport_api_http_peer1.conf
index 539e9ab6c..793e12cc0 100644
--- a/src/transport/test_transport_api_http_peer1.conf
+++ b/src/transport/test_transport_api_http_peer1.conf
@@ -40,6 +40,7 @@ CONFIG = $DEFAULTCONFIG
40HOME = $SERVICEHOME 40HOME = $SERVICEHOME
41HOSTNAME = localhost 41HOSTNAME = localhost
42PORT = 12365 42PORT = 12365
43UNIXPATH = /tmp/gnunet-p1-service-transport.sock
43 44
44[peerinfo] 45[peerinfo]
45TRUST = $SERVICEHOME/data/credit/ 46TRUST = $SERVICEHOME/data/credit/
@@ -51,6 +52,7 @@ CONFIG = $DEFAULTCONFIG
51HOME = $SERVICEHOME 52HOME = $SERVICEHOME
52HOSTNAME = localhost 53HOSTNAME = localhost
53PORT = 12369 54PORT = 12369
55UNIXPATH = /tmp/gnunet-p1-service-peerinfo.sock
54 56
55[resolver] 57[resolver]
56ACCEPT_FROM6 = ::1; 58ACCEPT_FROM6 = ::1;
@@ -60,6 +62,7 @@ CONFIG = $DEFAULTCONFIG
60HOME = $SERVICEHOME 62HOME = $SERVICEHOME
61HOSTNAME = localhost 63HOSTNAME = localhost
62PORT = 12364 64PORT = 12364
65UNIXPATH = /tmp/gnunet-p1-service-resolver.sock
63 66
64[statistics] 67[statistics]
65ACCEPT_FROM6 = ::1; 68ACCEPT_FROM6 = ::1;
@@ -69,6 +72,7 @@ CONFIG = $DEFAULTCONFIG
69HOME = $SERVICEHOME 72HOME = $SERVICEHOME
70HOSTNAME = localhost 73HOSTNAME = localhost
71PORT = 12367 74PORT = 12367
75UNIXPATH = /tmp/gnunet-p1-service-statistics.sock
72 76
73[arm] 77[arm]
74DEFAULTSERVICES = 78DEFAULTSERVICES =
@@ -79,6 +83,7 @@ CONFIG = $DEFAULTCONFIG
79HOME = $SERVICEHOME 83HOME = $SERVICEHOME
80HOSTNAME = localhost 84HOSTNAME = localhost
81PORT = 12366 85PORT = 12366
86UNIXPATH = /tmp/gnunet-p1-service-arm.sock
82 87
83[transport-http] 88[transport-http]
84PORT = 12389 89PORT = 12389
diff --git a/src/transport/test_transport_api_http_peer2.conf b/src/transport/test_transport_api_http_peer2.conf
index 1cbe8cae0..00b90358f 100644
--- a/src/transport/test_transport_api_http_peer2.conf
+++ b/src/transport/test_transport_api_http_peer2.conf
@@ -43,6 +43,7 @@ CONFIG = $DEFAULTCONFIG
43HOME = $SERVICEHOME 43HOME = $SERVICEHOME
44HOSTNAME = localhost 44HOSTNAME = localhost
45PORT = 22365 45PORT = 22365
46UNIXPATH = /tmp/gnunet-p2-service-transport.sock
46#PREFIX = xterm -T transport1 -e gdb --command=cmd --args 47#PREFIX = xterm -T transport1 -e gdb --command=cmd --args
47#PREFIX = valgrind --leak-check=full 48#PREFIX = valgrind --leak-check=full
48 49
@@ -56,6 +57,7 @@ CONFIG = $DEFAULTCONFIG
56HOME = $SERVICEHOME 57HOME = $SERVICEHOME
57HOSTNAME = localhost 58HOSTNAME = localhost
58PORT = 22369 59PORT = 22369
60UNIXPATH = /tmp/gnunet-p2-service-peerinfo.sock
59 61
60[resolver] 62[resolver]
61ACCEPT_FROM6 = ::1; 63ACCEPT_FROM6 = ::1;
@@ -65,6 +67,7 @@ CONFIG = $DEFAULTCONFIG
65HOME = $SERVICEHOME 67HOME = $SERVICEHOME
66HOSTNAME = localhost 68HOSTNAME = localhost
67PORT = 22364 69PORT = 22364
70UNIXPATH = /tmp/gnunet-p2-service-resolver.sock
68 71
69[statistics] 72[statistics]
70ACCEPT_FROM6 = ::1; 73ACCEPT_FROM6 = ::1;
@@ -74,6 +77,8 @@ CONFIG = $DEFAULTCONFIG
74HOME = $SERVICEHOME 77HOME = $SERVICEHOME
75HOSTNAME = localhost 78HOSTNAME = localhost
76PORT = 22367 79PORT = 22367
80UNIXPATH = /tmp/gnunet-p2-service-statistics.sock
81
77 82
78[arm] 83[arm]
79DEFAULTSERVICES = 84DEFAULTSERVICES =
@@ -84,6 +89,8 @@ CONFIG = $DEFAULTCONFIG
84HOME = $SERVICEHOME 89HOME = $SERVICEHOME
85HOSTNAME = localhost 90HOSTNAME = localhost
86PORT = 22366 91PORT = 22366
92UNIXPATH = /tmp/gnunet-p2-service-arm.sock
93
87 94
88[transport-http] 95[transport-http]
89PORT = 22389 96PORT = 22389
diff --git a/src/transport/test_transport_api_tcp_peer1.conf b/src/transport/test_transport_api_tcp_peer1.conf
index 97e2111c8..f5bdc2063 100644
--- a/src/transport/test_transport_api_tcp_peer1.conf
+++ b/src/transport/test_transport_api_tcp_peer1.conf
@@ -43,6 +43,7 @@ CONFIG = $DEFAULTCONFIG
43HOME = $SERVICEHOME 43HOME = $SERVICEHOME
44HOSTNAME = localhost 44HOSTNAME = localhost
45PORT = 12365 45PORT = 12365
46UNIXPATH = /tmp/gnunet-p1-service-transport.sock
46 47
47[peerinfo] 48[peerinfo]
48TRUST = $SERVICEHOME/data/credit/ 49TRUST = $SERVICEHOME/data/credit/
@@ -54,6 +55,7 @@ CONFIG = $DEFAULTCONFIG
54HOME = $SERVICEHOME 55HOME = $SERVICEHOME
55HOSTNAME = localhost 56HOSTNAME = localhost
56PORT = 12369 57PORT = 12369
58UNIXPATH = /tmp/gnunet-p1-service-peerinfo.sock
57 59
58[resolver] 60[resolver]
59ACCEPT_FROM6 = ::1; 61ACCEPT_FROM6 = ::1;
@@ -62,7 +64,8 @@ BINARY = gnunet-service-resolver
62CONFIG = $DEFAULTCONFIG 64CONFIG = $DEFAULTCONFIG
63HOME = $SERVICEHOME 65HOME = $SERVICEHOME
64HOSTNAME = localhost 66HOSTNAME = localhost
65PORT = 12364 67PORT = 1236
68UNIXPATH = /tmp/gnunet-p1-service-resolver.sock
66 69
67[statistics] 70[statistics]
68ACCEPT_FROM6 = ::1; 71ACCEPT_FROM6 = ::1;
@@ -72,6 +75,7 @@ CONFIG = $DEFAULTCONFIG
72HOME = $SERVICEHOME 75HOME = $SERVICEHOME
73HOSTNAME = localhost 76HOSTNAME = localhost
74PORT = 12367 77PORT = 12367
78UNIXPATH = /tmp/gnunet-p1-service-statistics.sock
75 79
76[arm] 80[arm]
77DEFAULTSERVICES = transport statistics 81DEFAULTSERVICES = transport statistics
@@ -82,6 +86,7 @@ CONFIG = $DEFAULTCONFIG
82HOME = $SERVICEHOME 86HOME = $SERVICEHOME
83HOSTNAME = localhost 87HOSTNAME = localhost
84PORT = 12366 88PORT = 12366
89UNIXPATH = /tmp/gnunet-p1-service-arm.sock
85 90
86[transport-tcp] 91[transport-tcp]
87TIMEOUT = 300000 92TIMEOUT = 300000
diff --git a/src/transport/test_transport_api_tcp_peer2.conf b/src/transport/test_transport_api_tcp_peer2.conf
index f6ab6c231..f2c22e336 100644
--- a/src/transport/test_transport_api_tcp_peer2.conf
+++ b/src/transport/test_transport_api_tcp_peer2.conf
@@ -42,6 +42,7 @@ CONFIG = $DEFAULTCONFIG
42HOME = $SERVICEHOME 42HOME = $SERVICEHOME
43HOSTNAME = localhost 43HOSTNAME = localhost
44PORT = 22365 44PORT = 22365
45UNIXPATH = /tmp/gnunet-p2-service-transport.sock
45#PREFIX = xterm -T transport1 -e gdb --command=cmd --args 46#PREFIX = xterm -T transport1 -e gdb --command=cmd --args
46#PREFIX = valgrind --leak-check=full 47#PREFIX = valgrind --leak-check=full
47 48
@@ -55,6 +56,7 @@ CONFIG = $DEFAULTCONFIG
55HOME = $SERVICEHOME 56HOME = $SERVICEHOME
56HOSTNAME = localhost 57HOSTNAME = localhost
57PORT = 22369 58PORT = 22369
59UNIXPATH = /tmp/gnunet-p2-service-peerinfo.sock
58 60
59[resolver] 61[resolver]
60ACCEPT_FROM6 = ::1; 62ACCEPT_FROM6 = ::1;
@@ -64,6 +66,7 @@ CONFIG = $DEFAULTCONFIG
64HOME = $SERVICEHOME 66HOME = $SERVICEHOME
65HOSTNAME = localhost 67HOSTNAME = localhost
66PORT = 22364 68PORT = 22364
69UNIXPATH = /tmp/gnunet-p2-service-resolver.sock
67 70
68[statistics] 71[statistics]
69ACCEPT_FROM6 = ::1; 72ACCEPT_FROM6 = ::1;
@@ -73,6 +76,7 @@ CONFIG = $DEFAULTCONFIG
73HOME = $SERVICEHOME 76HOME = $SERVICEHOME
74HOSTNAME = localhost 77HOSTNAME = localhost
75PORT = 22367 78PORT = 22367
79UNIXPATH = /tmp/gnunet-p2-service-statistics.sock
76 80
77[arm] 81[arm]
78DEFAULTSERVICES = transport statistics 82DEFAULTSERVICES = transport statistics
@@ -83,6 +87,7 @@ CONFIG = $DEFAULTCONFIG
83HOME = $SERVICEHOME 87HOME = $SERVICEHOME
84HOSTNAME = localhost 88HOSTNAME = localhost
85PORT = 22366 89PORT = 22366
90UNIXPATH = /tmp/gnunet-p2-service-arm.sock
86 91
87[transport-tcp] 92[transport-tcp]
88TIMEOUT = 300000 93TIMEOUT = 300000
diff --git a/src/transport/test_transport_api_udp_nat_peer1.conf b/src/transport/test_transport_api_udp_nat_peer1.conf
index d2ab3ecee..0956c83eb 100644
--- a/src/transport/test_transport_api_udp_nat_peer1.conf
+++ b/src/transport/test_transport_api_udp_nat_peer1.conf
@@ -5,29 +5,13 @@ INTERNAL_ADDRESS = 127.0.0.1
5EXTERNAL_ADDRESS = 127.0.0.1 5EXTERNAL_ADDRESS = 127.0.0.1
6 6
7[fs] 7[fs]
8ACCEPT_FROM6 = ::1; 8AUTOSTART = NO
9ACCEPT_FROM = 127.0.0.1;
10BINARY = gnunet-service-fs
11CONFIG = $DEFAULTCONFIG
12HOME = $SERVICEHOME
13HOSTNAME = localhost
14PORT = 2094
15INDEXDB = $SERVICEHOME/idxinfo.lst
16 9
17[datastore-sqlite] 10[datastore-sqlite]
18FILENAME = $SERVICEHOME/datastore/sqlite.db 11FILENAME = $SERVICEHOME/datastore/sqlite.db
19 12
20[datastore] 13[datastore]
21DATABASE = sqlite 14AUTOSTART = NO
22BLOOMFILTER = $SERVICEHOME/fs/bloomfilter
23QUOTA = 100000000
24ACCEPT_FROM6 = ::1;
25ACCEPT_FROM = 127.0.0.1;
26BINARY = gnunet-service-datastore
27CONFIG = $DEFAULTCONFIG
28HOME = $SERVICEHOME
29HOSTNAME = localhost
30PORT = 2093
31 15
32[hostlist] 16[hostlist]
33HTTP-PROXY = 17HTTP-PROXY =
@@ -49,15 +33,7 @@ FRIENDS-ONLY = NO
49MINIMUM-FRIENDS = 0 33MINIMUM-FRIENDS = 0
50 34
51[core] 35[core]
52TOTAL_QUOTA_OUT = 3932160 36AUTOSTART = NO
53TOTAL_QUOTA_IN = 3932160
54ACCEPT_FROM6 = ::1;
55ACCEPT_FROM = 127.0.0.1;
56BINARY = gnunet-service-core
57CONFIG = $DEFAULTCONFIG
58HOME = $SERVICEHOME
59HOSTNAME = localhost
60PORT = 2092
61 37
62[transport] 38[transport]
63PLUGINS = udp_nat 39PLUGINS = udp_nat
@@ -70,6 +46,7 @@ CONFIG = $DEFAULTCONFIG
70HOME = $SERVICEHOME 46HOME = $SERVICEHOME
71HOSTNAME = localhost 47HOSTNAME = localhost
72PORT = 12365 48PORT = 12365
49UNIXPATH = /tmp/gnunet-p1-service-transport.sock
73#PREFIX = valgrind --track-origins=yes --leak-check=full --log-file=valgrind_udp_peer1.log 50#PREFIX = valgrind --track-origins=yes --leak-check=full --log-file=valgrind_udp_peer1.log
74#PREFIX = xterm -e xterm -T transport -e gdb --args 51#PREFIX = xterm -e xterm -T transport -e gdb --args
75 52
@@ -83,6 +60,7 @@ CONFIG = $DEFAULTCONFIG
83HOME = $SERVICEHOME 60HOME = $SERVICEHOME
84HOSTNAME = localhost 61HOSTNAME = localhost
85PORT = 12369 62PORT = 12369
63UNIXPATH = /tmp/gnunet-p1-service-peerinfo.sock
86 64
87[resolver] 65[resolver]
88ACCEPT_FROM6 = ::1; 66ACCEPT_FROM6 = ::1;
@@ -92,6 +70,7 @@ CONFIG = $DEFAULTCONFIG
92HOME = $SERVICEHOME 70HOME = $SERVICEHOME
93HOSTNAME = localhost 71HOSTNAME = localhost
94PORT = 12364 72PORT = 12364
73UNIXPATH = /tmp/gnunet-p1-service-resolver.sock
95 74
96[statistics] 75[statistics]
97ACCEPT_FROM6 = ::1; 76ACCEPT_FROM6 = ::1;
@@ -101,6 +80,7 @@ CONFIG = $DEFAULTCONFIG
101HOME = $SERVICEHOME 80HOME = $SERVICEHOME
102HOSTNAME = localhost 81HOSTNAME = localhost
103PORT = 12367 82PORT = 12367
83UNIXPATH = /tmp/gnunet-p1-service-statistics.sock
104 84
105[arm] 85[arm]
106DEFAULTSERVICES = 86DEFAULTSERVICES =
@@ -111,6 +91,7 @@ CONFIG = $DEFAULTCONFIG
111HOME = $SERVICEHOME 91HOME = $SERVICEHOME
112HOSTNAME = localhost 92HOSTNAME = localhost
113PORT = 12366 93PORT = 12366
94UNIXPATH = /tmp/gnunet-p1-service-arm.sock
114 95
115[transport-tcp] 96[transport-tcp]
116TIMEOUT = 300000 97TIMEOUT = 300000
diff --git a/src/transport/test_transport_api_udp_nat_peer2.conf b/src/transport/test_transport_api_udp_nat_peer2.conf
index 32d8cab23..3dc4d672b 100644
--- a/src/transport/test_transport_api_udp_nat_peer2.conf
+++ b/src/transport/test_transport_api_udp_nat_peer2.conf
@@ -5,29 +5,10 @@ EXTERNAL_ADDRESS = 127.0.0.1
5INTERNAL_ADDRESS = 127.0.0.1 5INTERNAL_ADDRESS = 127.0.0.1
6 6
7[fs] 7[fs]
8ACCEPT_FROM6 = ::1; 8AUTOSTART = NO
9ACCEPT_FROM = 127.0.0.1;
10BINARY = gnunet-service-fs
11CONFIG = $DEFAULTCONFIG
12HOME = $SERVICEHOME
13HOSTNAME = localhost
14PORT = 2094
15INDEXDB = $SERVICEHOME/idxinfo.lst
16
17[datastore-sqlite]
18FILENAME = $SERVICEHOME/datastore/sqlite.db
19 9
20[datastore] 10[datastore]
21DATABASE = sqlite 11AUTOSTART = NO
22BLOOMFILTER = $SERVICEHOME/fs/bloomfilter
23QUOTA = 100000000
24ACCEPT_FROM6 = ::1;
25ACCEPT_FROM = 127.0.0.1;
26BINARY = gnunet-service-datastore
27CONFIG = $DEFAULTCONFIG
28HOME = $SERVICEHOME
29HOSTNAME = localhost
30PORT = 2093
31 12
32[hostlist] 13[hostlist]
33HTTP-PROXY = 14HTTP-PROXY =
@@ -49,15 +30,7 @@ FRIENDS-ONLY = NO
49MINIMUM-FRIENDS = 0 30MINIMUM-FRIENDS = 0
50 31
51[core] 32[core]
52TOTAL_QUOTA_OUT = 3932160 33AUTOSTART = NO
53TOTAL_QUOTA_IN = 3932160
54ACCEPT_FROM6 = ::1;
55ACCEPT_FROM = 127.0.0.1;
56BINARY = gnunet-service-core
57CONFIG = $DEFAULTCONFIG
58HOME = $SERVICEHOME
59HOSTNAME = localhost
60PORT = 2092
61 34
62[transport] 35[transport]
63PLUGINS = udp_nat 36PLUGINS = udp_nat
@@ -71,6 +44,7 @@ CONFIG = $DEFAULTCONFIG
71HOME = $SERVICEHOME 44HOME = $SERVICEHOME
72HOSTNAME = localhost 45HOSTNAME = localhost
73PORT = 22365 46PORT = 22365
47UNIXPATH = /tmp/gnunet-p2-service-transport.sock
74#PREFIX = xterm -e xterm -T transport -e gdb --args 48#PREFIX = xterm -e xterm -T transport -e gdb --args
75 49
76[peerinfo] 50[peerinfo]
@@ -83,6 +57,7 @@ CONFIG = $DEFAULTCONFIG
83HOME = $SERVICEHOME 57HOME = $SERVICEHOME
84HOSTNAME = localhost 58HOSTNAME = localhost
85PORT = 22369 59PORT = 22369
60UNIXPATH = /tmp/gnunet-p2-service-peerinfo.sock
86 61
87[resolver] 62[resolver]
88ACCEPT_FROM6 = ::1; 63ACCEPT_FROM6 = ::1;
@@ -92,6 +67,7 @@ CONFIG = $DEFAULTCONFIG
92HOME = $SERVICEHOME 67HOME = $SERVICEHOME
93HOSTNAME = localhost 68HOSTNAME = localhost
94PORT = 22364 69PORT = 22364
70UNIXPATH = /tmp/gnunet-p2-service-resolver.sock
95 71
96[statistics] 72[statistics]
97ACCEPT_FROM6 = ::1; 73ACCEPT_FROM6 = ::1;
@@ -101,6 +77,7 @@ CONFIG = $DEFAULTCONFIG
101HOME = $SERVICEHOME 77HOME = $SERVICEHOME
102HOSTNAME = localhost 78HOSTNAME = localhost
103PORT = 22367 79PORT = 22367
80UNIXPATH = /tmp/gnunet-p2-service-statistics.sock
104 81
105[arm] 82[arm]
106DEFAULTSERVICES = 83DEFAULTSERVICES =
@@ -111,6 +88,7 @@ CONFIG = $DEFAULTCONFIG
111HOME = $SERVICEHOME 88HOME = $SERVICEHOME
112HOSTNAME = localhost 89HOSTNAME = localhost
113PORT = 22366 90PORT = 22366
91UNIXPATH = /tmp/gnunet-p2-service-arm.sock
114 92
115[transport-tcp] 93[transport-tcp]
116TIMEOUT = 300000 94TIMEOUT = 300000
diff --git a/src/transport/test_transport_api_udp_peer1.conf b/src/transport/test_transport_api_udp_peer1.conf
index e1ff1644e..49efbff63 100644
--- a/src/transport/test_transport_api_udp_peer1.conf
+++ b/src/transport/test_transport_api_udp_peer1.conf
@@ -30,15 +30,7 @@ FRIENDS-ONLY = NO
30MINIMUM-FRIENDS = 0 30MINIMUM-FRIENDS = 0
31 31
32[core] 32[core]
33TOTAL_QUOTA_OUT = 3932160 33AUTOSTART = NO
34TOTAL_QUOTA_IN = 3932160
35ACCEPT_FROM6 = ::1;
36ACCEPT_FROM = 127.0.0.1;
37BINARY = gnunet-service-core
38CONFIG = $DEFAULTCONFIG
39HOME = $SERVICEHOME
40HOSTNAME = localhost
41PORT = 2092
42 34
43[transport] 35[transport]
44PLUGINS = udp 36PLUGINS = udp
@@ -51,6 +43,7 @@ CONFIG = $DEFAULTCONFIG
51HOME = $SERVICEHOME 43HOME = $SERVICEHOME
52HOSTNAME = localhost 44HOSTNAME = localhost
53PORT = 12365 45PORT = 12365
46UNIXPATH = /tmp/gnunet-p1-service-transport.sock
54#PREFIX = valgrind --track-origins=yes --leak-check=full --log-file=valgrind_udp_peer1.log 47#PREFIX = valgrind --track-origins=yes --leak-check=full --log-file=valgrind_udp_peer1.log
55#PREFIX = xterm -e xterm -T transport -e gdb --args 48#PREFIX = xterm -e xterm -T transport -e gdb --args
56 49
@@ -64,6 +57,7 @@ CONFIG = $DEFAULTCONFIG
64HOME = $SERVICEHOME 57HOME = $SERVICEHOME
65HOSTNAME = localhost 58HOSTNAME = localhost
66PORT = 12369 59PORT = 12369
60UNIXPATH = /tmp/gnunet-p1-service-peerinfo.sock
67 61
68[resolver] 62[resolver]
69ACCEPT_FROM6 = ::1; 63ACCEPT_FROM6 = ::1;
@@ -73,6 +67,7 @@ CONFIG = $DEFAULTCONFIG
73HOME = $SERVICEHOME 67HOME = $SERVICEHOME
74HOSTNAME = localhost 68HOSTNAME = localhost
75PORT = 12364 69PORT = 12364
70UNIXPATH = /tmp/gnunet-p1-service-resolver.sock
76 71
77[statistics] 72[statistics]
78ACCEPT_FROM6 = ::1; 73ACCEPT_FROM6 = ::1;
@@ -82,6 +77,7 @@ CONFIG = $DEFAULTCONFIG
82HOME = $SERVICEHOME 77HOME = $SERVICEHOME
83HOSTNAME = localhost 78HOSTNAME = localhost
84PORT = 12367 79PORT = 12367
80UNIXPATH = /tmp/gnunet-p1-service-statistics.sock
85 81
86[arm] 82[arm]
87DEFAULTSERVICES = 83DEFAULTSERVICES =
@@ -92,6 +88,7 @@ CONFIG = $DEFAULTCONFIG
92HOME = $SERVICEHOME 88HOME = $SERVICEHOME
93HOSTNAME = localhost 89HOSTNAME = localhost
94PORT = 12366 90PORT = 12366
91UNIXPATH = /tmp/gnunet-p1-service-arm.sock
95 92
96[transport-tcp] 93[transport-tcp]
97TIMEOUT = 300000 94TIMEOUT = 300000
diff --git a/src/transport/test_transport_api_udp_peer2.conf b/src/transport/test_transport_api_udp_peer2.conf
index cb4d4778d..2259e23f7 100644
--- a/src/transport/test_transport_api_udp_peer2.conf
+++ b/src/transport/test_transport_api_udp_peer2.conf
@@ -29,17 +29,6 @@ AUTOCONNECT = YES
29FRIENDS-ONLY = NO 29FRIENDS-ONLY = NO
30MINIMUM-FRIENDS = 0 30MINIMUM-FRIENDS = 0
31 31
32[core]
33TOTAL_QUOTA_OUT = 3932160
34TOTAL_QUOTA_IN = 3932160
35ACCEPT_FROM6 = ::1;
36ACCEPT_FROM = 127.0.0.1;
37BINARY = gnunet-service-core
38CONFIG = $DEFAULTCONFIG
39HOME = $SERVICEHOME
40HOSTNAME = localhost
41PORT = 2092
42
43[transport] 32[transport]
44PLUGINS = udp 33PLUGINS = udp
45DEBUG = NO 34DEBUG = NO
@@ -52,6 +41,7 @@ CONFIG = $DEFAULTCONFIG
52HOME = $SERVICEHOME 41HOME = $SERVICEHOME
53HOSTNAME = localhost 42HOSTNAME = localhost
54PORT = 22365 43PORT = 22365
44UNIXPATH = /tmp/gnunet-p1-service-transport.sock
55#PREFIX = valgrind --track-origins=yes --leak-check=full --log-file=valgrind_udp_peer2.log 45#PREFIX = valgrind --track-origins=yes --leak-check=full --log-file=valgrind_udp_peer2.log
56 46
57[peerinfo] 47[peerinfo]
@@ -64,6 +54,7 @@ CONFIG = $DEFAULTCONFIG
64HOME = $SERVICEHOME 54HOME = $SERVICEHOME
65HOSTNAME = localhost 55HOSTNAME = localhost
66PORT = 22369 56PORT = 22369
57UNIXPATH = /tmp/gnunet-p1-service-peerinfo.sock
67 58
68[resolver] 59[resolver]
69ACCEPT_FROM6 = ::1; 60ACCEPT_FROM6 = ::1;
@@ -73,6 +64,7 @@ CONFIG = $DEFAULTCONFIG
73HOME = $SERVICEHOME 64HOME = $SERVICEHOME
74HOSTNAME = localhost 65HOSTNAME = localhost
75PORT = 22364 66PORT = 22364
67UNIXPATH = /tmp/gnunet-p1-service-resolver.sock
76 68
77[statistics] 69[statistics]
78ACCEPT_FROM6 = ::1; 70ACCEPT_FROM6 = ::1;
@@ -82,6 +74,7 @@ CONFIG = $DEFAULTCONFIG
82HOME = $SERVICEHOME 74HOME = $SERVICEHOME
83HOSTNAME = localhost 75HOSTNAME = localhost
84PORT = 22367 76PORT = 22367
77UNIXPATH = /tmp/gnunet-p1-service-statistics.sock
85 78
86[arm] 79[arm]
87DEFAULTSERVICES = 80DEFAULTSERVICES =
@@ -92,6 +85,7 @@ CONFIG = $DEFAULTCONFIG
92HOME = $SERVICEHOME 85HOME = $SERVICEHOME
93HOSTNAME = localhost 86HOSTNAME = localhost
94PORT = 22366 87PORT = 22366
88UNIXPATH = /tmp/gnunet-p1-service-arm.sock
95 89
96[transport-tcp] 90[transport-tcp]
97TIMEOUT = 300000 91TIMEOUT = 300000
diff --git a/src/util/bandwidth.c b/src/util/bandwidth.c
index 124cede9b..e47df4382 100644
--- a/src/util/bandwidth.c
+++ b/src/util/bandwidth.c
@@ -211,7 +211,7 @@ int
211GNUNET_BANDWIDTH_tracker_consume (struct GNUNET_BANDWIDTH_Tracker *av, 211GNUNET_BANDWIDTH_tracker_consume (struct GNUNET_BANDWIDTH_Tracker *av,
212 ssize_t size) 212 ssize_t size)
213{ 213{
214 uint64_t nc; 214 int64_t nc;
215 215
216#if DEBUG_BANDWIDTH 216#if DEBUG_BANDWIDTH
217 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 217 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
diff --git a/src/util/client.c b/src/util/client.c
index f964b7322..c7853d146 100644
--- a/src/util/client.c
+++ b/src/util/client.c
@@ -250,19 +250,55 @@ struct GNUNET_CLIENT_Connection
250 * Are we ignoring shutdown signals? 250 * Are we ignoring shutdown signals?
251 */ 251 */
252 int ignore_shutdown; 252 int ignore_shutdown;
253
254 /**
255 * How often have we tried to connect?
256 */
257 unsigned int attempts;
253 258
254}; 259};
255 260
256 261
262/**
263 * Try to connect to the service.
264 *
265 * @param sched scheduler to use
266 * @param service_name name of service to connect to
267 * @param cfg configuration to use
268 * @param attempt counter used to alternate between IP and UNIX domain sockets
269 * @return NULL on error
270 */
257static struct GNUNET_CONNECTION_Handle * 271static struct GNUNET_CONNECTION_Handle *
258do_connect (struct GNUNET_SCHEDULER_Handle *sched, 272do_connect (struct GNUNET_SCHEDULER_Handle *sched,
259 const char *service_name, 273 const char *service_name,
260 const struct GNUNET_CONFIGURATION_Handle *cfg) 274 const struct GNUNET_CONFIGURATION_Handle *cfg,
275 unsigned int attempt)
261{ 276{
262 struct GNUNET_CONNECTION_Handle *sock; 277 struct GNUNET_CONNECTION_Handle *sock;
263 char *hostname; 278 char *hostname;
279 char *unixpath;
264 unsigned long long port; 280 unsigned long long port;
265 281
282#if AF_UNIX
283 if (0 == attempt % 2)
284 {
285 /* on even rounds, try UNIX */
286 if (GNUNET_OK ==
287 GNUNET_CONFIGURATION_get_value_string (cfg,
288 service_name,
289 "UNIXPATH", &unixpath))
290 {
291 sock = GNUNET_CONNECTION_create_from_connect_to_unixpath (sched,
292 cfg,
293 unixpath,
294 GNUNET_SERVER_MAX_MESSAGE_SIZE);
295 GNUNET_free (unixpath);
296 if (sock != NULL)
297 return sock;
298 }
299 }
300#endif
301
266 if ((GNUNET_OK != 302 if ((GNUNET_OK !=
267 GNUNET_CONFIGURATION_get_value_number (cfg, 303 GNUNET_CONFIGURATION_get_value_number (cfg,
268 service_name, 304 service_name,
@@ -314,10 +350,13 @@ GNUNET_CLIENT_connect (struct GNUNET_SCHEDULER_Handle *sched,
314 struct GNUNET_CLIENT_Connection *ret; 350 struct GNUNET_CLIENT_Connection *ret;
315 struct GNUNET_CONNECTION_Handle *sock; 351 struct GNUNET_CONNECTION_Handle *sock;
316 352
317 sock = do_connect (sched, service_name, cfg); 353 sock = do_connect (sched,
354 service_name,
355 cfg, 0);
318 if (sock == NULL) 356 if (sock == NULL)
319 return NULL; 357 return NULL;
320 ret = GNUNET_malloc (sizeof (struct GNUNET_CLIENT_Connection)); 358 ret = GNUNET_malloc (sizeof (struct GNUNET_CLIENT_Connection));
359 ret->attempts = 1;
321 ret->sock = sock; 360 ret->sock = sock;
322 ret->sched = sched; 361 ret->sched = sched;
323 ret->service_name = GNUNET_strdup (service_name); 362 ret->service_name = GNUNET_strdup (service_name);
@@ -770,7 +809,9 @@ client_notify (void *cls, size_t size, void *buf)
770 /* auto-retry */ 809 /* auto-retry */
771 GNUNET_CONNECTION_destroy (th->sock->sock, GNUNET_NO); 810 GNUNET_CONNECTION_destroy (th->sock->sock, GNUNET_NO);
772 th->sock->sock = do_connect (th->sock->sched, 811 th->sock->sock = do_connect (th->sock->sched,
773 th->sock->service_name, th->sock->cfg); 812 th->sock->service_name,
813 th->sock->cfg,
814 th->sock->attempts++);
774 GNUNET_assert (NULL != th->sock->sock); 815 GNUNET_assert (NULL != th->sock->sock);
775 GNUNET_CONNECTION_ignore_shutdown (th->sock->sock, 816 GNUNET_CONNECTION_ignore_shutdown (th->sock->sock,
776 th->sock->ignore_shutdown); 817 th->sock->ignore_shutdown);
diff --git a/src/util/common_logging.c b/src/util/common_logging.c
index 73a374f46..c06aadc2f 100644
--- a/src/util/common_logging.c
+++ b/src/util/common_logging.c
@@ -510,7 +510,9 @@ GNUNET_a2s (const struct sockaddr *addr, socklen_t addrlen)
510 static char buf[INET6_ADDRSTRLEN + 8]; 510 static char buf[INET6_ADDRSTRLEN + 8];
511 static char b2[6]; 511 static char b2[6];
512 const struct sockaddr_in *v4; 512 const struct sockaddr_in *v4;
513 const struct sockaddr_un *un;
513 const struct sockaddr_in6 *v6; 514 const struct sockaddr_in6 *v6;
515 unsigned int off;
514 516
515 if (addr == NULL) 517 if (addr == NULL)
516 return _("unknown address"); 518 return _("unknown address");
@@ -535,6 +537,17 @@ GNUNET_a2s (const struct sockaddr *addr, socklen_t addrlen)
535 sprintf (b2, "%u", ntohs (v6->sin6_port)); 537 sprintf (b2, "%u", ntohs (v6->sin6_port));
536 strcat (buf, b2); 538 strcat (buf, b2);
537 return buf; 539 return buf;
540 case AF_UNIX:
541 un = (const struct sockaddr_un*) addr;
542 off = 0;
543 if (un->sun_path[0] == '\0') off++;
544 snprintf (buf,
545 sizeof (buf),
546 "%s%.*s",
547 (off == 1) ? "@" : "",
548 addrlen - sizeof (sa_family_t) - 1 - off,
549 &un->sun_path[off]);
550 return buf;
538 default: 551 default:
539 return _("invalid address"); 552 return _("invalid address");
540 } 553 }
diff --git a/src/util/connection.c b/src/util/connection.c
index fdd454105..d218714c0 100644
--- a/src/util/connection.c
+++ b/src/util/connection.c
@@ -889,6 +889,72 @@ GNUNET_CONNECTION_create_from_connect (struct GNUNET_SCHEDULER_Handle *sched,
889 889
890 890
891/** 891/**
892 * Create a socket handle by connecting to a UNIX domain service.
893 * This function returns immediately, even if the connection has not
894 * yet been established. This function only creates UNIX connections.
895 *
896 * @param sched scheduler to use
897 * @param cfg configuration to use
898 * @param unixpath path to connect to
899 * @param maxbuf maximum write buffer size for the socket (use
900 * 0 for sockets that need no write buffers, such as listen sockets)
901 * @return the socket handle, NULL on systems without UNIX support
902 */
903struct GNUNET_CONNECTION_Handle *
904GNUNET_CONNECTION_create_from_connect_to_unixpath (struct GNUNET_SCHEDULER_Handle *sched,
905 const struct
906 GNUNET_CONFIGURATION_Handle *cfg,
907 const char *unixpath,
908 size_t maxbuf)
909{
910#ifdef AF_UNIX
911 struct GNUNET_CONNECTION_Handle *ret;
912 struct sockaddr_un *un;
913 size_t slen;
914
915 GNUNET_assert (0 < strlen (unixpath)); /* sanity check */
916 un = GNUNET_malloc (sizeof (struct sockaddr_un));
917 un->sun_family = AF_UNIX;
918 slen = strlen (unixpath) + 1;
919 if (slen >= sizeof (un->sun_path))
920 slen = sizeof (un->sun_path) - 1;
921 memcpy (un->sun_path,
922 unixpath,
923 slen);
924 un->sun_path[slen] = '\0';
925 slen += sizeof (sa_family_t);
926#if LINUX
927 un->sun_path[0] = '\0';
928 slen = sizeof (struct sockaddr_un);
929#endif
930 ret = GNUNET_malloc (sizeof (struct GNUNET_CONNECTION_Handle) + maxbuf);
931 ret->cfg = cfg;
932 ret->sched = sched;
933 ret->write_buffer = (char *) &ret[1];
934 ret->write_buffer_size = maxbuf;
935 ret->port = 0;
936 ret->hostname = NULL;
937 ret->addr = (struct sockaddr*) un;
938 ret->addrlen = slen;
939 ret->sock = GNUNET_NETWORK_socket_create (AF_UNIX, SOCK_STREAM, 0);
940 if (GNUNET_OK != GNUNET_NETWORK_socket_connect (ret->sock,
941 ret->addr,
942 ret->addrlen))
943 {
944 GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (ret->sock));
945 GNUNET_free (ret->addr);
946 GNUNET_free (ret);
947 return NULL;
948 }
949 connect_success_continuation (ret);
950 return ret;
951#else
952 return NULL;
953#endif
954}
955
956
957/**
892 * Create a socket handle by (asynchronously) connecting to a host. 958 * Create a socket handle by (asynchronously) connecting to a host.
893 * This function returns immediately, even if the connection has not 959 * This function returns immediately, even if the connection has not
894 * yet been established. This function only creates TCP connections. 960 * yet been established. This function only creates TCP connections.
diff --git a/src/util/network.c b/src/util/network.c
index 0b4168034..8ec365269 100644
--- a/src/util/network.c
+++ b/src/util/network.c
@@ -226,7 +226,10 @@ GNUNET_NETWORK_socket_accept (const struct GNUNET_NETWORK_Handle *desc,
226#ifdef DARWIN 226#ifdef DARWIN
227 socket_set_nosigpipe (ret); 227 socket_set_nosigpipe (ret);
228#endif 228#endif
229 socket_set_nodelay (ret); 229#ifdef AF_UNIX
230 if (address->sa_family != AF_UNIX)
231#endif
232 socket_set_nodelay (ret);
230 return ret; 233 return ret;
231} 234}
232 235
@@ -590,7 +593,11 @@ GNUNET_NETWORK_socket_create (int domain, int type, int protocol)
590#ifdef DARWIN 593#ifdef DARWIN
591 socket_set_nosigpipe (ret); 594 socket_set_nosigpipe (ret);
592#endif 595#endif
593 if (type == SOCK_STREAM) 596 if ( (type == SOCK_STREAM)
597#ifdef AF_UNIX
598 && (domain != AF_UNIX)
599#endif
600 )
594 socket_set_nodelay (ret); 601 socket_set_nodelay (ret);
595 return ret; 602 return ret;
596} 603}
diff --git a/src/util/service.c b/src/util/service.c
index 82e7070a1..9ab99de3e 100644
--- a/src/util/service.c
+++ b/src/util/service.c
@@ -612,6 +612,10 @@ check_access (void *cls, const struct sockaddr *addr, socklen_t addrlen)
612 && ((sctx->v6_denied == NULL) || 612 && ((sctx->v6_denied == NULL) ||
613 (!check_ipv6_listed (sctx->v6_denied, &i6->sin6_addr))); 613 (!check_ipv6_listed (sctx->v6_denied, &i6->sin6_addr)));
614 break; 614 break;
615 case AF_UNIX:
616 /* FIXME: support checking UID/GID in the future... */
617 ret = GNUNET_OK; /* always OK for now */
618 break;
615 default: 619 default:
616 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 620 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
617 _("Unknown address family %d\n"), addr->sa_family); 621 _("Unknown address family %d\n"), addr->sa_family);
@@ -702,6 +706,46 @@ process_acl6 (struct IPv6NetworkSet **ret,
702 return GNUNET_OK; 706 return GNUNET_OK;
703} 707}
704 708
709/**
710 * Add the given UNIX domain path as an address to the
711 * list (as the first entry).
712 *
713 * @param saddrs array to update
714 * @param saddrlens where to store the address length
715 * @param unixpath path to add
716 */
717static void
718add_unixpath (struct sockaddr **saddrs,
719 socklen_t *saddrlens,
720 const char *unixpath)
721{
722#ifdef AF_UNIX
723 struct sockaddr_un *un;
724 size_t slen;
725
726 un = GNUNET_malloc (sizeof (struct sockaddr_un));
727 un->sun_family = AF_UNIX;
728 slen = strlen (unixpath) + 1;
729 if (slen >= sizeof (un->sun_path))
730 slen = sizeof (un->sun_path) - 1;
731 memcpy (un->sun_path,
732 unixpath,
733 slen);
734 un->sun_path[slen] = '\0';
735 slen += sizeof (sa_family_t);
736#if LINUX
737 un->sun_path[0] = '\0';
738 slen = sizeof (struct sockaddr_un);
739#endif
740 *saddrs = (struct sockaddr*) un;
741 *saddrlens = slen;
742#else
743 /* this function should never be called
744 unless AF_UNIX is defined! */
745 GNUNET_assert (0);
746#endif
747}
748
705 749
706/** 750/**
707 * Get the list of addresses that a server for the given service 751 * Get the list of addresses that a server for the given service
@@ -732,6 +776,7 @@ GNUNET_SERVICE_get_server_addresses (const char *serviceName,
732 int disablev6; 776 int disablev6;
733 struct GNUNET_NETWORK_Handle *desc; 777 struct GNUNET_NETWORK_Handle *desc;
734 unsigned long long port; 778 unsigned long long port;
779 char *unixpath;
735 struct addrinfo hints; 780 struct addrinfo hints;
736 struct addrinfo *res; 781 struct addrinfo *res;
737 struct addrinfo *pos; 782 struct addrinfo *pos;
@@ -781,19 +826,25 @@ GNUNET_SERVICE_get_server_addresses (const char *serviceName,
781 } 826 }
782 } 827 }
783 828
784 829 port = 0;
785 if ((GNUNET_OK != 830 if (GNUNET_CONFIGURATION_have_value (cfg,
786 GNUNET_CONFIGURATION_get_value_number (cfg, 831 serviceName, "PORT"))
787 serviceName,
788 "PORT",
789 &port)) || (port > 65535))
790 { 832 {
791 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 833 GNUNET_break (GNUNET_OK ==
792 _ 834 GNUNET_CONFIGURATION_get_value_number (cfg,
793 ("Require valid port number for service `%s' in configuration!\n"), 835 serviceName,
794 serviceName); 836 "PORT",
795 return GNUNET_SYSERR; 837 &port));
838 if (port > 65535)
839 {
840 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
841 _
842 ("Require valid port number for service `%s' in configuration!\n"),
843 serviceName);
844 return GNUNET_SYSERR;
845 }
796 } 846 }
847
797 if (GNUNET_CONFIGURATION_have_value (cfg, 848 if (GNUNET_CONFIGURATION_have_value (cfg,
798 serviceName, "BINDTO")) 849 serviceName, "BINDTO"))
799 { 850 {
@@ -806,6 +857,49 @@ GNUNET_SERVICE_get_server_addresses (const char *serviceName,
806 else 857 else
807 hostname = NULL; 858 hostname = NULL;
808 859
860#ifdef AF_UNIX
861 if (GNUNET_CONFIGURATION_have_value (cfg,
862 serviceName, "UNIXPATH"))
863 {
864 GNUNET_break (GNUNET_OK ==
865 GNUNET_CONFIGURATION_get_value_string (cfg,
866 serviceName,
867 "UNIXPATH",
868 &unixpath));
869
870 /* probe UNIX support */
871 desc = GNUNET_NETWORK_socket_create (AF_UNIX, SOCK_STREAM, 0);
872 if (NULL == desc)
873 {
874 if ((errno == ENOBUFS) ||
875 (errno == ENOMEM) || (errno == ENFILE) || (errno == EACCES))
876 {
877 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "socket");
878 return GNUNET_SYSERR;
879 }
880 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
881 _
882 ("Disabling UNIX domainn socket support for service `%s', failed to create UNIX domain socket: %s\n"),
883 serviceName, STRERROR (errno));
884 GNUNET_free (unixpath);
885 unixpath = NULL;
886 }
887 }
888 else
889 unixpath = NULL;
890#else
891 unixpath = NULL;
892#endif
893
894 if ( (port == 0) &&
895 (unixpath == NULL) )
896 {
897 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
898 _("Have neither PORT nor UNIXPATH for service `%s', but one is required\n"),
899 serviceName);
900 return GNUNET_SYSERR;
901 }
902
809 if (hostname != NULL) 903 if (hostname != NULL)
810 { 904 {
811#if DEBUG_SERVICE 905#if DEBUG_SERVICE
@@ -845,9 +939,16 @@ GNUNET_SERVICE_get_server_addresses (const char *serviceName,
845 return GNUNET_SYSERR; 939 return GNUNET_SYSERR;
846 } 940 }
847 resi = i; 941 resi = i;
848 saddrs = GNUNET_malloc ((i+1) * sizeof(struct sockaddr*)); 942 if (NULL != unixpath)
849 saddrlens = GNUNET_malloc ((i+1) * sizeof (socklen_t)); 943 resi++;
944 saddrs = GNUNET_malloc ((resi+1) * sizeof(struct sockaddr*));
945 saddrlens = GNUNET_malloc ((resi+1) * sizeof (socklen_t));
850 i = 0; 946 i = 0;
947 if (NULL != unixpath)
948 {
949 add_unixpath (saddrs, saddrlens, unixpath);
950 i++;
951 }
851 next = res; 952 next = res;
852 while (NULL != (pos = next)) 953 while (NULL != (pos = next))
853 { 954 {
@@ -890,40 +991,56 @@ GNUNET_SERVICE_get_server_addresses (const char *serviceName,
890 { 991 {
891 /* V4-only */ 992 /* V4-only */
892 resi = 1; 993 resi = 1;
893 saddrs = GNUNET_malloc (2 * sizeof(struct sockaddr*)); 994 if (NULL != unixpath)
894 saddrlens = GNUNET_malloc (2 * sizeof (socklen_t)); 995 resi++;
895 saddrlens[0] = sizeof (struct sockaddr_in); 996 i = 0;
896 saddrs[0] = GNUNET_malloc (saddrlens[0]); 997 saddrs = GNUNET_malloc ((resi+1) * sizeof(struct sockaddr*));
998 saddrlens = GNUNET_malloc ((resi+1) * sizeof (socklen_t));
999 if (NULL != unixpath)
1000 {
1001 add_unixpath (saddrs, saddrlens, unixpath);
1002 i++;
1003 }
1004 saddrlens[i] = sizeof (struct sockaddr_in);
1005 saddrs[i] = GNUNET_malloc (saddrlens[i]);
897#if HAVE_SOCKADDR_IN_SIN_LEN 1006#if HAVE_SOCKADDR_IN_SIN_LEN
898 ((struct sockaddr_in *) saddrs[0])->sin_len = saddrlens[0]; 1007 ((struct sockaddr_in *) saddrs[i])->sin_len = saddrlens[i];
899#endif 1008#endif
900 ((struct sockaddr_in *) saddrs[0])->sin_family = AF_INET; 1009 ((struct sockaddr_in *) saddrs[i])->sin_family = AF_INET;
901 ((struct sockaddr_in *) saddrs[0])->sin_port = htons (port); 1010 ((struct sockaddr_in *) saddrs[i])->sin_port = htons (port);
902 } 1011 }
903 else 1012 else
904 { 1013 {
905 /* dual stack */ 1014 /* dual stack */
906 resi = 2; 1015 resi = 2;
907 saddrs = GNUNET_malloc (3 * sizeof(struct sockaddr*)); 1016 if (NULL != unixpath)
908 saddrlens = GNUNET_malloc (3 * sizeof (socklen_t)); 1017 resi++;
909 1018 saddrs = GNUNET_malloc ((resi+1) * sizeof(struct sockaddr*));
910 saddrlens[0] = sizeof (struct sockaddr_in6); 1019 saddrlens = GNUNET_malloc ((resi+1) * sizeof (socklen_t));
911 saddrs[0] = GNUNET_malloc (saddrlens[0]); 1020 i = 0;
1021 if (NULL != unixpath)
1022 {
1023 add_unixpath (saddrs, saddrlens, unixpath);
1024 i++;
1025 }
1026 saddrlens[i] = sizeof (struct sockaddr_in6);
1027 saddrs[i] = GNUNET_malloc (saddrlens[i]);
912#if HAVE_SOCKADDR_IN_SIN_LEN 1028#if HAVE_SOCKADDR_IN_SIN_LEN
913 ((struct sockaddr_in6 *) saddrs[0])->sin6_len = saddrlens[0]; 1029 ((struct sockaddr_in6 *) saddrs[i])->sin6_len = saddrlens[0];
914#endif 1030#endif
915 ((struct sockaddr_in6 *) saddrs[0])->sin6_family = AF_INET6; 1031 ((struct sockaddr_in6 *) saddrs[i])->sin6_family = AF_INET6;
916 ((struct sockaddr_in6 *) saddrs[0])->sin6_port = htons (port); 1032 ((struct sockaddr_in6 *) saddrs[i])->sin6_port = htons (port);
917 1033 i++;
918 saddrlens[1] = sizeof (struct sockaddr_in); 1034 saddrlens[i] = sizeof (struct sockaddr_in);
919 saddrs[1] = GNUNET_malloc (saddrlens[1]); 1035 saddrs[i] = GNUNET_malloc (saddrlens[i]);
920#if HAVE_SOCKADDR_IN_SIN_LEN 1036#if HAVE_SOCKADDR_IN_SIN_LEN
921 ((struct sockaddr_in *) saddrs[1])->sin_len = saddrlens[1]; 1037 ((struct sockaddr_in *) saddrs[i])->sin_len = saddrlens[1];
922#endif 1038#endif
923 ((struct sockaddr_in *) saddrs[1])->sin_family = AF_INET; 1039 ((struct sockaddr_in *) saddrs[i])->sin_family = AF_INET;
924 ((struct sockaddr_in *) saddrs[1])->sin_port = htons (port); 1040 ((struct sockaddr_in *) saddrs[i])->sin_port = htons (port);
925 } 1041 }
926 } 1042 }
1043 GNUNET_free_non_null (unixpath);
927 *addrs = saddrs; 1044 *addrs = saddrs;
928 *addr_lens = saddrlens; 1045 *addr_lens = saddrlens;
929 return resi; 1046 return resi;
@@ -934,8 +1051,9 @@ GNUNET_SERVICE_get_server_addresses (const char *serviceName,
934 * Setup addr, addrlen, maxbuf, idle_timeout 1051 * Setup addr, addrlen, maxbuf, idle_timeout
935 * based on configuration! 1052 * based on configuration!
936 * 1053 *
937 * Configuration must specify a "PORT". It may 1054 * Configuration may specify:
938 * specify: 1055 * - PORT (where to bind to for TCP)
1056 * - UNIXPATH (where to bind to for UNIX domain sockets)
939 * - TIMEOUT (after how many ms does an inactive service timeout); 1057 * - TIMEOUT (after how many ms does an inactive service timeout);
940 * - MAXBUF (maximum incoming message size supported) 1058 * - MAXBUF (maximum incoming message size supported)
941 * - DISABLEV6 (disable support for IPv6, otherwise we use dual-stack) 1059 * - DISABLEV6 (disable support for IPv6, otherwise we use dual-stack)
diff --git a/src/util/test_resolver_api.c b/src/util/test_resolver_api.c
index e6496e7ac..c24646d07 100644
--- a/src/util/test_resolver_api.c
+++ b/src/util/test_resolver_api.c
@@ -222,6 +222,7 @@ static void
222run(void *cls, struct GNUNET_SCHEDULER_Handle *sched, char * const *args, 222run(void *cls, struct GNUNET_SCHEDULER_Handle *sched, char * const *args,
223 const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) 223 const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
224{ 224{
225 int *ok = cls;
225 struct sockaddr_in sa; 226 struct sockaddr_in sa;
226 struct GNUNET_TIME_Relative timeout = GNUNET_TIME_relative_multiply( 227 struct GNUNET_TIME_Relative timeout = GNUNET_TIME_relative_multiply(
227 GNUNET_TIME_UNIT_MILLISECONDS, 2500); 228 GNUNET_TIME_UNIT_MILLISECONDS, 2500);
@@ -267,6 +268,7 @@ run(void *cls, struct GNUNET_SCHEDULER_Handle *sched, char * const *args,
267#endif 268#endif
268 fprintf (stderr, 269 fprintf (stderr,
269 "System seems to be off-line, will not run all DNS tests\n"); 270 "System seems to be off-line, will not run all DNS tests\n");
271 *ok = 0; /* mark test as passing anyway */
270 return; 272 return;
271 } 273 }
272 274