aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-09-05 21:49:16 +0200
committerChristian Grothoff <christian@grothoff.org>2020-09-05 21:49:16 +0200
commit6656636f73c1e6d12403fe1ea86e0e0c13ab0cc3 (patch)
tree51c16de1f4ac5c45f8f48a7150df9f13b0824190
parentafc13e32896257b7ed0e5aa88e280950419148ac (diff)
parentac165b5babe8a0fb77177aafc9990abefb053c0f (diff)
downloadgnunet-6656636f73c1e6d12403fe1ea86e0e0c13ab0cc3.tar.gz
gnunet-6656636f73c1e6d12403fe1ea86e0e0c13ab0cc3.zip
Merge branch 'master' of git+ssh://gnunet.org/gnunet
-rwxr-xr-x.buildbot/firefly-x86_64-amdepyc_test.sh10
-rw-r--r--README2
-rw-r--r--configure.ac5
-rw-r--r--src/gns/test_gns_proxy.c8
-rw-r--r--src/include/gnunet_transport_communication_service.h8
-rw-r--r--src/reclaim/gnunet-reclaim.c2
-rw-r--r--src/reclaim/plugin_reclaim_credential_jwt.c2
-rw-r--r--src/transport/gnunet-communicator-tcp.c352
-rw-r--r--src/transport/test_communicator_tcp_rekey_peer2.conf4
-rw-r--r--src/transport/transport-testing2.c10
-rw-r--r--src/transport/transport_api2_communication.c15
-rw-r--r--src/util/gnunet-qr.c7
-rw-r--r--src/util/gnunet-uri.c2
13 files changed, 321 insertions, 106 deletions
diff --git a/.buildbot/firefly-x86_64-amdepyc_test.sh b/.buildbot/firefly-x86_64-amdepyc_test.sh
index db202a112..d665d3a7c 100755
--- a/.buildbot/firefly-x86_64-amdepyc_test.sh
+++ b/.buildbot/firefly-x86_64-amdepyc_test.sh
@@ -1,3 +1,11 @@
1#!/bin/bash 1#!/bin/bash
2 2
3echo "Skipped" 3# echo "Skipped"
4
5pushd src/transport
6make check TESTS='test_communicator_basic-tcp'
7cat test-suite.log
8pkill --signal 9 -U buildbot gnunet
9make check TESTS='test_communicator_rekey-tcp'
10pkill --signal 9 -U buildbot gnunet
11popd
diff --git a/README b/README
index d95022de2..e6ba9c07e 100644
--- a/README
+++ b/README
@@ -96,7 +96,7 @@ These are the direct dependencies for running GNUnet:
96- which (contrib/apparmor(?), gnunet-bugreport, 96- which (contrib/apparmor(?), gnunet-bugreport,
97 and possibly more) 97 and possibly more)
98- zlib 98- zlib
99- libsodium >= 1.0.11 (for elliptic curve cryptography) 99- libsodium >= 1.0.17 (for elliptic curve cryptography)
100 100
101These are the dependencies for GNUnet's testsuite: 101These are the dependencies for GNUnet's testsuite:
102~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 102~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/configure.ac b/configure.ac
index bd92bd0e9..75e11bd4f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1036,9 +1036,10 @@ AC_CHECK_LIB([kvm],[kvm_open])
1036AC_CHECK_LIB([kstat],[kstat_open]) 1036AC_CHECK_LIB([kstat],[kstat_open])
1037 1037
1038libsodium=0 1038libsodium=0
1039# test for libsodium 1039# test for libsodium >=1.017 (introduction of
1040# crypto_scalarmult_ed25519_base_noclamp API)
1040AC_CHECK_HEADER([sodium.h], 1041AC_CHECK_HEADER([sodium.h],
1041 [AC_CHECK_LIB([sodium], [crypto_pwhash_argon2id], 1042 [AC_CHECK_LIB([sodium], [crypto_scalarmult_ed25519_base_noclamp],
1042 [libsodium=1])]) 1043 [libsodium=1])])
1043 1044
1044AS_IF([test x$libsodium = x0], 1045AS_IF([test x$libsodium = x0],
diff --git a/src/gns/test_gns_proxy.c b/src/gns/test_gns_proxy.c
index 13764d520..579de774f 100644
--- a/src/gns/test_gns_proxy.c
+++ b/src/gns/test_gns_proxy.c
@@ -189,7 +189,7 @@ copy_buffer (void *ptr, size_t size, size_t nmemb, void *ctx)
189} 189}
190 190
191 191
192static int 192static enum MHD_Result
193mhd_ahc (void *cls, 193mhd_ahc (void *cls,
194 struct MHD_Connection *connection, 194 struct MHD_Connection *connection,
195 const char *url, 195 const char *url,
@@ -528,8 +528,6 @@ run (void *cls,
528int 528int
529main (int argc, char *const *argv) 529main (int argc, char *const *argv)
530{ 530{
531 char *tmp_argv;
532
533 struct GNUNET_GETOPT_CommandLineOption options[] = { 531 struct GNUNET_GETOPT_CommandLineOption options[] = {
534 GNUNET_GETOPT_option_uint16 ('p', 532 GNUNET_GETOPT_option_uint16 ('p',
535 "port", 533 "port",
@@ -559,7 +557,7 @@ main (int argc, char *const *argv)
559 } 557 }
560 if (GNUNET_OK != 558 if (GNUNET_OK !=
561 GNUNET_STRINGS_get_utf8_args (argc, argv, 559 GNUNET_STRINGS_get_utf8_args (argc, argv,
562 &argc, &tmp_argv)) 560 &argc, &argv))
563 return 2; 561 return 2;
564 GNUNET_log_setup ("gnunet-gns-proxy-test", 562 GNUNET_log_setup ("gnunet-gns-proxy-test",
565 "WARNING", 563 "WARNING",
@@ -570,7 +568,7 @@ main (int argc, char *const *argv)
570 options, 568 options,
571 &run, NULL)) 569 &run, NULL))
572 return 1; 570 return 1;
573 GNUNET_free (tmp_argv); 571 GNUNET_free_nz ((void*) argv);
574 return global_ret; 572 return global_ret;
575} 573}
576 574
diff --git a/src/include/gnunet_transport_communication_service.h b/src/include/gnunet_transport_communication_service.h
index ea6b95e2d..431b9a671 100644
--- a/src/include/gnunet_transport_communication_service.h
+++ b/src/include/gnunet_transport_communication_service.h
@@ -336,6 +336,14 @@ void
336GNUNET_TRANSPORT_communicator_address_remove ( 336GNUNET_TRANSPORT_communicator_address_remove (
337 struct GNUNET_TRANSPORT_AddressIdentifier *ai); 337 struct GNUNET_TRANSPORT_AddressIdentifier *ai);
338 338
339/**
340 * Notify transport service that this communicator no longer provides all its addresses for this peer.
341 *
342 * @param ch The communicator handle.
343 */
344void
345GNUNET_TRANSPORT_communicator_address_remove_all (
346 struct GNUNET_TRANSPORT_CommunicatorHandle *ch);
339 347
340/** 348/**
341 * The communicator asks the transport service to route a message via 349 * The communicator asks the transport service to route a message via
diff --git a/src/reclaim/gnunet-reclaim.c b/src/reclaim/gnunet-reclaim.c
index ab281a645..b9306b802 100644
--- a/src/reclaim/gnunet-reclaim.c
+++ b/src/reclaim/gnunet-reclaim.c
@@ -862,7 +862,7 @@ main (int argc, char *const argv[])
862 gettext_noop ("List credentials for EGO"), 862 gettext_noop ("List credentials for EGO"),
863 &list_credentials), 863 &list_credentials),
864 GNUNET_GETOPT_option_string ('I', 864 GNUNET_GETOPT_option_string ('I',
865 "Credential ID", 865 "credential-id",
866 "CREDENTIAL_ID", 866 "CREDENTIAL_ID",
867 gettext_noop ( 867 gettext_noop (
868 "Credential to use for attribute"), 868 "Credential to use for attribute"),
diff --git a/src/reclaim/plugin_reclaim_credential_jwt.c b/src/reclaim/plugin_reclaim_credential_jwt.c
index 148865223..6f52f3a4e 100644
--- a/src/reclaim/plugin_reclaim_credential_jwt.c
+++ b/src/reclaim/plugin_reclaim_credential_jwt.c
@@ -177,6 +177,8 @@ jwt_parse_attributes (void *cls,
177 json_object_foreach (json_val, key, value) { 177 json_object_foreach (json_val, key, value) {
178 if (0 == strcmp ("iss", key)) 178 if (0 == strcmp ("iss", key))
179 continue; 179 continue;
180 if (0 == strcmp ("jti", key))
181 continue;
180 if (0 == strcmp ("exp", key)) 182 if (0 == strcmp ("exp", key))
181 continue; 183 continue;
182 if (0 == strcmp ("iat", key)) 184 if (0 == strcmp ("iat", key))
diff --git a/src/transport/gnunet-communicator-tcp.c b/src/transport/gnunet-communicator-tcp.c
index 880145424..4caef909c 100644
--- a/src/transport/gnunet-communicator-tcp.c
+++ b/src/transport/gnunet-communicator-tcp.c
@@ -308,6 +308,38 @@ struct TCPRekey
308 struct GNUNET_TIME_AbsoluteNBO monotonic_time; 308 struct GNUNET_TIME_AbsoluteNBO monotonic_time;
309}; 309};
310 310
311/**
312 * Signature we use to verify that the ephemeral key was really chosen by
313 * the specified sender.
314 */
315struct TcpRekeySignature
316{
317 /**
318 * Purpose must be #GNUNET_SIGNATURE_COMMUNICATOR_TCP_REKEY
319 */
320 struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
321
322 /**
323 * Identity of the inititor of the TCP connection (TCP client).
324 */
325 struct GNUNET_PeerIdentity sender;
326
327 /**
328 * Presumed identity of the target of the TCP connection (TCP server)
329 */
330 struct GNUNET_PeerIdentity receiver;
331
332 /**
333 * Ephemeral key used by the @e sender.
334 */
335 struct GNUNET_CRYPTO_EcdhePublicKey ephemeral;
336
337 /**
338 * Monotonic time of @e sender, to possibly help detect replay attacks
339 * (if receiver persists times by sender).
340 */
341 struct GNUNET_TIME_AbsoluteNBO monotonic_time;
342};
311 343
312/** 344/**
313 * TCP finish. Sender asks for the connection to be closed. 345 * TCP finish. Sender asks for the connection to be closed.
@@ -799,6 +831,16 @@ size_t unverified_size;
799static struct GNUNET_PEERSTORE_Handle *peerstore; 831static struct GNUNET_PEERSTORE_Handle *peerstore;
800 832
801/** 833/**
834 * A flag indicating we are already doing a shutdown.
835 */
836int shutdown_running = GNUNET_NO;
837
838/**
839 * The port the communicator should be assigned to.
840 */
841unsigned int bind_port;
842
843/**
802 * We have been notified that our listen socket has something to 844 * We have been notified that our listen socket has something to
803 * read. Do the read and reschedule this function to be called again 845 * read. Do the read and reschedule this function to be called again
804 * once more is available. 846 * once more is available.
@@ -819,7 +861,6 @@ listen_cb (void *cls);
819static void 861static void
820queue_destroy (struct Queue *queue) 862queue_destroy (struct Queue *queue)
821{ 863{
822 struct GNUNET_MQ_Handle *mq;
823 struct ListenTask *lt; 864 struct ListenTask *lt;
824 lt = GNUNET_new (struct ListenTask); 865 lt = GNUNET_new (struct ListenTask);
825 lt->listen_sock = queue->listen_sock; 866 lt->listen_sock = queue->listen_sock;
@@ -858,11 +899,6 @@ queue_destroy (struct Queue *queue)
858 GNUNET_PEERSTORE_iterate_cancel (queue->handshake_ack_monotime_get); 899 GNUNET_PEERSTORE_iterate_cancel (queue->handshake_ack_monotime_get);
859 queue->handshake_ack_monotime_get = NULL; 900 queue->handshake_ack_monotime_get = NULL;
860 } 901 }
861 if (NULL != (mq = queue->mq))
862 {
863 queue->mq = NULL;
864 GNUNET_MQ_destroy (mq);
865 }
866 if (NULL != queue->qh) 902 if (NULL != queue->qh)
867 { 903 {
868 GNUNET_TRANSPORT_communicator_mq_del (queue->qh); 904 GNUNET_TRANSPORT_communicator_mq_del (queue->qh);
@@ -885,7 +921,11 @@ queue_destroy (struct Queue *queue)
885 GNUNET_SCHEDULER_cancel (queue->write_task); 921 GNUNET_SCHEDULER_cancel (queue->write_task);
886 queue->write_task = NULL; 922 queue->write_task = NULL;
887 } 923 }
888 GNUNET_NETWORK_socket_close (queue->sock); 924 if (GNUNET_SYSERR == GNUNET_NETWORK_socket_close (queue->sock))
925 {
926 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
927 "closing socket failed\n");
928 }
889 gcry_cipher_close (queue->in_cipher); 929 gcry_cipher_close (queue->in_cipher);
890 gcry_cipher_close (queue->out_cipher); 930 gcry_cipher_close (queue->out_cipher);
891 GNUNET_free (queue->address); 931 GNUNET_free (queue->address);
@@ -894,12 +934,18 @@ queue_destroy (struct Queue *queue)
894 else 934 else
895 GNUNET_free (queue); 935 GNUNET_free (queue);
896 936
897 if (NULL == lt->listen_task) 937 if ((NULL != lt->listen_sock) && (NULL == lt->listen_task))
938 {
939 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
940 "add read net listen\n");
898 lt->listen_task = GNUNET_SCHEDULER_add_read_net ( 941 lt->listen_task = GNUNET_SCHEDULER_add_read_net (
899 GNUNET_TIME_UNIT_FOREVER_REL, 942 GNUNET_TIME_UNIT_FOREVER_REL,
900 lt->listen_sock, 943 lt->listen_sock,
901 &listen_cb, 944 &listen_cb,
902 lt); 945 lt);
946 }
947 else
948 GNUNET_free (lt);
903} 949}
904 950
905 951
@@ -1001,6 +1047,13 @@ core_read_finished_cb (void *cls, int success)
1001 "# messages lost in communicator API towards CORE", 1047 "# messages lost in communicator API towards CORE",
1002 1, 1048 1,
1003 GNUNET_NO); 1049 GNUNET_NO);
1050 if (NULL == queue)
1051 return;
1052
1053 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1054 "backpressure %u\n",
1055 queue->backpressure);
1056
1004 queue->backpressure--; 1057 queue->backpressure--;
1005 /* handle deferred queue destruction */ 1058 /* handle deferred queue destruction */
1006 if ((queue->destroyed) && (0 == queue->backpressure)) 1059 if ((queue->destroyed) && (0 == queue->backpressure))
@@ -1008,15 +1061,18 @@ core_read_finished_cb (void *cls, int success)
1008 GNUNET_free (queue); 1061 GNUNET_free (queue);
1009 return; 1062 return;
1010 } 1063 }
1011 reschedule_queue_timeout (queue); 1064 else if (GNUNET_YES != queue->destroyed)
1012 /* possibly unchoke reading, now that CORE made progress */ 1065 {
1013 if (NULL == queue->read_task) 1066 reschedule_queue_timeout (queue);
1014 queue->read_task = 1067 /* possibly unchoke reading, now that CORE made progress */
1015 GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_absolute_get_remaining ( 1068 if (NULL == queue->read_task)
1016 queue->timeout), 1069 queue->read_task =
1017 queue->sock, 1070 GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_absolute_get_remaining (
1018 &queue_read, 1071 queue->timeout),
1019 queue); 1072 queue->sock,
1073 &queue_read,
1074 queue);
1075 }
1020} 1076}
1021 1077
1022 1078
@@ -1219,13 +1275,34 @@ rekey_monotime_cb (void *cls,
1219static void 1275static void
1220do_rekey (struct Queue *queue, const struct TCPRekey *rekey) 1276do_rekey (struct Queue *queue, const struct TCPRekey *rekey)
1221{ 1277{
1222 struct TcpHandshakeSignature thp; 1278 struct TcpRekeySignature thp;
1279
1223 thp.purpose.purpose = htonl (GNUNET_SIGNATURE_COMMUNICATOR_TCP_REKEY); 1280 thp.purpose.purpose = htonl (GNUNET_SIGNATURE_COMMUNICATOR_TCP_REKEY);
1224 thp.purpose.size = htonl (sizeof(thp)); 1281 thp.purpose.size = htonl (sizeof(thp));
1282 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1283 "do_rekey size %u\n",
1284 thp.purpose.size);
1225 thp.sender = queue->target; 1285 thp.sender = queue->target;
1286 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1287 "sender %s\n",
1288 GNUNET_p2s (&thp.sender.public_key));
1289 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1290 "sender %s\n",
1291 GNUNET_p2s (&queue->target.public_key));
1226 thp.receiver = my_identity; 1292 thp.receiver = my_identity;
1293 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1294 "receiver %s\n",
1295 GNUNET_p2s (&thp.receiver.public_key));
1227 thp.ephemeral = rekey->ephemeral; 1296 thp.ephemeral = rekey->ephemeral;
1297 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1298 "ephemeral %s\n",
1299 GNUNET_e2s (&thp.ephemeral));
1228 thp.monotonic_time = rekey->monotonic_time; 1300 thp.monotonic_time = rekey->monotonic_time;
1301 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1302 "time %s\n",
1303 GNUNET_STRINGS_absolute_time_to_string (
1304 GNUNET_TIME_absolute_ntoh (thp.monotonic_time)));
1305 GNUNET_assert (ntohl ((&thp)->purpose.size) == sizeof (*(&thp)));
1229 if (GNUNET_OK != 1306 if (GNUNET_OK !=
1230 GNUNET_CRYPTO_eddsa_verify (GNUNET_SIGNATURE_COMMUNICATOR_TCP_REKEY, 1307 GNUNET_CRYPTO_eddsa_verify (GNUNET_SIGNATURE_COMMUNICATOR_TCP_REKEY,
1231 &thp, 1308 &thp,
@@ -1359,7 +1436,7 @@ try_handle_plaintext (struct Queue *queue)
1359 if ((-1 != unverified_size) && (unverified_size > INITIAL_CORE_KX_SIZE)) 1436 if ((-1 != unverified_size) && (unverified_size > INITIAL_CORE_KX_SIZE))
1360 { 1437 {
1361 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1438 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1362 "Already received data of size %u bigger than KX size %u!\n", 1439 "Already received data of size %lu bigger than KX size %lu!\n",
1363 unverified_size, 1440 unverified_size,
1364 INITIAL_CORE_KX_SIZE); 1441 INITIAL_CORE_KX_SIZE);
1365 GNUNET_break_op (0); 1442 GNUNET_break_op (0);
@@ -1636,6 +1713,8 @@ tcp_address_to_sockaddr_numeric_v6 (socklen_t *sock_len, struct sockaddr_in6 v6,
1636#if HAVE_SOCKADDR_IN_SIN_LEN 1713#if HAVE_SOCKADDR_IN_SIN_LEN
1637 v6.sin6_len = sizeof(sizeof(struct sockaddr_in6)); 1714 v6.sin6_len = sizeof(sizeof(struct sockaddr_in6));
1638#endif 1715#endif
1716 v6.sin6_flowinfo = 0;
1717 v6.sin6_scope_id = 0;
1639 in = GNUNET_memdup (&v6, sizeof(v6)); 1718 in = GNUNET_memdup (&v6, sizeof(v6));
1640 *sock_len = sizeof(struct sockaddr_in6); 1719 *sock_len = sizeof(struct sockaddr_in6);
1641 1720
@@ -1739,11 +1818,19 @@ extract_address (const char *bindto)
1739 char *cp; 1818 char *cp;
1740 char *rest = NULL; 1819 char *rest = NULL;
1741 1820
1821 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1822 "extract address with bindto %s\n",
1823 bindto);
1824
1742 if (NULL == bindto) 1825 if (NULL == bindto)
1743 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1826 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1744 "bindto is NULL\n"); 1827 "bindto is NULL\n");
1745 1828
1746 cp = GNUNET_strdup (bindto); 1829 cp = GNUNET_strdup (bindto);
1830
1831 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1832 "extract address 2\n");
1833
1747 start = cp; 1834 start = cp;
1748 if (('[' == *cp) && (']' == cp[strlen (cp) - 1])) 1835 if (('[' == *cp) && (']' == cp[strlen (cp) - 1]))
1749 { 1836 {
@@ -1763,7 +1850,11 @@ extract_address (const char *bindto)
1763 } 1850 }
1764 } 1851 }
1765 1852
1766 GNUNET_free (cp); 1853 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1854 "extract address 3\n");
1855 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1856 "extract address with start %s\n",
1857 start);
1767 1858
1768 return start; 1859 return start;
1769} 1860}
@@ -1865,10 +1956,25 @@ tcp_address_to_sockaddr (const char *bindto, socklen_t *sock_len)
1865 // cp = GNUNET_strdup (bindto); 1956 // cp = GNUNET_strdup (bindto);
1866 start = extract_address (bindto); 1957 start = extract_address (bindto);
1867 1958
1959 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1960 "start %s\n",
1961 start);
1962
1963 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1964 "!bindto %s\n",
1965 bindto);
1966
1967
1968
1868 if (1 == inet_pton (AF_INET, start, &v4.sin_addr)) 1969 if (1 == inet_pton (AF_INET, start, &v4.sin_addr))
1869 { 1970 {
1870 // colon = strrchr (cp, ':'); 1971 // colon = strrchr (cp, ':');
1871 port = extract_port (bindto); 1972 port = extract_port (bindto);
1973
1974 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1975 "port %u\n",
1976 port);
1977
1872 in = tcp_address_to_sockaddr_numeric_v4 (sock_len, v4, port); 1978 in = tcp_address_to_sockaddr_numeric_v4 (sock_len, v4, port);
1873 } 1979 }
1874 else if (1 == inet_pton (AF_INET6, start, &v6.sin6_addr)) 1980 else if (1 == inet_pton (AF_INET6, start, &v6.sin6_addr))
@@ -1876,8 +1982,12 @@ tcp_address_to_sockaddr (const char *bindto, socklen_t *sock_len)
1876 // colon = strrchr (cp, ':'); 1982 // colon = strrchr (cp, ':');
1877 port = extract_port (bindto); 1983 port = extract_port (bindto);
1878 in = tcp_address_to_sockaddr_numeric_v6 (sock_len, v6, port); 1984 in = tcp_address_to_sockaddr_numeric_v6 (sock_len, v6, port);
1985 }else{
1986 GNUNET_assert (0);
1879 } 1987 }
1880 1988
1989 // GNUNET_free (start);
1990
1881 return in; 1991 return in;
1882} 1992}
1883 1993
@@ -1913,7 +2023,7 @@ static void
1913inject_rekey (struct Queue *queue) 2023inject_rekey (struct Queue *queue)
1914{ 2024{
1915 struct TCPRekey rekey; 2025 struct TCPRekey rekey;
1916 struct TcpHandshakeSignature thp; 2026 struct TcpRekeySignature thp;
1917 2027
1918 GNUNET_assert (0 == queue->pwrite_off); 2028 GNUNET_assert (0 == queue->pwrite_off);
1919 memset (&rekey, 0, sizeof(rekey)); 2029 memset (&rekey, 0, sizeof(rekey));
@@ -1925,10 +2035,26 @@ inject_rekey (struct Queue *queue)
1925 GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get_monotonic (cfg)); 2035 GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get_monotonic (cfg));
1926 thp.purpose.purpose = htonl (GNUNET_SIGNATURE_COMMUNICATOR_TCP_REKEY); 2036 thp.purpose.purpose = htonl (GNUNET_SIGNATURE_COMMUNICATOR_TCP_REKEY);
1927 thp.purpose.size = htonl (sizeof(thp)); 2037 thp.purpose.size = htonl (sizeof(thp));
2038 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2039 "inject_rekey size %u\n",
2040 thp.purpose.size);
1928 thp.sender = my_identity; 2041 thp.sender = my_identity;
2042 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2043 "sender %s\n",
2044 GNUNET_p2s (&thp.sender.public_key));
1929 thp.receiver = queue->target; 2045 thp.receiver = queue->target;
2046 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2047 "receiver %s\n",
2048 GNUNET_p2s (&thp.receiver.public_key));
1930 thp.ephemeral = rekey.ephemeral; 2049 thp.ephemeral = rekey.ephemeral;
2050 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2051 "ephemeral %s\n",
2052 GNUNET_e2s (&thp.ephemeral));
1931 thp.monotonic_time = rekey.monotonic_time; 2053 thp.monotonic_time = rekey.monotonic_time;
2054 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2055 "time %s\n",
2056 GNUNET_STRINGS_absolute_time_to_string (
2057 GNUNET_TIME_absolute_ntoh (thp.monotonic_time)));
1932 GNUNET_CRYPTO_eddsa_sign (my_private_key, 2058 GNUNET_CRYPTO_eddsa_sign (my_private_key,
1933 &thp, 2059 &thp,
1934 &rekey.sender_sig); 2060 &rekey.sender_sig);
@@ -2004,10 +2130,11 @@ queue_write (void *cls)
2004 queue->cwrite_off += queue->pwrite_off; 2130 queue->cwrite_off += queue->pwrite_off;
2005 queue->pwrite_off = 0; 2131 queue->pwrite_off = 0;
2006 } 2132 }
2007 if ((0 == queue->pwrite_off) && 2133 if ((-1 != unverified_size)&& ((0 == queue->pwrite_off) &&
2008 ((0 == queue->rekey_left_bytes) || 2134 ((0 == queue->rekey_left_bytes) ||
2009 (0 == 2135 (0 ==
2010 GNUNET_TIME_absolute_get_remaining (queue->rekey_time).rel_value_us))) 2136 GNUNET_TIME_absolute_get_remaining (
2137 queue->rekey_time).rel_value_us))))
2011 { 2138 {
2012 inject_rekey (queue); 2139 inject_rekey (queue);
2013 } 2140 }
@@ -2707,7 +2834,7 @@ mq_init (void *cls, const struct GNUNET_PeerIdentity *peer, const char *address)
2707 struct Queue *queue; 2834 struct Queue *queue;
2708 const char *path; 2835 const char *path;
2709 struct sockaddr *in; 2836 struct sockaddr *in;
2710 socklen_t in_len; 2837 socklen_t in_len = 0;
2711 struct GNUNET_NETWORK_Handle *sock; 2838 struct GNUNET_NETWORK_Handle *sock;
2712 2839
2713 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2840 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -2729,6 +2856,10 @@ mq_init (void *cls, const struct GNUNET_PeerIdentity *peer, const char *address)
2729 return GNUNET_SYSERR; 2856 return GNUNET_SYSERR;
2730 } 2857 }
2731 2858
2859 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2860 "in %s\n",
2861 GNUNET_a2s (in, in_len));
2862
2732 sock = GNUNET_NETWORK_socket_create (in->sa_family, SOCK_STREAM, IPPROTO_TCP); 2863 sock = GNUNET_NETWORK_socket_create (in->sa_family, SOCK_STREAM, IPPROTO_TCP);
2733 if (NULL == sock) 2864 if (NULL == sock)
2734 { 2865 {
@@ -2794,6 +2925,11 @@ get_queue_delete_it (void *cls,
2794 2925
2795 (void) cls; 2926 (void) cls;
2796 (void) target; 2927 (void) target;
2928 if (NULL != queue->listen_task)
2929 {
2930 GNUNET_SCHEDULER_cancel (queue->listen_task);
2931 queue->listen_task = NULL;
2932 }
2797 queue_destroy (queue); 2933 queue_destroy (queue);
2798 return GNUNET_OK; 2934 return GNUNET_OK;
2799} 2935}
@@ -2807,6 +2943,16 @@ get_queue_delete_it (void *cls,
2807static void 2943static void
2808do_shutdown (void *cls) 2944do_shutdown (void *cls)
2809{ 2945{
2946
2947 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2948 "Shutdown %s!\n",
2949 shutdown_running ? "running" : "not running");
2950
2951 if (GNUNET_YES == shutdown_running)
2952 return;
2953 else
2954 shutdown_running = GNUNET_YES;
2955
2810 while (NULL != proto_head) 2956 while (NULL != proto_head)
2811 free_proto_queue (proto_head); 2957 free_proto_queue (proto_head);
2812 if (NULL != nat) 2958 if (NULL != nat)
@@ -2816,6 +2962,7 @@ do_shutdown (void *cls)
2816 } 2962 }
2817 GNUNET_CONTAINER_multipeermap_iterate (queue_map, &get_queue_delete_it, NULL); 2963 GNUNET_CONTAINER_multipeermap_iterate (queue_map, &get_queue_delete_it, NULL);
2818 GNUNET_CONTAINER_multipeermap_destroy (queue_map); 2964 GNUNET_CONTAINER_multipeermap_destroy (queue_map);
2965 GNUNET_TRANSPORT_communicator_address_remove_all (ch);
2819 if (NULL != ch) 2966 if (NULL != ch)
2820 { 2967 {
2821 GNUNET_TRANSPORT_communicator_disconnect (ch); 2968 GNUNET_TRANSPORT_communicator_disconnect (ch);
@@ -2836,6 +2983,16 @@ do_shutdown (void *cls)
2836 GNUNET_NT_scanner_done (is); 2983 GNUNET_NT_scanner_done (is);
2837 is = NULL; 2984 is = NULL;
2838 } 2985 }
2986 if (NULL != peerstore)
2987 {
2988 GNUNET_PEERSTORE_disconnect (peerstore, GNUNET_NO);
2989 peerstore = NULL;
2990 }
2991 if (NULL != resolve_request_handle)
2992 {
2993 GNUNET_RESOLVER_request_cancel (resolve_request_handle);
2994 resolve_request_handle = NULL;
2995 }
2839} 2996}
2840 2997
2841 2998
@@ -2886,6 +3043,11 @@ nat_address_cb (void *cls,
2886 char *my_addr; 3043 char *my_addr;
2887 struct GNUNET_TRANSPORT_AddressIdentifier *ai; 3044 struct GNUNET_TRANSPORT_AddressIdentifier *ai;
2888 3045
3046 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3047 "nat address cb %s %s\n",
3048 add_remove ? "add" : "remove",
3049 GNUNET_a2s (addr, addrlen));
3050
2889 if (GNUNET_YES == add_remove) 3051 if (GNUNET_YES == add_remove)
2890 { 3052 {
2891 enum GNUNET_NetworkType nt; 3053 enum GNUNET_NetworkType nt;
@@ -2912,6 +3074,35 @@ nat_address_cb (void *cls,
2912} 3074}
2913 3075
2914/** 3076/**
3077 * This method adds addresses to the DLL, that are later register at the NAT service.
3078 */
3079static void
3080add_addr (struct sockaddr *in, socklen_t in_len)
3081{
3082
3083 struct Addresses *saddrs;
3084
3085 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3086 "add address %s\n",
3087 GNUNET_a2s (in, in_len));
3088
3089 saddrs = GNUNET_new (struct Addresses);
3090 saddrs->addr = in;
3091 saddrs->addr_len = in_len;
3092 GNUNET_CONTAINER_DLL_insert (addrs_head, addrs_tail, saddrs);
3093
3094 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3095 "after add address %s\n",
3096 GNUNET_a2s (in, in_len));
3097
3098 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3099 "add address %s\n",
3100 GNUNET_a2s (saddrs->addr, saddrs->addr_len));
3101
3102 addrs_lens++;
3103}
3104
3105/**
2915 * This method launch network interactions for each address we like to bind to. 3106 * This method launch network interactions for each address we like to bind to.
2916 * 3107 *
2917 * @param addr The address we will listen to. 3108 * @param addr The address we will listen to.
@@ -2919,7 +3110,7 @@ nat_address_cb (void *cls,
2919 * @return GNUNET_SYSERR in case of error. GNUNET_OK in case we are successfully listen to the address. 3110 * @return GNUNET_SYSERR in case of error. GNUNET_OK in case we are successfully listen to the address.
2920 */ 3111 */
2921static int 3112static int
2922init_socket (const struct sockaddr *addr, 3113init_socket (struct sockaddr *addr,
2923 socklen_t in_len) 3114 socklen_t in_len)
2924{ 3115{
2925 struct sockaddr_storage in_sto; 3116 struct sockaddr_storage in_sto;
@@ -2977,7 +3168,7 @@ init_socket (const struct sockaddr *addr,
2977 sto_len = in_len; 3168 sto_len = in_len;
2978 } 3169 }
2979 3170
2980 addr = (struct sockaddr *) &in_sto; 3171 //addr = (struct sockaddr *) &in_sto;
2981 in_len = sto_len; 3172 in_len = sto_len;
2982 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3173 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2983 "Bound to `%s'\n", 3174 "Bound to `%s'\n",
@@ -3034,6 +3225,7 @@ init_socket (const struct sockaddr *addr,
3034 return GNUNET_SYSERR; 3225 return GNUNET_SYSERR;
3035 } 3226 }
3036 3227
3228 add_addr (addr, in_len);
3037 return GNUNET_OK; 3229 return GNUNET_OK;
3038 3230
3039} 3231}
@@ -3050,6 +3242,10 @@ nat_register ()
3050 int i; 3242 int i;
3051 struct Addresses *pos; 3243 struct Addresses *pos;
3052 3244
3245
3246 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3247 "starting nat register!\n");
3248
3053 i = 0; 3249 i = 0;
3054 saddrs = GNUNET_malloc ((addrs_lens + 1) * sizeof(struct sockaddr *)); 3250 saddrs = GNUNET_malloc ((addrs_lens + 1) * sizeof(struct sockaddr *));
3055 3251
@@ -3058,9 +3254,12 @@ nat_register ()
3058 for (pos = addrs_head; NULL != pos; pos = pos->next) 3254 for (pos = addrs_head; NULL != pos; pos = pos->next)
3059 { 3255 {
3060 3256
3257 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3258 "registering address %s\n",
3259 GNUNET_a2s (addrs_head->addr, addrs_head->addr_len));
3260
3061 saddr_lens[i] = addrs_head->addr_len; 3261 saddr_lens[i] = addrs_head->addr_len;
3062 saddrs[i] = GNUNET_malloc (saddr_lens[i]); 3262 saddrs[i] = GNUNET_memdup (addrs_head->addr, saddr_lens[i]);
3063 saddrs[i] = addrs_head->addr;
3064 3263
3065 i++; 3264 i++;
3066 3265
@@ -3078,8 +3277,8 @@ nat_register ()
3078 3277
3079 i = 0; 3278 i = 0;
3080 3279
3081 /*for (i = addrs_lens - 1; i >= 0; i--) 3280 for (i = addrs_lens - 1; i >= 0; i--)
3082 GNUNET_free (saddrs[i]);*/ 3281 GNUNET_free (saddrs[i]);
3083 GNUNET_free (saddrs); 3282 GNUNET_free (saddrs);
3084 GNUNET_free (saddr_lens); 3283 GNUNET_free (saddr_lens);
3085 3284
@@ -3093,22 +3292,6 @@ nat_register ()
3093} 3292}
3094 3293
3095/** 3294/**
3096 * This method adds addresses to the DLL, that are later register at the NAT service.
3097 */
3098static void
3099add_addr (struct sockaddr *in, socklen_t in_len)
3100{
3101
3102 struct Addresses *saddrs;
3103
3104 saddrs = GNUNET_new (struct Addresses);
3105 saddrs->addr = in;
3106 saddrs->addr_len = in_len;
3107 GNUNET_CONTAINER_DLL_insert (addrs_head, addrs_tail, saddrs);
3108 addrs_lens++;
3109}
3110
3111/**
3112 * This method is the callback called by the resolver API, and wraps method init_socket. 3295 * This method is the callback called by the resolver API, and wraps method init_socket.
3113 * 3296 *
3114 * @param cls The port we will bind to. 3297 * @param cls The port we will bind to.
@@ -3123,22 +3306,19 @@ init_socket_resolv (void *cls,
3123 struct sockaddr_in *v4; 3306 struct sockaddr_in *v4;
3124 struct sockaddr_in6 *v6; 3307 struct sockaddr_in6 *v6;
3125 struct sockaddr *in; 3308 struct sockaddr *in;
3126 unsigned int *port;
3127 3309
3128 port = cls; 3310 (void) cls;
3129 if (NULL != addr) 3311 if (NULL != addr)
3130 { 3312 {
3131 if (AF_INET == addr->sa_family) 3313 if (AF_INET == addr->sa_family)
3132 { 3314 {
3133 v4 = (struct sockaddr_in *) addr; 3315 v4 = (struct sockaddr_in *) addr;
3134 in = tcp_address_to_sockaddr_numeric_v4 (&in_len, *v4, *port);// _global); 3316 in = tcp_address_to_sockaddr_numeric_v4 (&in_len, *v4, bind_port);// _global);
3135 add_addr (in, in_len);
3136 } 3317 }
3137 else if (AF_INET6 == addr->sa_family) 3318 else if (AF_INET6 == addr->sa_family)
3138 { 3319 {
3139 v6 = (struct sockaddr_in6 *) addr; 3320 v6 = (struct sockaddr_in6 *) addr;
3140 in = tcp_address_to_sockaddr_numeric_v6 (&in_len, *v6, *port);// _global); 3321 in = tcp_address_to_sockaddr_numeric_v6 (&in_len, *v6, bind_port);// _global);
3141 add_addr (in, in_len);
3142 } 3322 }
3143 else 3323 else
3144 { 3324 {
@@ -3149,13 +3329,17 @@ init_socket_resolv (void *cls,
3149 AF_INET6); 3329 AF_INET6);
3150 return; 3330 return;
3151 } 3331 }
3152 init_socket (in, 3332 init_socket (in, in_len);
3153 in_len);
3154 } 3333 }
3155 else 3334 else
3156 { 3335 {
3157 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 3336 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
3158 "Address is NULL. This might be an error or the resolver finished resolving.\n"); 3337 "Address is NULL. This might be an error or the resolver finished resolving.\n");
3338 if (NULL == addrs_head){
3339 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
3340 "Resolver finished resolving, but we do not listen to an address!.\n");
3341 return;
3342 }
3159 nat_register (); 3343 nat_register ();
3160 } 3344 }
3161} 3345}
@@ -3221,12 +3405,9 @@ run (void *cls,
3221 return; 3405 return;
3222 } 3406 }
3223 3407
3224 // cp = GNUNET_strdup (bindto); 3408 if (1 == sscanf (bindto, "%u%1s", &bind_port, dummy))
3225 start = extract_address (bindto);
3226
3227 if (1 == sscanf (bindto, "%u%1s", &port, dummy))
3228 { 3409 {
3229 po = tcp_address_to_sockaddr_port_only (bindto, &port); 3410 po = tcp_address_to_sockaddr_port_only (bindto, &bind_port);
3230 3411
3231 addr_len_ipv4 = po->addr_len_ipv4; 3412 addr_len_ipv4 = po->addr_len_ipv4;
3232 3413
@@ -3238,46 +3419,53 @@ run (void *cls,
3238 if (NULL != po->addr_ipv4) 3419 if (NULL != po->addr_ipv4)
3239 { 3420 {
3240 init_socket (po->addr_ipv4, addr_len_ipv4); 3421 init_socket (po->addr_ipv4, addr_len_ipv4);
3241 add_addr (po->addr_ipv4, addr_len_ipv4);
3242 } 3422 }
3243 3423
3244 if (NULL != po->addr_ipv6) 3424 if (NULL != po->addr_ipv6)
3245 { 3425 {
3246 addr_len_ipv6 = po->addr_len_ipv6; 3426 addr_len_ipv6 = po->addr_len_ipv6;
3247 init_socket (po->addr_ipv6, addr_len_ipv6); 3427 init_socket (po->addr_ipv6, addr_len_ipv6);
3248 add_addr (po->addr_ipv6, addr_len_ipv6);
3249 } 3428 }
3250 3429
3430 GNUNET_free (po);
3251 nat_register (); 3431 nat_register ();
3432 GNUNET_free (bindto);
3433
3434 return;
3252 } 3435 }
3253 else if (1 == inet_pton (AF_INET, start, &v4.sin_addr)) 3436
3437 start = extract_address (bindto);
3438
3439 if (1 == inet_pton (AF_INET, start, &v4.sin_addr))
3254 { 3440 {
3255 port = extract_port (bindto); 3441 bind_port = extract_port (bindto);
3256 3442
3257 in = tcp_address_to_sockaddr_numeric_v4 (&in_len, v4, port); 3443 in = tcp_address_to_sockaddr_numeric_v4 (&in_len, v4, bind_port);
3258 init_socket (in, in_len); 3444 init_socket (in, in_len);
3259 add_addr (in, in_len);
3260 nat_register (); 3445 nat_register ();
3446 GNUNET_free (bindto);
3447 return;
3261 } 3448 }
3262 else if (1 == inet_pton (AF_INET6, start, &v6.sin6_addr)) 3449
3450 if (1 == inet_pton (AF_INET6, start, &v6.sin6_addr))
3263 { 3451 {
3264 port = extract_port (bindto); 3452 bind_port = extract_port (bindto);
3265 in = tcp_address_to_sockaddr_numeric_v6 (&in_len, v6, port); 3453 in = tcp_address_to_sockaddr_numeric_v6 (&in_len, v6, bind_port);
3266 init_socket (in, in_len); 3454 init_socket (in, in_len);
3267 add_addr (in, in_len);
3268 nat_register (); 3455 nat_register ();
3456 GNUNET_free (bindto);
3457 return;
3269 } 3458 }
3270 else
3271 {
3272 port = extract_port (bindto);
3273 3459
3274 resolve_request_handle = GNUNET_RESOLVER_ip_get (strtok_r (bindto, ":", 3460
3275 &rest), 3461 bind_port = extract_port (bindto);
3276 AF_UNSPEC, 3462
3277 GNUNET_TIME_UNIT_MINUTES, 3463 resolve_request_handle = GNUNET_RESOLVER_ip_get (strtok_r (bindto, ":",
3278 &init_socket_resolv, 3464 &rest),
3279 &port); 3465 AF_UNSPEC,
3280 } 3466 GNUNET_TIME_UNIT_MINUTES,
3467 &init_socket_resolv,
3468 &port);
3281 GNUNET_free (bindto); 3469 GNUNET_free (bindto);
3282} 3470}
3283 3471
diff --git a/src/transport/test_communicator_tcp_rekey_peer2.conf b/src/transport/test_communicator_tcp_rekey_peer2.conf
index 138650a3b..643b037b2 100644
--- a/src/transport/test_communicator_tcp_rekey_peer2.conf
+++ b/src/transport/test_communicator_tcp_rekey_peer2.conf
@@ -31,10 +31,10 @@ UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-resolver_test_2.sock
31UNIXPATH = $GNUNET_RUNTIME_DIR/test_gnunet-communicator-unix_2.sock 31UNIXPATH = $GNUNET_RUNTIME_DIR/test_gnunet-communicator-unix_2.sock
32 32
33[communicator-tcp] 33[communicator-tcp]
34#PREFIX = xterm -geometry 100x85 -T peer1 -e gdb --args 34#PREFIX = xterm -geometry 100x85 -T peer2 -e gdb --args
35#PREFIX = valgrind --leak-check=full --track-origins=yes 35#PREFIX = valgrind --leak-check=full --track-origins=yes
36BINDTO = 60003 36BINDTO = 60003
37DISABLE_V6 = YES 37DISABLE_V6 = NO
38REKEY_INTERVAL = 100ms 38REKEY_INTERVAL = 100ms
39 39
40[communicator-udp] 40[communicator-udp]
diff --git a/src/transport/transport-testing2.c b/src/transport/transport-testing2.c
index 13944e9f0..e194b0159 100644
--- a/src/transport/transport-testing2.c
+++ b/src/transport/transport-testing2.c
@@ -897,7 +897,6 @@ shutdown_process (struct GNUNET_OS_Process *proc)
897 GNUNET_OS_process_destroy (proc); 897 GNUNET_OS_process_destroy (proc);
898} 898}
899 899
900
901static void 900static void
902shutdown_peerstore (void *cls) 901shutdown_peerstore (void *cls)
903{ 902{
@@ -905,7 +904,6 @@ shutdown_peerstore (void *cls)
905 shutdown_process (proc); 904 shutdown_process (proc);
906} 905}
907 906
908
909static void 907static void
910shutdown_communicator (void *cls) 908shutdown_communicator (void *cls)
911{ 909{
@@ -941,8 +939,7 @@ communicator_start (
941 939
942 940
943 binary = GNUNET_OS_get_libexec_binary_path (binary_name); 941 binary = GNUNET_OS_get_libexec_binary_path (binary_name);
944 tc_h->c_proc = GNUNET_OS_start_process_s (GNUNET_OS_USE_PIPE_CONTROL 942 tc_h->c_proc = GNUNET_OS_start_process_s (GNUNET_OS_INHERIT_STD_OUT_AND_ERR,
945 | GNUNET_OS_INHERIT_STD_OUT_AND_ERR,
946 NULL, 943 NULL,
947 loprefix, 944 loprefix,
948 binary, 945 binary,
@@ -1026,10 +1023,8 @@ peerstore_start (
1026{ 1023{
1027 char *binary; 1024 char *binary;
1028 1025
1029 LOG (GNUNET_ERROR_TYPE_DEBUG, "peerstore_start\n");
1030 binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-peerstore"); 1026 binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-peerstore");
1031 tc_h->ps_proc = GNUNET_OS_start_process (GNUNET_OS_USE_PIPE_CONTROL 1027 tc_h->ps_proc = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_OUT_AND_ERR,
1032 | GNUNET_OS_INHERIT_STD_OUT_AND_ERR,
1033 NULL, 1028 NULL,
1034 NULL, 1029 NULL,
1035 NULL, 1030 NULL,
@@ -1047,7 +1042,6 @@ peerstore_start (
1047 GNUNET_free (binary); 1042 GNUNET_free (binary);
1048} 1043}
1049 1044
1050
1051/** 1045/**
1052 * @brief Start NAT 1046 * @brief Start NAT
1053 * 1047 *
diff --git a/src/transport/transport_api2_communication.c b/src/transport/transport_api2_communication.c
index d1e28cc36..b048ad851 100644
--- a/src/transport/transport_api2_communication.c
+++ b/src/transport/transport_api2_communication.c
@@ -1081,7 +1081,6 @@ GNUNET_TRANSPORT_communicator_address_add (
1081 return ai; 1081 return ai;
1082} 1082}
1083 1083
1084
1085/** 1084/**
1086 * Notify transport service about an address that this communicator no 1085 * Notify transport service about an address that this communicator no
1087 * longer provides for this peer. 1086 * longer provides for this peer.
@@ -1100,6 +1099,20 @@ GNUNET_TRANSPORT_communicator_address_remove (
1100 GNUNET_free (ai); 1099 GNUNET_free (ai);
1101} 1100}
1102 1101
1102/**
1103 * Notify transport service that this communicator no longer provides all its addresses for this peer.
1104 *
1105 * @param ch The communicator handle.
1106 */
1107void
1108GNUNET_TRANSPORT_communicator_address_remove_all (
1109 struct GNUNET_TRANSPORT_CommunicatorHandle *ch)
1110{
1111 for (struct GNUNET_TRANSPORT_AddressIdentifier *ai = ch->ai_head; NULL != ai;
1112 ai = ai->next)
1113 GNUNET_TRANSPORT_communicator_address_remove (ai);
1114}
1115
1103 1116
1104/* ************************* Backchannel *************************** */ 1117/* ************************* Backchannel *************************** */
1105 1118
diff --git a/src/util/gnunet-qr.c b/src/util/gnunet-qr.c
index 83b2af2fc..451d61d40 100644
--- a/src/util/gnunet-qr.c
+++ b/src/util/gnunet-qr.c
@@ -36,7 +36,7 @@
36/** 36/**
37 * Video device to capture from. Sane default for GNU/Linux systems. 37 * Video device to capture from. Sane default for GNU/Linux systems.
38 */ 38 */
39static char *device = "/dev/video0"; 39static char *device;
40 40
41/** 41/**
42 * --verbose option 42 * --verbose option
@@ -51,7 +51,7 @@ static int silent = false;
51/** 51/**
52 * Handler exit code 52 * Handler exit code
53 */ 53 */
54static long unsigned int exit_code = 1; 54static long unsigned int exit_code = 0;
55 55
56/** 56/**
57 * Helper process we started. 57 * Helper process we started.
@@ -228,6 +228,8 @@ get_symbol (zbar_processor_t *proc)
228 } 228 }
229 229
230 /* initialize the Processor */ 230 /* initialize the Processor */
231 if (NULL == device)
232 device = GNUNET_strdup ("/dev/video0");
231 if (0 != (rc = zbar_processor_init (proc, device, 1))) 233 if (0 != (rc = zbar_processor_init (proc, device, 1)))
232 { 234 {
233 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 235 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -306,6 +308,7 @@ run_zbar ()
306 ret = GNUNET_strdup (data); 308 ret = GNUNET_strdup (data);
307 /* clean up */ 309 /* clean up */
308 zbar_processor_destroy (proc); 310 zbar_processor_destroy (proc);
311 GNUNET_free (device);
309 return ret; 312 return ret;
310} 313}
311 314
diff --git a/src/util/gnunet-uri.c b/src/util/gnunet-uri.c
index 9443c9120..de0ff1f92 100644
--- a/src/util/gnunet-uri.c
+++ b/src/util/gnunet-uri.c
@@ -29,7 +29,7 @@
29/** 29/**
30 * Handler exit code 30 * Handler exit code
31 */ 31 */
32static long unsigned int exit_code = 1; 32static long unsigned int exit_code = 0;
33 33
34/** 34/**
35 * Helper process we started. 35 * Helper process we started.