diff options
author | Phil <phil.buschmann@tum.de> | 2018-07-02 15:42:34 +0200 |
---|---|---|
committer | Phil <phil.buschmann@tum.de> | 2018-07-02 15:42:34 +0200 |
commit | 6ede545d597509fefcc3d4fd2ef865bc5f57603f (patch) | |
tree | 3839f25c1a4b594a5da56df47b8ef5bd25880c76 /src | |
parent | db8c5cd31a92cd18450bf9d2d595a8fd314583e0 (diff) | |
parent | bb3371542e3c1fff2c4abb4d2ba3decf925b4352 (diff) | |
download | gnunet-6ede545d597509fefcc3d4fd2ef865bc5f57603f.tar.gz gnunet-6ede545d597509fefcc3d4fd2ef865bc5f57603f.zip |
-Merge branch 'master' of ssh://gnunet.org/gnunet into gsoc2018/rest_api
Diffstat (limited to 'src')
134 files changed, 2268 insertions, 1465 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index d8d548706..00f30adc3 100644 --- a/src/Makefile.am +++ b/src/Makefile.am | |||
@@ -83,7 +83,6 @@ SUBDIRS = \ | |||
83 | $(REST_DIR) \ | 83 | $(REST_DIR) \ |
84 | $(JSONAPI_DIR) \ | 84 | $(JSONAPI_DIR) \ |
85 | hello \ | 85 | hello \ |
86 | tun \ | ||
87 | block \ | 86 | block \ |
88 | statistics \ | 87 | statistics \ |
89 | arm \ | 88 | arm \ |
diff --git a/src/arm/test_arm_api_data.conf b/src/arm/test_arm_api_data.conf index 276b313b7..fef6cfb40 100644 --- a/src/arm/test_arm_api_data.conf +++ b/src/arm/test_arm_api_data.conf | |||
@@ -16,7 +16,7 @@ PORT = 23355 | |||
16 | 16 | ||
17 | [do-nothing] | 17 | [do-nothing] |
18 | START_ON_DEMAND = NO | 18 | START_ON_DEMAND = NO |
19 | PORT = 2223 | 19 | PORT = 48223 |
20 | HOSTNAME = localhost | 20 | HOSTNAME = localhost |
21 | BINARY = /will/be/overwritten/by/test_exponential_backoff | 21 | BINARY = /will/be/overwritten/by/test_exponential_backoff |
22 | ACCEPT_FROM = 127.0.0.1; | 22 | ACCEPT_FROM = 127.0.0.1; |
diff --git a/src/ats/gnunet-service-ats_addresses.h b/src/ats/gnunet-service-ats_addresses.h index d90ca1375..d4dc483eb 100644 --- a/src/ats/gnunet-service-ats_addresses.h +++ b/src/ats/gnunet-service-ats_addresses.h | |||
@@ -151,7 +151,7 @@ | |||
151 | * 1.7 Address management | 151 | * 1.7 Address management |
152 | * | 152 | * |
153 | * Transport service notifies ATS about changes to the addresses known to | 153 | * Transport service notifies ATS about changes to the addresses known to |
154 | * him. | 154 | * it. |
155 | * | 155 | * |
156 | * 1.7.1 Adding an address | 156 | * 1.7.1 Adding an address |
157 | * | 157 | * |
diff --git a/src/ats/plugin_ats_mlp.c b/src/ats/plugin_ats_mlp.c index 7e7594f90..544b8d97f 100644 --- a/src/ats/plugin_ats_mlp.c +++ b/src/ats/plugin_ats_mlp.c | |||
@@ -1554,6 +1554,7 @@ GAS_mlp_solve_problem (void *solver) | |||
1554 | struct GNUNET_TIME_Relative dur_mlp; | 1554 | struct GNUNET_TIME_Relative dur_mlp; |
1555 | 1555 | ||
1556 | GNUNET_assert(NULL != solver); | 1556 | GNUNET_assert(NULL != solver); |
1557 | dur_lp = GNUNET_TIME_UNIT_ZERO; | ||
1557 | 1558 | ||
1558 | if (GNUNET_YES == mlp->stat_bulk_lock) | 1559 | if (GNUNET_YES == mlp->stat_bulk_lock) |
1559 | { | 1560 | { |
diff --git a/src/cadet/cadet.conf.in b/src/cadet/cadet.conf.in index 2f4c6a6db..d1ddcb96f 100644 --- a/src/cadet/cadet.conf.in +++ b/src/cadet/cadet.conf.in | |||
@@ -8,7 +8,7 @@ BINARY = gnunet-service-cadet | |||
8 | ACCEPT_FROM = 127.0.0.1; | 8 | ACCEPT_FROM = 127.0.0.1; |
9 | ACCEPT_FROM6 = ::1; | 9 | ACCEPT_FROM6 = ::1; |
10 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-cadet.sock | 10 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-cadet.sock |
11 | UNIX_MATCH_UID = YES | 11 | UNIX_MATCH_UID = NO |
12 | UNIX_MATCH_GID = YES | 12 | UNIX_MATCH_GID = YES |
13 | 13 | ||
14 | 14 | ||
diff --git a/src/cadet/cadet.h b/src/cadet/cadet.h index 69be4e537..bac4bc49d 100644 --- a/src/cadet/cadet.h +++ b/src/cadet/cadet.h | |||
@@ -258,6 +258,11 @@ struct GNUNET_CADET_LocalInfoPeer | |||
258 | * #GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS | 258 | * #GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS |
259 | */ | 259 | */ |
260 | struct GNUNET_MessageHeader header; | 260 | struct GNUNET_MessageHeader header; |
261 | |||
262 | /** | ||
263 | * Offset the peer has in the path this message is about. | ||
264 | */ | ||
265 | uint16_t offset GNUNET_PACKED; | ||
261 | 266 | ||
262 | /** | 267 | /** |
263 | * Number of paths. | 268 | * Number of paths. |
@@ -268,6 +273,11 @@ struct GNUNET_CADET_LocalInfoPeer | |||
268 | * Do we have a tunnel toward this peer? | 273 | * Do we have a tunnel toward this peer? |
269 | */ | 274 | */ |
270 | int16_t tunnel GNUNET_PACKED; | 275 | int16_t tunnel GNUNET_PACKED; |
276 | |||
277 | /** | ||
278 | * We are finished with the paths. | ||
279 | */ | ||
280 | uint16_t finished_with_paths; | ||
271 | 281 | ||
272 | /** | 282 | /** |
273 | * ID of the peer (can be local peer). | 283 | * ID of the peer (can be local peer). |
diff --git a/src/cadet/cadet_api.c b/src/cadet/cadet_api.c index 91054cd4f..319279110 100644 --- a/src/cadet/cadet_api.c +++ b/src/cadet/cadet_api.c | |||
@@ -357,67 +357,52 @@ reconnect (struct GNUNET_CADET_Handle *h); | |||
357 | 357 | ||
358 | 358 | ||
359 | /** | 359 | /** |
360 | * Reconnect callback: tries to reconnect again after a failer previous | 360 | * Function called during #reconnect_cbk() to (re)open |
361 | * reconnecttion | 361 | * all ports that are still open. |
362 | * | ||
363 | * @param cls closure (cadet handle) | ||
364 | */ | ||
365 | static void | ||
366 | reconnect_cbk (void *cls) | ||
367 | { | ||
368 | struct GNUNET_CADET_Handle *h = cls; | ||
369 | |||
370 | h->reconnect_task = NULL; | ||
371 | reconnect (h); | ||
372 | } | ||
373 | |||
374 | |||
375 | /** | ||
376 | * Function called during #reconnect() to destroy | ||
377 | * all channels that are still open. | ||
378 | * | 362 | * |
379 | * @param cls the `struct GNUNET_CADET_Handle` | 363 | * @param cls the `struct GNUNET_CADET_Handle` |
380 | * @param cid chanenl ID | 364 | * @param id port ID |
381 | * @param value a `struct GNUNET_CADET_Channel` to destroy | 365 | * @param value a `struct GNUNET_CADET_Channel` to open |
382 | * @return #GNUNET_OK (continue to iterate) | 366 | * @return #GNUNET_OK (continue to iterate) |
383 | */ | 367 | */ |
384 | static int | 368 | static int |
385 | destroy_channel_on_reconnect_cb (void *cls, | 369 | open_port_cb (void *cls, |
386 | uint32_t cid, | 370 | const struct GNUNET_HashCode *id, |
387 | void *value) | 371 | void *value) |
388 | { | 372 | { |
389 | /* struct GNUNET_CADET_Handle *handle = cls; */ | 373 | struct GNUNET_CADET_Handle *h = cls; |
390 | struct GNUNET_CADET_Channel *ch = value; | 374 | struct GNUNET_CADET_Port *port = value; |
375 | struct GNUNET_CADET_PortMessage *msg; | ||
376 | struct GNUNET_MQ_Envelope *env; | ||
391 | 377 | ||
392 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 378 | (void) id; |
393 | "Destroying channel due to reconnect\n"); | 379 | env = GNUNET_MQ_msg (msg, |
394 | destroy_channel (ch); | 380 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_OPEN); |
381 | msg->port = port->id; | ||
382 | GNUNET_MQ_send (h->mq, | ||
383 | env); | ||
395 | return GNUNET_OK; | 384 | return GNUNET_OK; |
396 | } | 385 | } |
397 | 386 | ||
398 | 387 | ||
399 | /** | 388 | /** |
400 | * Reconnect to the service, retransmit all infomation to try to restore the | 389 | * Reconnect callback: tries to reconnect again after a failer previous |
401 | * original state. | 390 | * reconnecttion |
402 | * | ||
403 | * @param h handle to the cadet | ||
404 | * | 391 | * |
405 | * @return #GNUNET_YES in case of sucess, #GNUNET_NO otherwise (service down...) | 392 | * @param cls closure (cadet handle) |
406 | */ | 393 | */ |
407 | static void | 394 | static void |
408 | schedule_reconnect (struct GNUNET_CADET_Handle *h) | 395 | reconnect_cbk (void *cls) |
409 | { | 396 | { |
410 | if (NULL != h->reconnect_task) | 397 | struct GNUNET_CADET_Handle *h = cls; |
411 | return; | 398 | |
412 | GNUNET_CONTAINER_multihashmap32_iterate (h->channels, | 399 | h->reconnect_task = NULL; |
413 | &destroy_channel_on_reconnect_cb, | ||
414 | h); | ||
415 | h->reconnect_task | ||
416 | = GNUNET_SCHEDULER_add_delayed (h->reconnect_time, | ||
417 | &reconnect_cbk, | ||
418 | h); | ||
419 | h->reconnect_time | 400 | h->reconnect_time |
420 | = GNUNET_TIME_STD_BACKOFF (h->reconnect_time); | 401 | = GNUNET_TIME_STD_BACKOFF (h->reconnect_time); |
402 | reconnect (h); | ||
403 | GNUNET_CONTAINER_multihashmap_iterate (h->ports, | ||
404 | &open_port_cb, | ||
405 | h); | ||
421 | } | 406 | } |
422 | 407 | ||
423 | 408 | ||
@@ -555,15 +540,16 @@ cadet_mq_error_handler (void *cls, | |||
555 | { | 540 | { |
556 | struct GNUNET_CADET_Channel *ch = cls; | 541 | struct GNUNET_CADET_Channel *ch = cls; |
557 | 542 | ||
558 | GNUNET_break (0); | ||
559 | if (GNUNET_MQ_ERROR_NO_MATCH == error) | 543 | if (GNUNET_MQ_ERROR_NO_MATCH == error) |
560 | { | 544 | { |
561 | /* Got a message we did not understand, still try to continue! */ | 545 | /* Got a message we did not understand, still try to continue! */ |
546 | GNUNET_break_op (0); | ||
562 | GNUNET_CADET_receive_done (ch); | 547 | GNUNET_CADET_receive_done (ch); |
563 | } | 548 | } |
564 | else | 549 | else |
565 | { | 550 | { |
566 | schedule_reconnect (ch->cadet); | 551 | GNUNET_break (0); |
552 | GNUNET_CADET_channel_destroy (ch); | ||
567 | } | 553 | } |
568 | } | 554 | } |
569 | 555 | ||
@@ -581,6 +567,7 @@ cadet_mq_cancel_impl (struct GNUNET_MQ_Handle *mq, | |||
581 | { | 567 | { |
582 | struct GNUNET_CADET_Channel *ch = impl_state; | 568 | struct GNUNET_CADET_Channel *ch = impl_state; |
583 | 569 | ||
570 | (void) mq; | ||
584 | GNUNET_assert (NULL != ch->pending_env); | 571 | GNUNET_assert (NULL != ch->pending_env); |
585 | GNUNET_MQ_discard (ch->pending_env); | 572 | GNUNET_MQ_discard (ch->pending_env); |
586 | ch->pending_env = NULL; | 573 | ch->pending_env = NULL; |
@@ -709,6 +696,7 @@ check_local_data (void *cls, | |||
709 | { | 696 | { |
710 | uint16_t size; | 697 | uint16_t size; |
711 | 698 | ||
699 | (void) cls; | ||
712 | size = ntohs (message->header.size); | 700 | size = ntohs (message->header.size); |
713 | if (sizeof (*message) + sizeof (struct GNUNET_MessageHeader) > size) | 701 | if (sizeof (*message) + sizeof (struct GNUNET_MessageHeader) > size) |
714 | { | 702 | { |
@@ -806,6 +794,32 @@ handle_local_ack (void *cls, | |||
806 | 794 | ||
807 | 795 | ||
808 | /** | 796 | /** |
797 | * Function called during #GNUNET_CADET_disconnect() to destroy | ||
798 | * all channels that are still open. | ||
799 | * | ||
800 | * @param cls the `struct GNUNET_CADET_Handle` | ||
801 | * @param cid chanenl ID | ||
802 | * @param value a `struct GNUNET_CADET_Channel` to destroy | ||
803 | * @return #GNUNET_OK (continue to iterate) | ||
804 | */ | ||
805 | static int | ||
806 | destroy_channel_cb (void *cls, | ||
807 | uint32_t cid, | ||
808 | void *value) | ||
809 | { | ||
810 | /* struct GNUNET_CADET_Handle *handle = cls; */ | ||
811 | struct GNUNET_CADET_Channel *ch = value; | ||
812 | |||
813 | (void) cls; | ||
814 | (void) cid; | ||
815 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
816 | "Destroying channel due to GNUNET_CADET_disconnect()\n"); | ||
817 | destroy_channel (ch); | ||
818 | return GNUNET_OK; | ||
819 | } | ||
820 | |||
821 | |||
822 | /** | ||
809 | * Generic error handler, called with the appropriate error code and | 823 | * Generic error handler, called with the appropriate error code and |
810 | * the same closure specified at the creation of the message queue. | 824 | * the same closure specified at the creation of the message queue. |
811 | * Not every message queue implementation supports an error handler. | 825 | * Not every message queue implementation supports an error handler. |
@@ -822,9 +836,14 @@ handle_mq_error (void *cls, | |||
822 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 836 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
823 | "MQ ERROR: %u\n", | 837 | "MQ ERROR: %u\n", |
824 | error); | 838 | error); |
839 | GNUNET_CONTAINER_multihashmap32_iterate (h->channels, | ||
840 | &destroy_channel_cb, | ||
841 | h); | ||
825 | GNUNET_MQ_destroy (h->mq); | 842 | GNUNET_MQ_destroy (h->mq); |
826 | h->mq = NULL; | 843 | h->mq = NULL; |
827 | reconnect (h); | 844 | h->reconnect_task = GNUNET_SCHEDULER_add_delayed (h->reconnect_time, |
845 | &reconnect_cbk, | ||
846 | h); | ||
828 | } | 847 | } |
829 | 848 | ||
830 | 849 | ||
@@ -842,6 +861,7 @@ check_get_peers (void *cls, | |||
842 | { | 861 | { |
843 | size_t esize; | 862 | size_t esize; |
844 | 863 | ||
864 | (void) cls; | ||
845 | esize = ntohs (message->size); | 865 | esize = ntohs (message->size); |
846 | if (sizeof (struct GNUNET_CADET_LocalInfoPeer) == esize) | 866 | if (sizeof (struct GNUNET_CADET_LocalInfoPeer) == esize) |
847 | return GNUNET_OK; | 867 | return GNUNET_OK; |
@@ -895,12 +915,9 @@ check_get_peer (void *cls, | |||
895 | const struct GNUNET_CADET_LocalInfoPeer *message) | 915 | const struct GNUNET_CADET_LocalInfoPeer *message) |
896 | { | 916 | { |
897 | size_t msize = sizeof (struct GNUNET_CADET_LocalInfoPeer); | 917 | size_t msize = sizeof (struct GNUNET_CADET_LocalInfoPeer); |
898 | const struct GNUNET_PeerIdentity *paths_array; | ||
899 | size_t esize; | 918 | size_t esize; |
900 | unsigned int epaths; | ||
901 | unsigned int paths; | ||
902 | unsigned int peers; | ||
903 | 919 | ||
920 | (void) cls; | ||
904 | esize = ntohs (message->header.size); | 921 | esize = ntohs (message->header.size); |
905 | if (esize < msize) | 922 | if (esize < msize) |
906 | { | 923 | { |
@@ -912,20 +929,6 @@ check_get_peer (void *cls, | |||
912 | GNUNET_break (0); | 929 | GNUNET_break (0); |
913 | return GNUNET_SYSERR; | 930 | return GNUNET_SYSERR; |
914 | } | 931 | } |
915 | peers = (esize - msize) / sizeof (struct GNUNET_PeerIdentity); | ||
916 | epaths = ntohs (message->paths); | ||
917 | paths_array = (const struct GNUNET_PeerIdentity *) &message[1]; | ||
918 | paths = 0; | ||
919 | for (unsigned int i = 0; i < peers; i++) | ||
920 | if (0 == memcmp (&paths_array[i], | ||
921 | &message->destination, | ||
922 | sizeof (struct GNUNET_PeerIdentity))) | ||
923 | paths++; | ||
924 | if (paths != epaths) | ||
925 | { | ||
926 | GNUNET_break (0); | ||
927 | return GNUNET_SYSERR; | ||
928 | } | ||
929 | return GNUNET_OK; | 932 | return GNUNET_OK; |
930 | } | 933 | } |
931 | 934 | ||
@@ -949,6 +952,11 @@ handle_get_peer (void *cls, | |||
949 | 952 | ||
950 | if (NULL == h->info_cb.peer_cb) | 953 | if (NULL == h->info_cb.peer_cb) |
951 | return; | 954 | return; |
955 | |||
956 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
957 | "number of paths %u\n", | ||
958 | ntohs (message->paths)); | ||
959 | |||
952 | paths = ntohs (message->paths); | 960 | paths = ntohs (message->paths); |
953 | paths_array = (const struct GNUNET_PeerIdentity *) &message[1]; | 961 | paths_array = (const struct GNUNET_PeerIdentity *) &message[1]; |
954 | peers = (ntohs (message->header.size) - sizeof (*message)) | 962 | peers = (ntohs (message->header.size) - sizeof (*message)) |
@@ -978,7 +986,9 @@ handle_get_peer (void *cls, | |||
978 | (int) ntohs (message->tunnel), | 986 | (int) ntohs (message->tunnel), |
979 | neighbor, | 987 | neighbor, |
980 | paths, | 988 | paths, |
981 | paths_array); | 989 | paths_array, |
990 | (int) ntohs (message->offset), | ||
991 | (int) ntohs (message->finished_with_paths)); | ||
982 | } | 992 | } |
983 | 993 | ||
984 | 994 | ||
@@ -1170,38 +1180,6 @@ reconnect (struct GNUNET_CADET_Handle *h) | |||
1170 | handlers, | 1180 | handlers, |
1171 | &handle_mq_error, | 1181 | &handle_mq_error, |
1172 | h); | 1182 | h); |
1173 | if (NULL == h->mq) | ||
1174 | { | ||
1175 | schedule_reconnect (h); | ||
1176 | return; | ||
1177 | } | ||
1178 | h->reconnect_time = GNUNET_TIME_UNIT_MILLISECONDS; | ||
1179 | } | ||
1180 | |||
1181 | |||
1182 | /** | ||
1183 | * Function called during #GNUNET_CADET_disconnect() to destroy | ||
1184 | * all channels that are still open. | ||
1185 | * | ||
1186 | * @param cls the `struct GNUNET_CADET_Handle` | ||
1187 | * @param cid chanenl ID | ||
1188 | * @param value a `struct GNUNET_CADET_Channel` to destroy | ||
1189 | * @return #GNUNET_OK (continue to iterate) | ||
1190 | */ | ||
1191 | static int | ||
1192 | destroy_channel_cb (void *cls, | ||
1193 | uint32_t cid, | ||
1194 | void *value) | ||
1195 | { | ||
1196 | /* struct GNUNET_CADET_Handle *handle = cls; */ | ||
1197 | struct GNUNET_CADET_Channel *ch = value; | ||
1198 | |||
1199 | (void) cls; | ||
1200 | (void) cid; | ||
1201 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
1202 | "Destroying channel due to GNUNET_CADET_disconnect()\n"); | ||
1203 | destroy_channel (ch); | ||
1204 | return GNUNET_OK; | ||
1205 | } | 1183 | } |
1206 | 1184 | ||
1207 | 1185 | ||
@@ -1223,6 +1201,7 @@ destroy_port_cb (void *cls, | |||
1223 | struct GNUNET_CADET_Port *port = value; | 1201 | struct GNUNET_CADET_Port *port = value; |
1224 | 1202 | ||
1225 | (void) cls; | 1203 | (void) cls; |
1204 | (void) id; | ||
1226 | /* This is a warning, the app should have cleanly closed all open ports */ | 1205 | /* This is a warning, the app should have cleanly closed all open ports */ |
1227 | GNUNET_break (0); | 1206 | GNUNET_break (0); |
1228 | GNUNET_CADET_close_port (port); | 1207 | GNUNET_CADET_close_port (port); |
@@ -1274,18 +1253,21 @@ GNUNET_CADET_disconnect (struct GNUNET_CADET_Handle *handle) | |||
1274 | void | 1253 | void |
1275 | GNUNET_CADET_close_port (struct GNUNET_CADET_Port *p) | 1254 | GNUNET_CADET_close_port (struct GNUNET_CADET_Port *p) |
1276 | { | 1255 | { |
1277 | struct GNUNET_CADET_PortMessage *msg; | ||
1278 | struct GNUNET_MQ_Envelope *env; | ||
1279 | |||
1280 | GNUNET_assert (GNUNET_YES == | 1256 | GNUNET_assert (GNUNET_YES == |
1281 | GNUNET_CONTAINER_multihashmap_remove (p->cadet->ports, | 1257 | GNUNET_CONTAINER_multihashmap_remove (p->cadet->ports, |
1282 | &p->id, | 1258 | &p->id, |
1283 | p)); | 1259 | p)); |
1284 | env = GNUNET_MQ_msg (msg, | 1260 | if (NULL != p->cadet->mq) |
1285 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_CLOSE); | 1261 | { |
1286 | msg->port = p->id; | 1262 | struct GNUNET_CADET_PortMessage *msg; |
1287 | GNUNET_MQ_send (p->cadet->mq, | 1263 | struct GNUNET_MQ_Envelope *env; |
1288 | env); | 1264 | |
1265 | env = GNUNET_MQ_msg (msg, | ||
1266 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_CLOSE); | ||
1267 | msg->port = p->id; | ||
1268 | GNUNET_MQ_send (p->cadet->mq, | ||
1269 | env); | ||
1270 | } | ||
1289 | GNUNET_free_non_null (p->handlers); | 1271 | GNUNET_free_non_null (p->handlers); |
1290 | GNUNET_free (p); | 1272 | GNUNET_free (p); |
1291 | } | 1273 | } |
@@ -1637,9 +1619,6 @@ GNUNET_CADET_connect (const struct GNUNET_CONFIGURATION_Handle *cfg) | |||
1637 | return NULL; | 1619 | return NULL; |
1638 | } | 1620 | } |
1639 | h->next_ccn.channel_of_client = htonl (GNUNET_CADET_LOCAL_CHANNEL_ID_CLI); | 1621 | h->next_ccn.channel_of_client = htonl (GNUNET_CADET_LOCAL_CHANNEL_ID_CLI); |
1640 | h->reconnect_time = GNUNET_TIME_UNIT_MILLISECONDS; | ||
1641 | h->reconnect_task = NULL; | ||
1642 | |||
1643 | return h; | 1622 | return h; |
1644 | } | 1623 | } |
1645 | 1624 | ||
@@ -1665,8 +1644,6 @@ GNUNET_CADET_open_port (struct GNUNET_CADET_Handle *h, | |||
1665 | GNUNET_CADET_DisconnectEventHandler disconnects, | 1644 | GNUNET_CADET_DisconnectEventHandler disconnects, |
1666 | const struct GNUNET_MQ_MessageHandler *handlers) | 1645 | const struct GNUNET_MQ_MessageHandler *handlers) |
1667 | { | 1646 | { |
1668 | struct GNUNET_CADET_PortMessage *msg; | ||
1669 | struct GNUNET_MQ_Envelope *env; | ||
1670 | struct GNUNET_CADET_Port *p; | 1647 | struct GNUNET_CADET_Port *p; |
1671 | 1648 | ||
1672 | GNUNET_assert (NULL != connects); | 1649 | GNUNET_assert (NULL != connects); |
@@ -1692,13 +1669,11 @@ GNUNET_CADET_open_port (struct GNUNET_CADET_Handle *h, | |||
1692 | p->window_changes = window_changes; | 1669 | p->window_changes = window_changes; |
1693 | p->disconnects = disconnects; | 1670 | p->disconnects = disconnects; |
1694 | p->handlers = GNUNET_MQ_copy_handlers (handlers); | 1671 | p->handlers = GNUNET_MQ_copy_handlers (handlers); |
1695 | 1672 | ||
1696 | 1673 | GNUNET_assert (GNUNET_OK == | |
1697 | env = GNUNET_MQ_msg (msg, | 1674 | open_port_cb (h, |
1698 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_OPEN); | 1675 | &p->id, |
1699 | msg->port = p->id; | 1676 | p)); |
1700 | GNUNET_MQ_send (h->mq, | ||
1701 | env); | ||
1702 | return p; | 1677 | return p; |
1703 | } | 1678 | } |
1704 | 1679 | ||
@@ -1757,7 +1732,8 @@ GNUNET_CADET_channel_create (struct GNUNET_CADET_Handle *h, | |||
1757 | handlers, | 1732 | handlers, |
1758 | &cadet_mq_error_handler, | 1733 | &cadet_mq_error_handler, |
1759 | ch); | 1734 | ch); |
1760 | GNUNET_MQ_set_handlers_closure (ch->mq, channel_cls); | 1735 | GNUNET_MQ_set_handlers_closure (ch->mq, |
1736 | channel_cls); | ||
1761 | 1737 | ||
1762 | /* Request channel creation to service */ | 1738 | /* Request channel creation to service */ |
1763 | env = GNUNET_MQ_msg (msg, | 1739 | env = GNUNET_MQ_msg (msg, |
diff --git a/src/cadet/cadet_test_lib.c b/src/cadet/cadet_test_lib.c index 760378c89..1a1c15f48 100644 --- a/src/cadet/cadet_test_lib.c +++ b/src/cadet/cadet_test_lib.c | |||
@@ -135,6 +135,11 @@ cadet_connect_adapter (void *cls, | |||
135 | struct GNUNET_CADET_Handle *h; | 135 | struct GNUNET_CADET_Handle *h; |
136 | 136 | ||
137 | h = GNUNET_CADET_connect (cfg); | 137 | h = GNUNET_CADET_connect (cfg); |
138 | if (NULL == h) | ||
139 | { | ||
140 | GNUNET_break(0); | ||
141 | return NULL; | ||
142 | } | ||
138 | if (NULL == ctx->ports) | 143 | if (NULL == ctx->ports) |
139 | return h; | 144 | return h; |
140 | actx->ports = GNUNET_new_array (ctx->port_count, | 145 | actx->ports = GNUNET_new_array (ctx->port_count, |
diff --git a/src/cadet/gnunet-cadet.c b/src/cadet/gnunet-cadet.c index 04a595a7b..13b04b885 100644 --- a/src/cadet/gnunet-cadet.c +++ b/src/cadet/gnunet-cadet.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include "gnunet_cadet_service.h" | 27 | #include "gnunet_cadet_service.h" |
28 | #include "cadet.h" | 28 | #include "cadet.h" |
29 | 29 | ||
30 | #define STREAM_BUFFER_SIZE 1024 // Pakets | ||
30 | 31 | ||
31 | /** | 32 | /** |
32 | * Option -P. | 33 | * Option -P. |
@@ -123,6 +124,8 @@ static struct GNUNET_SCHEDULER_Task *rd_task; | |||
123 | */ | 124 | */ |
124 | static struct GNUNET_SCHEDULER_Task *job; | 125 | static struct GNUNET_SCHEDULER_Task *job; |
125 | 126 | ||
127 | static unsigned int sent_pkt; | ||
128 | |||
126 | 129 | ||
127 | /** | 130 | /** |
128 | * Wait for input on STDIO and send it out over the #ch. | 131 | * Wait for input on STDIO and send it out over the #ch. |
@@ -196,6 +199,11 @@ shutdown_task (void *cls) | |||
196 | { | 199 | { |
197 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 200 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
198 | "Shutdown\n"); | 201 | "Shutdown\n"); |
202 | if (NULL != lp) | ||
203 | { | ||
204 | GNUNET_CADET_close_port (lp); | ||
205 | lp = NULL; | ||
206 | } | ||
199 | if (NULL != ch) | 207 | if (NULL != ch) |
200 | { | 208 | { |
201 | GNUNET_CADET_channel_destroy (ch); | 209 | GNUNET_CADET_channel_destroy (ch); |
@@ -223,6 +231,12 @@ shutdown_task (void *cls) | |||
223 | } | 231 | } |
224 | } | 232 | } |
225 | 233 | ||
234 | void | ||
235 | mq_cb(void *cls) | ||
236 | { | ||
237 | listen_stdio (); | ||
238 | } | ||
239 | |||
226 | 240 | ||
227 | /** | 241 | /** |
228 | * Task run in stdio mode, after some data is available at stdin. | 242 | * Task run in stdio mode, after some data is available at stdin. |
@@ -243,6 +257,8 @@ read_stdio (void *cls) | |||
243 | 60000); | 257 | 60000); |
244 | if (data_size < 1) | 258 | if (data_size < 1) |
245 | { | 259 | { |
260 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
261 | "read() returned %s\n", strerror(errno)); | ||
246 | GNUNET_SCHEDULER_shutdown(); | 262 | GNUNET_SCHEDULER_shutdown(); |
247 | return; | 263 | return; |
248 | } | 264 | } |
@@ -257,9 +273,21 @@ read_stdio (void *cls) | |||
257 | data_size); | 273 | data_size); |
258 | GNUNET_MQ_send (GNUNET_CADET_get_mq (ch), | 274 | GNUNET_MQ_send (GNUNET_CADET_get_mq (ch), |
259 | env); | 275 | env); |
276 | |||
277 | sent_pkt++; | ||
278 | |||
260 | if (GNUNET_NO == echo) | 279 | if (GNUNET_NO == echo) |
261 | { | 280 | { |
262 | listen_stdio (); | 281 | // Use MQ's notification if too much data of stdin is pooring in too fast. |
282 | if (STREAM_BUFFER_SIZE < sent_pkt) | ||
283 | { | ||
284 | GNUNET_MQ_notify_sent (env, mq_cb, cls); | ||
285 | sent_pkt = 0; | ||
286 | } | ||
287 | else | ||
288 | { | ||
289 | listen_stdio (); | ||
290 | } | ||
263 | } | 291 | } |
264 | else | 292 | else |
265 | { | 293 | { |
@@ -525,34 +553,48 @@ peer_callback (void *cls, | |||
525 | int tunnel, | 553 | int tunnel, |
526 | int neighbor, | 554 | int neighbor, |
527 | unsigned int n_paths, | 555 | unsigned int n_paths, |
528 | const struct GNUNET_PeerIdentity *paths) | 556 | const struct GNUNET_PeerIdentity *paths, |
557 | int offset, | ||
558 | int finished_with_paths) | ||
529 | { | 559 | { |
530 | unsigned int i; | 560 | unsigned int i; |
531 | const struct GNUNET_PeerIdentity *p; | 561 | const struct GNUNET_PeerIdentity *p; |
532 | 562 | ||
533 | FPRINTF (stdout, | 563 | |
534 | "%s [TUNNEL: %s, NEIGHBOR: %s, PATHS: %u]\n", | 564 | if (GNUNET_YES == finished_with_paths) |
535 | GNUNET_i2s_full (peer), | ||
536 | tunnel ? "Y" : "N", | ||
537 | neighbor ? "Y" : "N", | ||
538 | n_paths); | ||
539 | p = paths; | ||
540 | for (i = 0; i < n_paths && NULL != p;) | ||
541 | { | 565 | { |
566 | GNUNET_SCHEDULER_shutdown(); | ||
567 | return; | ||
568 | } | ||
569 | |||
570 | if (offset == 0){ | ||
571 | FPRINTF (stdout, | ||
572 | "%s [TUNNEL: %s, NEIGHBOR: %s, PATHS: %u]\n", | ||
573 | GNUNET_i2s_full (peer), | ||
574 | tunnel ? "Y" : "N", | ||
575 | neighbor ? "Y" : "N", | ||
576 | n_paths); | ||
577 | }else{ | ||
578 | p = paths; | ||
542 | FPRINTF (stdout, | 579 | FPRINTF (stdout, |
543 | "%s ", | 580 | "Indirekt path with offset %u: ", |
544 | GNUNET_i2s (p)); | 581 | offset); |
545 | if (0 == memcmp (p, | 582 | for (i = 0; i <= offset && NULL != p;) |
546 | peer, | ||
547 | sizeof (*p))) | ||
548 | { | 583 | { |
549 | FPRINTF (stdout, "\n"); | 584 | FPRINTF (stdout, |
550 | i++; | 585 | "%s ", |
586 | GNUNET_i2s (p)); | ||
587 | i++; | ||
588 | p++; | ||
551 | } | 589 | } |
552 | p++; | 590 | |
591 | FPRINTF (stdout, | ||
592 | "\n"); | ||
593 | |||
553 | } | 594 | } |
595 | |||
554 | 596 | ||
555 | GNUNET_SCHEDULER_shutdown(); | 597 | |
556 | } | 598 | } |
557 | 599 | ||
558 | 600 | ||
diff --git a/src/cadet/gnunet-service-cadet.c b/src/cadet/gnunet-service-cadet.c index 38037e92f..4568d2733 100644 --- a/src/cadet/gnunet-service-cadet.c +++ b/src/cadet/gnunet-service-cadet.c | |||
@@ -822,7 +822,7 @@ get_all_peers_iterator (void *cls, | |||
822 | struct GNUNET_CADET_LocalInfoPeer *msg; | 822 | struct GNUNET_CADET_LocalInfoPeer *msg; |
823 | 823 | ||
824 | env = GNUNET_MQ_msg (msg, | 824 | env = GNUNET_MQ_msg (msg, |
825 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS); | 825 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS); |
826 | msg->destination = *peer; | 826 | msg->destination = *peer; |
827 | msg->paths = htons (GCP_count_paths (p)); | 827 | msg->paths = htons (GCP_count_paths (p)); |
828 | msg->tunnel = htons (NULL != GCP_get_tunnel (p, | 828 | msg->tunnel = htons (NULL != GCP_get_tunnel (p, |
@@ -881,7 +881,7 @@ path_info_iterator (void *cls, | |||
881 | unsigned int path_length; | 881 | unsigned int path_length; |
882 | 882 | ||
883 | path_length = GCPP_get_length (path); | 883 | path_length = GCPP_get_length (path); |
884 | path_size = sizeof (struct GNUNET_PeerIdentity) * (path_length - 1); | 884 | path_size = sizeof (struct GNUNET_PeerIdentity) * path_length; |
885 | if (sizeof (*resp) + path_size > UINT16_MAX) | 885 | if (sizeof (*resp) + path_size > UINT16_MAX) |
886 | { | 886 | { |
887 | LOG (GNUNET_ERROR_TYPE_WARNING, | 887 | LOG (GNUNET_ERROR_TYPE_WARNING, |
@@ -892,19 +892,57 @@ path_info_iterator (void *cls, | |||
892 | env = GNUNET_MQ_msg_extra (resp, | 892 | env = GNUNET_MQ_msg_extra (resp, |
893 | path_size, | 893 | path_size, |
894 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEER); | 894 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEER); |
895 | |||
896 | |||
897 | resp->offset = htons(off); | ||
898 | resp->finished_with_paths = htons(0); | ||
899 | |||
895 | id = (struct GNUNET_PeerIdentity *) &resp[1]; | 900 | id = (struct GNUNET_PeerIdentity *) &resp[1]; |
896 | 901 | ||
897 | /* Don't copy first peer. First peer is always the local one. Last | 902 | /* Don't copy first peer. First peer is always the local one. Last |
898 | * peer is always the destination (leave as 0, EOL). | 903 | * peer is always the destination (leave as 0, EOL). |
899 | */ | 904 | */ |
900 | for (i = 0; i < off; i++) | 905 | for (i = 0; i <= off; i++) |
901 | id[i] = *GCP_get_id (GCPP_get_peer_at_offset (path, | 906 | id[i] = *GCP_get_id (GCPP_get_peer_at_offset (path, |
902 | i + 1)); | 907 | i)); |
903 | GNUNET_MQ_send (mq, | 908 | GNUNET_MQ_send (mq, |
904 | env); | 909 | env); |
905 | return GNUNET_YES; | 910 | return GNUNET_YES; |
906 | } | 911 | } |
907 | 912 | ||
913 | /** | ||
914 | * Getting summary information about the number of paths and if a tunnel exists, | ||
915 | * and the indirect paths to a peer, if there are ones. | ||
916 | * | ||
917 | * @param cls Closure (). | ||
918 | * @param peer Peer ID (tunnel remote peer). | ||
919 | * @param value Peer info. | ||
920 | * @return #GNUNET_YES, to keep iterating. | ||
921 | */ | ||
922 | static void | ||
923 | get_peer_info (void *cls, | ||
924 | const struct GNUNET_PeerIdentity *peer, | ||
925 | struct CadetPeer *p) | ||
926 | { | ||
927 | struct CadetClient *c = cls; | ||
928 | struct GNUNET_MQ_Envelope *env; | ||
929 | struct GNUNET_CADET_LocalInfoPeer *msg; | ||
930 | |||
931 | env = GNUNET_MQ_msg (msg, | ||
932 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEER); | ||
933 | msg->offset = htons(0); | ||
934 | msg->destination = *peer; | ||
935 | msg->paths = htons (GCP_count_paths (p)); | ||
936 | msg->tunnel = htons (NULL != GCP_get_tunnel (p, | ||
937 | GNUNET_NO)); | ||
938 | msg->finished_with_paths = htons(0); | ||
939 | GNUNET_MQ_send (c->mq, | ||
940 | env); | ||
941 | GCP_iterate_indirect_paths (p, | ||
942 | &path_info_iterator, | ||
943 | c->mq); | ||
944 | } | ||
945 | |||
908 | 946 | ||
909 | /** | 947 | /** |
910 | * Handler for client's SHOW_PEER request. | 948 | * Handler for client's SHOW_PEER request. |
@@ -919,19 +957,23 @@ handle_show_peer (void *cls, | |||
919 | struct CadetClient *c = cls; | 957 | struct CadetClient *c = cls; |
920 | struct CadetPeer *p; | 958 | struct CadetPeer *p; |
921 | struct GNUNET_MQ_Envelope *env; | 959 | struct GNUNET_MQ_Envelope *env; |
922 | struct GNUNET_MessageHeader *resp; | 960 | struct GNUNET_CADET_LocalInfoPeer *resp; |
923 | 961 | ||
924 | p = GCP_get (&msg->peer, | 962 | p = GCP_get (&msg->peer, |
925 | GNUNET_NO); | 963 | GNUNET_NO); |
926 | if (NULL != p) | 964 | if (NULL != p){ |
927 | GCP_iterate_paths (p, | 965 | get_peer_info(c, &(msg->peer), p); |
928 | &path_info_iterator, | 966 | } |
929 | c->mq); | 967 | |
930 | /* Send message with 0/0 to indicate the end */ | 968 | |
931 | env = GNUNET_MQ_msg (resp, | 969 | env = GNUNET_MQ_msg (resp, |
932 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEER_END); | 970 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEER); |
971 | resp->finished_with_paths = htons(1); | ||
972 | resp->destination = msg->peer; | ||
973 | |||
933 | GNUNET_MQ_send (c->mq, | 974 | GNUNET_MQ_send (c->mq, |
934 | env); | 975 | env); |
976 | |||
935 | GNUNET_SERVICE_client_continue (c->client); | 977 | GNUNET_SERVICE_client_continue (c->client); |
936 | } | 978 | } |
937 | 979 | ||
diff --git a/src/cadet/gnunet-service-cadet_paths.c b/src/cadet/gnunet-service-cadet_paths.c index e77d54e55..593617ff6 100644 --- a/src/cadet/gnunet-service-cadet_paths.c +++ b/src/cadet/gnunet-service-cadet_paths.c | |||
@@ -17,7 +17,7 @@ | |||
17 | */ | 17 | */ |
18 | /** | 18 | /** |
19 | * @file cadet/gnunet-service-cadet_paths.c | 19 | * @file cadet/gnunet-service-cadet_paths.c |
20 | * @brief Information we track per path. | 20 | * @brief Information we track per path. |
21 | * @author Bartlomiej Polot | 21 | * @author Bartlomiej Polot |
22 | * @author Christian Grothoff | 22 | * @author Christian Grothoff |
23 | */ | 23 | */ |
diff --git a/src/cadet/gnunet-service-cadet_peer.c b/src/cadet/gnunet-service-cadet_peer.c index 9cd1f5229..b375d51ca 100644 --- a/src/cadet/gnunet-service-cadet_peer.c +++ b/src/cadet/gnunet-service-cadet_peer.c | |||
@@ -243,7 +243,17 @@ GCP_2s (const struct CadetPeer *cp) | |||
243 | static char buf[5]; | 243 | static char buf[5]; |
244 | char *ret; | 244 | char *ret; |
245 | 245 | ||
246 | if ((NULL == cp) || | ||
247 | (NULL == &cp->pid.public_key)) | ||
248 | return "NULL"; | ||
249 | |||
250 | |||
246 | ret = GNUNET_CRYPTO_eddsa_public_key_to_string (&cp->pid.public_key); | 251 | ret = GNUNET_CRYPTO_eddsa_public_key_to_string (&cp->pid.public_key); |
252 | |||
253 | if (NULL == ret) | ||
254 | return "NULL"; | ||
255 | |||
256 | |||
247 | strncpy (buf, | 257 | strncpy (buf, |
248 | ret, | 258 | ret, |
249 | sizeof (buf) - 1); | 259 | sizeof (buf) - 1); |
@@ -1207,6 +1217,8 @@ GCP_iterate_paths (struct CadetPeer *cp, | |||
1207 | (NULL == cp->core_mq) ? "" : " including direct link"); | 1217 | (NULL == cp->core_mq) ? "" : " including direct link"); |
1208 | if (NULL != cp->core_mq) | 1218 | if (NULL != cp->core_mq) |
1209 | { | 1219 | { |
1220 | /* FIXME: this branch seems to duplicate the | ||
1221 | i=0 case below (direct link). Leave out!??? -CG */ | ||
1210 | struct CadetPeerPath *path; | 1222 | struct CadetPeerPath *path; |
1211 | 1223 | ||
1212 | path = GCPP_get_path_from_route (1, | 1224 | path = GCPP_get_path_from_route (1, |
@@ -1235,6 +1247,41 @@ GCP_iterate_paths (struct CadetPeer *cp, | |||
1235 | return ret; | 1247 | return ret; |
1236 | } | 1248 | } |
1237 | 1249 | ||
1250 | /** | ||
1251 | * Iterate over the paths to a peer without direct link. | ||
1252 | * | ||
1253 | * @param cp Peer to get path info. | ||
1254 | * @param callback Function to call for every path. | ||
1255 | * @param callback_cls Closure for @a callback. | ||
1256 | * @return Number of iterated paths. | ||
1257 | */ | ||
1258 | unsigned int | ||
1259 | GCP_iterate_indirect_paths (struct CadetPeer *cp, | ||
1260 | GCP_PathIterator callback, | ||
1261 | void *callback_cls) | ||
1262 | { | ||
1263 | unsigned int ret = 0; | ||
1264 | |||
1265 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1266 | "Iterating over paths to peer %s without direct link\n", | ||
1267 | GCP_2s (cp)); | ||
1268 | for (unsigned int i=1;i<cp->path_dll_length;i++) | ||
1269 | { | ||
1270 | for (struct CadetPeerPathEntry *pe = cp->path_heads[i]; | ||
1271 | NULL != pe; | ||
1272 | pe = pe->next) | ||
1273 | { | ||
1274 | ret++; | ||
1275 | if (GNUNET_NO == | ||
1276 | callback (callback_cls, | ||
1277 | pe->path, | ||
1278 | i)) | ||
1279 | return ret; | ||
1280 | } | ||
1281 | } | ||
1282 | return ret; | ||
1283 | } | ||
1284 | |||
1238 | 1285 | ||
1239 | /** | 1286 | /** |
1240 | * Iterate over the paths to @a cp where | 1287 | * Iterate over the paths to @a cp where |
diff --git a/src/cadet/gnunet-service-cadet_peer.h b/src/cadet/gnunet-service-cadet_peer.h index 2357a293d..3b8b31b9a 100644 --- a/src/cadet/gnunet-service-cadet_peer.h +++ b/src/cadet/gnunet-service-cadet_peer.h | |||
@@ -139,6 +139,19 @@ GCP_iterate_paths (struct CadetPeer *cp, | |||
139 | GCP_PathIterator callback, | 139 | GCP_PathIterator callback, |
140 | void *callback_cls); | 140 | void *callback_cls); |
141 | 141 | ||
142 | /** | ||
143 | * Iterate over the paths to a peer without direct link. | ||
144 | * | ||
145 | * @param cp Peer to get path info. | ||
146 | * @param callback Function to call for every path. | ||
147 | * @param callback_cls Closure for @a callback. | ||
148 | * @return Number of iterated paths. | ||
149 | */ | ||
150 | unsigned int | ||
151 | GCP_iterate_indirect_paths (struct CadetPeer *cp, | ||
152 | GCP_PathIterator callback, | ||
153 | void *callback_cls); | ||
154 | |||
142 | 155 | ||
143 | /** | 156 | /** |
144 | * Iterate over the paths to @a peer where | 157 | * Iterate over the paths to @a peer where |
diff --git a/src/consensus/gnunet-service-consensus.c b/src/consensus/gnunet-service-consensus.c index 86d056aaf..afbefdc5a 100644 --- a/src/consensus/gnunet-service-consensus.c +++ b/src/consensus/gnunet-service-consensus.c | |||
@@ -2821,7 +2821,7 @@ construct_task_graph_gradecast (struct ConsensusSession *session, | |||
2821 | } | 2821 | } |
2822 | /* We run this task to make sure that the leader | 2822 | /* We run this task to make sure that the leader |
2823 | has the stored the SET_KIND_LEADER set of himself, | 2823 | has the stored the SET_KIND_LEADER set of himself, |
2824 | so he can participate in the rest of the gradecast | 2824 | so it can participate in the rest of the gradecast |
2825 | without the code having to handle any special cases. */ | 2825 | without the code having to handle any special cases. */ |
2826 | task = ((struct TaskEntry) { | 2826 | task = ((struct TaskEntry) { |
2827 | .step = step, | 2827 | .step = step, |
diff --git a/src/conversation/gnunet-conversation.c b/src/conversation/gnunet-conversation.c index 92a435d55..bb4946720 100644 --- a/src/conversation/gnunet-conversation.c +++ b/src/conversation/gnunet-conversation.c | |||
@@ -264,6 +264,13 @@ phone_event_handler (void *cls, | |||
264 | switch (code) | 264 | switch (code) |
265 | { | 265 | { |
266 | case GNUNET_CONVERSATION_EC_PHONE_RING: | 266 | case GNUNET_CONVERSATION_EC_PHONE_RING: |
267 | /* | ||
268 | * FIXME: we should be playing our ringtones from contrib/sounds now! | ||
269 | * | ||
270 | ring_my_bell(); | ||
271 | * | ||
272 | * see https://gstreamer.freedesktop.org/documentation/application-development/highlevel/playback-components.html on how to play a wav using the gst framework being used here | ||
273 | */ | ||
267 | FPRINTF (stdout, | 274 | FPRINTF (stdout, |
268 | _("Incoming call from `%s'. Please /accept %u or /cancel %u the call.\n"), | 275 | _("Incoming call from `%s'. Please /accept %u or /cancel %u the call.\n"), |
269 | GNUNET_GNSRECORD_pkey_to_zkey (caller_id), | 276 | GNUNET_GNSRECORD_pkey_to_zkey (caller_id), |
@@ -717,7 +724,7 @@ do_status (const char *args) | |||
717 | break; | 724 | break; |
718 | case CS_RINGING: | 725 | case CS_RINGING: |
719 | FPRINTF (stdout, | 726 | FPRINTF (stdout, |
720 | _("We are calling `%s', his phone should be ringing.\n"), | 727 | _("We are calling `%s', their phone should be ringing.\n"), |
721 | peer_name); | 728 | peer_name); |
722 | break; | 729 | break; |
723 | case CS_CONNECTED: | 730 | case CS_CONNECTED: |
diff --git a/src/core/core.h b/src/core/core.h index a2c05d4af..2ce77244e 100644 --- a/src/core/core.h +++ b/src/core/core.h | |||
@@ -172,7 +172,7 @@ struct DisconnectNotifyMessage | |||
172 | * messages being received or transmitted. This overall message is | 172 | * messages being received or transmitted. This overall message is |
173 | * followed by the real message, or just the header of the real | 173 | * followed by the real message, or just the header of the real |
174 | * message (depending on the client's preferences). The receiver can | 174 | * message (depending on the client's preferences). The receiver can |
175 | * tell if he got the full message or only a partial message by | 175 | * tell if it got the full message or only a partial message by |
176 | * looking at the size field in the header of NotifyTrafficMessage and | 176 | * looking at the size field in the header of NotifyTrafficMessage and |
177 | * checking it with the size field in the message that follows. | 177 | * checking it with the size field in the message that follows. |
178 | */ | 178 | */ |
diff --git a/src/core/gnunet-service-core.c b/src/core/gnunet-service-core.c index 0afc75add..a033f9fac 100644 --- a/src/core/gnunet-service-core.c +++ b/src/core/gnunet-service-core.c | |||
@@ -230,7 +230,7 @@ handle_client_init (void *cls, | |||
230 | /** | 230 | /** |
231 | * We will never be ready to transmit the given message in (disconnect | 231 | * We will never be ready to transmit the given message in (disconnect |
232 | * or invalid request). Frees resources associated with @a car. We | 232 | * or invalid request). Frees resources associated with @a car. We |
233 | * don't explicitly tell the client, he'll learn with the disconnect | 233 | * don't explicitly tell the client, it'll learn with the disconnect |
234 | * (or violated the protocol). | 234 | * (or violated the protocol). |
235 | * | 235 | * |
236 | * @param car request that now permanently failed; the | 236 | * @param car request that now permanently failed; the |
diff --git a/src/core/gnunet-service-core.h b/src/core/gnunet-service-core.h index 81e73ec39..fd1a88e75 100644 --- a/src/core/gnunet-service-core.h +++ b/src/core/gnunet-service-core.h | |||
@@ -113,7 +113,7 @@ GSC_CLIENTS_solicit_request (struct GSC_ClientActiveRequest *car); | |||
113 | /** | 113 | /** |
114 | * We will never be ready to transmit the given message in (disconnect | 114 | * We will never be ready to transmit the given message in (disconnect |
115 | * or invalid request). Frees resources associated with @a car. We | 115 | * or invalid request). Frees resources associated with @a car. We |
116 | * don't explicitly tell the client, he'll learn with the disconnect | 116 | * don't explicitly tell the client, it'll learn with the disconnect |
117 | * (or violated the protocol). | 117 | * (or violated the protocol). |
118 | * | 118 | * |
119 | * @param car request that now permanently failed; the | 119 | * @param car request that now permanently failed; the |
diff --git a/src/core/gnunet-service-core_kx.c b/src/core/gnunet-service-core_kx.c index 6e713cf61..c017e0c23 100644 --- a/src/core/gnunet-service-core_kx.c +++ b/src/core/gnunet-service-core_kx.c | |||
@@ -123,7 +123,7 @@ struct EphemeralKeyMessage | |||
123 | 123 | ||
124 | 124 | ||
125 | /** | 125 | /** |
126 | * We're sending an (encrypted) PING to the other peer to check if he | 126 | * We're sending an (encrypted) PING to the other peer to check if it |
127 | * can decrypt. The other peer should respond with a PONG with the | 127 | * can decrypt. The other peer should respond with a PONG with the |
128 | * same content, except this time encrypted with the receiver's key. | 128 | * same content, except this time encrypted with the receiver's key. |
129 | */ | 129 | */ |
@@ -854,8 +854,8 @@ handle_transport_notify_connect (void *cls, | |||
854 | } | 854 | } |
855 | else | 855 | else |
856 | { | 856 | { |
857 | /* peer with "higher" identity starts a delayed KX, if the "lower" peer | 857 | /* peer with "higher" identity starts a delayed KX, if the "lower" peer |
858 | * does not start a KX since he sees no reasons to do so */ | 858 | * does not start a KX since it sees no reasons to do so */ |
859 | kx->retry_set_key_task | 859 | kx->retry_set_key_task |
860 | = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, | 860 | = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, |
861 | &set_key_retry_task, | 861 | &set_key_retry_task, |
diff --git a/src/core/gnunet-service-core_sessions.c b/src/core/gnunet-service-core_sessions.c index 41fe4dfb7..16f9a092d 100644 --- a/src/core/gnunet-service-core_sessions.c +++ b/src/core/gnunet-service-core_sessions.c | |||
@@ -356,7 +356,7 @@ GSC_SESSIONS_create (const struct GNUNET_PeerIdentity *peer, | |||
356 | 356 | ||
357 | 357 | ||
358 | /** | 358 | /** |
359 | * The other peer has indicated that he 'lost' the session | 359 | * The other peer has indicated that it 'lost' the session |
360 | * (KX down), reinitialize the session on our end, in particular | 360 | * (KX down), reinitialize the session on our end, in particular |
361 | * this means to restart the typemap transmission. | 361 | * this means to restart the typemap transmission. |
362 | * | 362 | * |
diff --git a/src/core/gnunet-service-core_sessions.h b/src/core/gnunet-service-core_sessions.h index 845edac69..be862b71f 100644 --- a/src/core/gnunet-service-core_sessions.h +++ b/src/core/gnunet-service-core_sessions.h | |||
@@ -40,7 +40,7 @@ GSC_SESSIONS_create (const struct GNUNET_PeerIdentity *peer, | |||
40 | 40 | ||
41 | 41 | ||
42 | /** | 42 | /** |
43 | * The other peer has indicated that he 'lost' the session | 43 | * The other peer has indicated that it 'lost' the session |
44 | * (KX down), reinitialize the session on our end, in particular | 44 | * (KX down), reinitialize the session on our end, in particular |
45 | * this means to restart the typemap transmission. | 45 | * this means to restart the typemap transmission. |
46 | * | 46 | * |
diff --git a/src/core/test_core_api_data.conf b/src/core/test_core_api_data.conf index a13cc8706..420849ba9 100644 --- a/src/core/test_core_api_data.conf +++ b/src/core/test_core_api_data.conf | |||
@@ -6,6 +6,6 @@ WAN_QUOTA_IN = 64 kiB | |||
6 | WAN_QUOTA_OUT = 64 kiB | 6 | WAN_QUOTA_OUT = 64 kiB |
7 | 7 | ||
8 | [core] | 8 | [core] |
9 | PORT = 2092 | 9 | PORT = 52092 |
10 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-core.sock | 10 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-core.sock |
11 | 11 | ||
diff --git a/src/core/test_core_api_send_to_self.conf b/src/core/test_core_api_send_to_self.conf index ad6d4dc60..c2a459bb9 100644 --- a/src/core/test_core_api_send_to_self.conf +++ b/src/core/test_core_api_send_to_self.conf | |||
@@ -8,7 +8,7 @@ WAN_QUOTA_OUT = 104757600 | |||
8 | 8 | ||
9 | [test-sts] | 9 | [test-sts] |
10 | IMMEDIATE_START = YES | 10 | IMMEDIATE_START = YES |
11 | PORT = 9252 | 11 | PORT = 59252 |
12 | HOSTNAME = localhost | 12 | HOSTNAME = localhost |
13 | BINARY = test_core_api_send_to_self | 13 | BINARY = test_core_api_send_to_self |
14 | ACCEPT_FROM = 127.0.0.1; | 14 | ACCEPT_FROM = 127.0.0.1; |
diff --git a/src/datastore/perf_datastore_api.c b/src/datastore/perf_datastore_api.c index f659dedff..6a0ff231b 100644 --- a/src/datastore/perf_datastore_api.c +++ b/src/datastore/perf_datastore_api.c | |||
@@ -172,7 +172,7 @@ struct CpsRunContext | |||
172 | 172 | ||
173 | /** | 173 | /** |
174 | * Counts the number of items put in the current phase. | 174 | * Counts the number of items put in the current phase. |
175 | * Once it hits #PUT_10, we progress tot he #RP_CUT phase | 175 | * Once it hits #PUT_10, we progress to the #RP_CUT phase |
176 | * or are done if @e i reaches #ITERATIONS. | 176 | * or are done if @e i reaches #ITERATIONS. |
177 | */ | 177 | */ |
178 | unsigned int j; | 178 | unsigned int j; |
diff --git a/src/datastore/plugin_datastore_mysql.c b/src/datastore/plugin_datastore_mysql.c index b09fd1af3..3568ebe8f 100644 --- a/src/datastore/plugin_datastore_mysql.c +++ b/src/datastore/plugin_datastore_mysql.c | |||
@@ -76,7 +76,7 @@ | |||
76 | * a safe partition etc. The $HOME/.my.cnf can of course be a symbolic | 76 | * a safe partition etc. The $HOME/.my.cnf can of course be a symbolic |
77 | * link. Even greater security risk can be achieved by setting no | 77 | * link. Even greater security risk can be achieved by setting no |
78 | * password for $USER. Luckily $USER has only priviledges to mess | 78 | * password for $USER. Luckily $USER has only priviledges to mess |
79 | * up GNUnet's tables, nothing else (unless you give him more, | 79 | * up GNUnet's tables, nothing else (unless you give them more, |
80 | * of course).<p> | 80 | * of course).<p> |
81 | * | 81 | * |
82 | * 4) Still, perhaps you should briefly try if the DB connection | 82 | * 4) Still, perhaps you should briefly try if the DB connection |
diff --git a/src/dht/gnunet_dht_profiler.c b/src/dht/gnunet_dht_profiler.c index 75ca2a3aa..a729d1b01 100644 --- a/src/dht/gnunet_dht_profiler.c +++ b/src/dht/gnunet_dht_profiler.c | |||
@@ -346,7 +346,7 @@ bandwidth_stats_cont (void *cls, | |||
346 | (unsigned long long) incoming_bandwidth); | 346 | (unsigned long long) incoming_bandwidth); |
347 | fprintf (stderr, | 347 | fprintf (stderr, |
348 | "Benchmark done. Collect data via gnunet-statistics, then press ENTER to exit.\n"); | 348 | "Benchmark done. Collect data via gnunet-statistics, then press ENTER to exit.\n"); |
349 | getchar (); | 349 | (void) getchar (); |
350 | GNUNET_SCHEDULER_shutdown (); | 350 | GNUNET_SCHEDULER_shutdown (); |
351 | } | 351 | } |
352 | 352 | ||
@@ -752,7 +752,7 @@ dht_disconnect (void *cls, | |||
752 | switch (mode) | 752 | switch (mode) |
753 | { | 753 | { |
754 | case MODE_PUT: | 754 | case MODE_PUT: |
755 | if (n_puts_ok != n_active * num_puts_per_peer) | 755 | if (n_puts_ok != ((unsigned long long) n_active) * num_puts_per_peer) |
756 | return; | 756 | return; |
757 | /* Start GETs if all PUTs have been made */ | 757 | /* Start GETs if all PUTs have been made */ |
758 | mode = MODE_GET; | 758 | mode = MODE_GET; |
diff --git a/src/dns/Makefile.am b/src/dns/Makefile.am index 9a4ecdcfd..ca2685765 100644 --- a/src/dns/Makefile.am +++ b/src/dns/Makefile.am | |||
@@ -27,8 +27,6 @@ install-exec-hook: | |||
27 | endif | 27 | endif |
28 | 28 | ||
29 | lib_LTLIBRARIES = \ | 29 | lib_LTLIBRARIES = \ |
30 | libgnunetdnsparser.la \ | ||
31 | libgnunetdnsstub.la \ | ||
32 | libgnunetdns.la | 30 | libgnunetdns.la |
33 | 31 | ||
34 | libexec_PROGRAMS = \ | 32 | libexec_PROGRAMS = \ |
@@ -47,9 +45,6 @@ check_SCRIPTS = \ | |||
47 | test_gnunet_dns.sh | 45 | test_gnunet_dns.sh |
48 | endif | 46 | endif |
49 | 47 | ||
50 | check_PROGRAMS = \ | ||
51 | test_hexcoder | ||
52 | |||
53 | gnunet_helper_dns_SOURCES = \ | 48 | gnunet_helper_dns_SOURCES = \ |
54 | gnunet-helper-dns.c | 49 | gnunet-helper-dns.c |
55 | 50 | ||
@@ -57,7 +52,6 @@ gnunet_helper_dns_SOURCES = \ | |||
57 | gnunet_dns_monitor_SOURCES = \ | 52 | gnunet_dns_monitor_SOURCES = \ |
58 | gnunet-dns-monitor.c | 53 | gnunet-dns-monitor.c |
59 | gnunet_dns_monitor_LDADD = \ | 54 | gnunet_dns_monitor_LDADD = \ |
60 | libgnunetdnsparser.la \ | ||
61 | libgnunetdns.la \ | 55 | libgnunetdns.la \ |
62 | $(top_builddir)/src/util/libgnunetutil.la \ | 56 | $(top_builddir)/src/util/libgnunetutil.la \ |
63 | $(GN_LIBINTL) | 57 | $(GN_LIBINTL) |
@@ -65,15 +59,12 @@ gnunet_dns_monitor_LDADD = \ | |||
65 | gnunet_zonewalk_SOURCES = \ | 59 | gnunet_zonewalk_SOURCES = \ |
66 | gnunet-zonewalk.c | 60 | gnunet-zonewalk.c |
67 | gnunet_zonewalk_LDADD = \ | 61 | gnunet_zonewalk_LDADD = \ |
68 | libgnunetdnsparser.la \ | ||
69 | libgnunetdnsstub.la \ | ||
70 | $(top_builddir)/src/util/libgnunetutil.la \ | 62 | $(top_builddir)/src/util/libgnunetutil.la \ |
71 | $(GN_LIBINTL) | 63 | $(GN_LIBINTL) |
72 | 64 | ||
73 | gnunet_dns_redirector_SOURCES = \ | 65 | gnunet_dns_redirector_SOURCES = \ |
74 | gnunet-dns-redirector.c | 66 | gnunet-dns-redirector.c |
75 | gnunet_dns_redirector_LDADD = \ | 67 | gnunet_dns_redirector_LDADD = \ |
76 | libgnunetdnsparser.la \ | ||
77 | libgnunetdns.la \ | 68 | libgnunetdns.la \ |
78 | $(top_builddir)/src/util/libgnunetutil.la \ | 69 | $(top_builddir)/src/util/libgnunetutil.la \ |
79 | $(GN_LIBINTL) | 70 | $(GN_LIBINTL) |
@@ -81,30 +72,10 @@ gnunet_dns_redirector_LDADD = \ | |||
81 | gnunet_service_dns_SOURCES = \ | 72 | gnunet_service_dns_SOURCES = \ |
82 | gnunet-service-dns.c | 73 | gnunet-service-dns.c |
83 | gnunet_service_dns_LDADD = \ | 74 | gnunet_service_dns_LDADD = \ |
84 | libgnunetdnsstub.la \ | ||
85 | $(top_builddir)/src/tun/libgnunettun.la \ | ||
86 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ | 75 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ |
87 | $(top_builddir)/src/util/libgnunetutil.la \ | 76 | $(top_builddir)/src/util/libgnunetutil.la \ |
88 | $(GN_LIBINTL) | 77 | $(GN_LIBINTL) |
89 | 78 | ||
90 | libgnunetdnsparser_la_SOURCES = \ | ||
91 | dnsparser.c | ||
92 | libgnunetdnsparser_la_LIBADD = \ | ||
93 | $(top_builddir)/src/util/libgnunetutil.la $(XLIB) \ | ||
94 | -lidn | ||
95 | libgnunetdnsparser_la_LDFLAGS = \ | ||
96 | $(GN_LIB_LDFLAGS) \ | ||
97 | -version-info 1:0:1 | ||
98 | |||
99 | libgnunetdnsstub_la_SOURCES = \ | ||
100 | dnsstub.c | ||
101 | libgnunetdnsstub_la_LIBADD = \ | ||
102 | $(top_builddir)/src/tun/libgnunettun.la \ | ||
103 | $(top_builddir)/src/util/libgnunetutil.la $(XLIB) | ||
104 | libgnunetdnsstub_la_LDFLAGS = \ | ||
105 | $(GN_LIB_LDFLAGS) \ | ||
106 | -version-info 0:0:0 | ||
107 | |||
108 | libgnunetdns_la_SOURCES = \ | 79 | libgnunetdns_la_SOURCES = \ |
109 | dns_api.c dns.h | 80 | dns_api.c dns.h |
110 | libgnunetdns_la_LIBADD = \ | 81 | libgnunetdns_la_LIBADD = \ |
@@ -131,8 +102,3 @@ EXTRA_DIST = \ | |||
131 | $(check_SCRIPTS) | 102 | $(check_SCRIPTS) |
132 | 103 | ||
133 | 104 | ||
134 | test_hexcoder_SOURCES = \ | ||
135 | test_hexcoder.c | ||
136 | test_hexcoder_LDADD = \ | ||
137 | libgnunetdnsparser.la \ | ||
138 | $(top_builddir)/src/util/libgnunetutil.la | ||
diff --git a/src/dns/gnunet-zonewalk.c b/src/dns/gnunet-zonewalk.c index c43ad1aeb..b96d40ca7 100644 --- a/src/dns/gnunet-zonewalk.c +++ b/src/dns/gnunet-zonewalk.c | |||
@@ -494,6 +494,7 @@ queue (const char *hostname) | |||
494 | struct Request *req; | 494 | struct Request *req; |
495 | char *raw; | 495 | char *raw; |
496 | size_t raw_size; | 496 | size_t raw_size; |
497 | int ret; | ||
497 | 498 | ||
498 | if (GNUNET_OK != | 499 | if (GNUNET_OK != |
499 | GNUNET_DNSPARSER_check_name (hostname)) | 500 | GNUNET_DNSPARSER_check_name (hostname)) |
@@ -514,13 +515,14 @@ queue (const char *hostname) | |||
514 | p.queries = &q; | 515 | p.queries = &q; |
515 | p.id = (uint16_t) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, | 516 | p.id = (uint16_t) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, |
516 | UINT16_MAX); | 517 | UINT16_MAX); |
517 | 518 | ret = GNUNET_DNSPARSER_pack (&p, | |
518 | if (GNUNET_OK != | 519 | UINT16_MAX, |
519 | GNUNET_DNSPARSER_pack (&p, | 520 | &raw, |
520 | UINT16_MAX, | 521 | &raw_size); |
521 | &raw, | 522 | if (GNUNET_OK != ret) |
522 | &raw_size)) | ||
523 | { | 523 | { |
524 | if (GNUNET_NO == ret) | ||
525 | GNUNET_free (raw); | ||
524 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 526 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
525 | "Failed to pack query for hostname `%s'\n", | 527 | "Failed to pack query for hostname `%s'\n", |
526 | hostname); | 528 | hostname); |
diff --git a/src/dv/test_transport_blacklist_data.conf b/src/dv/test_transport_blacklist_data.conf index 534a61849..ea55a196b 100644 --- a/src/dv/test_transport_blacklist_data.conf +++ b/src/dv/test_transport_blacklist_data.conf | |||
@@ -1,5 +1,5 @@ | |||
1 | @INLINE@ template_dv.conf | 1 | @INLINE@ template_dv.conf |
2 | 2 | ||
3 | [transport] | 3 | [transport] |
4 | PORT = 2565 | 4 | PORT = 52565 |
5 | PLUGINS = tcp | 5 | PLUGINS = tcp |
diff --git a/src/dv/test_transport_dv_data.conf b/src/dv/test_transport_dv_data.conf index 307921ac4..a21fba8a7 100644 --- a/src/dv/test_transport_dv_data.conf +++ b/src/dv/test_transport_dv_data.conf | |||
@@ -1,7 +1,7 @@ | |||
1 | @INLINE@ template_dv.conf | 1 | @INLINE@ template_dv.conf |
2 | 2 | ||
3 | [transport] | 3 | [transport] |
4 | PORT = 2565 | 4 | PORT = 52565 |
5 | PLUGINS = tcp dv | 5 | PLUGINS = tcp dv |
6 | #PREFIX = valgrind --leak-check=full --track-fds=yes --leak-resolution=high | 6 | #PREFIX = valgrind --leak-check=full --track-fds=yes --leak-resolution=high |
7 | 7 | ||
diff --git a/src/exit/Makefile.am b/src/exit/Makefile.am index aa1210269..ea4f08c73 100644 --- a/src/exit/Makefile.am +++ b/src/exit/Makefile.am | |||
@@ -49,10 +49,8 @@ endif | |||
49 | gnunet_daemon_exit_SOURCES = \ | 49 | gnunet_daemon_exit_SOURCES = \ |
50 | gnunet-daemon-exit.c exit.h | 50 | gnunet-daemon-exit.c exit.h |
51 | gnunet_daemon_exit_LDADD = \ | 51 | gnunet_daemon_exit_LDADD = \ |
52 | $(top_builddir)/src/dns/libgnunetdnsstub.la \ | ||
53 | $(top_builddir)/src/dht/libgnunetdht.la \ | 52 | $(top_builddir)/src/dht/libgnunetdht.la \ |
54 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ | 53 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ |
55 | $(top_builddir)/src/tun/libgnunettun.la \ | ||
56 | $(top_builddir)/src/util/libgnunetutil.la \ | 54 | $(top_builddir)/src/util/libgnunetutil.la \ |
57 | $(top_builddir)/src/cadet/libgnunetcadet.la \ | 55 | $(top_builddir)/src/cadet/libgnunetcadet.la \ |
58 | $(top_builddir)/src/regex/libgnunetregex.la \ | 56 | $(top_builddir)/src/regex/libgnunetregex.la \ |
diff --git a/src/fs/gnunet-service-fs_cp.h b/src/fs/gnunet-service-fs_cp.h index 5e98f4940..dc7e03f4a 100644 --- a/src/fs/gnunet-service-fs_cp.h +++ b/src/fs/gnunet-service-fs_cp.h | |||
@@ -84,7 +84,7 @@ struct GSF_PeerPerformanceData | |||
84 | 84 | ||
85 | /** | 85 | /** |
86 | * If we get content we already have from this peer, for how | 86 | * If we get content we already have from this peer, for how |
87 | * long do we block him? Adjusted based on the fraction of | 87 | * long do we block it? Adjusted based on the fraction of |
88 | * redundant data we receive, between 1s and 1h. | 88 | * redundant data we receive, between 1s and 1h. |
89 | */ | 89 | */ |
90 | struct GNUNET_TIME_Relative migration_delay; | 90 | struct GNUNET_TIME_Relative migration_delay; |
diff --git a/src/fs/test_fs_defaults.conf b/src/fs/test_fs_defaults.conf index 42661b25d..6ead78257 100644 --- a/src/fs/test_fs_defaults.conf +++ b/src/fs/test_fs_defaults.conf | |||
@@ -21,7 +21,7 @@ QUOTA = 100 MB | |||
21 | 21 | ||
22 | [transport-tcp] | 22 | [transport-tcp] |
23 | BINDTO = 127.0.0.1 | 23 | BINDTO = 127.0.0.1 |
24 | PORT = 4368 | 24 | PORT = 54368 |
25 | 25 | ||
26 | [peerinfo] | 26 | [peerinfo] |
27 | NO_IO = YES | 27 | NO_IO = YES |
diff --git a/src/gns/Makefile.am b/src/gns/Makefile.am index 46642113f..2c7bb8ebb 100644 --- a/src/gns/Makefile.am +++ b/src/gns/Makefile.am | |||
@@ -102,7 +102,6 @@ libgnunet_plugin_gnsrecord_gns_la_SOURCES = \ | |||
102 | plugin_gnsrecord_gns.c | 102 | plugin_gnsrecord_gns.c |
103 | libgnunet_plugin_gnsrecord_gns_la_LIBADD = \ | 103 | libgnunet_plugin_gnsrecord_gns_la_LIBADD = \ |
104 | $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ | 104 | $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ |
105 | $(top_builddir)/src/dns/libgnunetdnsparser.la \ | ||
106 | $(top_builddir)/src/util/libgnunetutil.la \ | 105 | $(top_builddir)/src/util/libgnunetutil.la \ |
107 | $(LTLIBINTL) | 106 | $(LTLIBINTL) |
108 | libgnunet_plugin_gnsrecord_gns_la_LDFLAGS = \ | 107 | libgnunet_plugin_gnsrecord_gns_la_LDFLAGS = \ |
@@ -140,8 +139,6 @@ gnunet_dns2gns_LDADD = \ | |||
140 | libgnunetgns.la \ | 139 | libgnunetgns.la \ |
141 | $(top_builddir)/src/util/libgnunetutil.la \ | 140 | $(top_builddir)/src/util/libgnunetutil.la \ |
142 | $(top_builddir)/src/identity/libgnunetidentity.la \ | 141 | $(top_builddir)/src/identity/libgnunetidentity.la \ |
143 | $(top_builddir)/src/dns/libgnunetdnsparser.la \ | ||
144 | $(top_builddir)/src/dns/libgnunetdnsstub.la \ | ||
145 | $(GN_LIBINTL) | 142 | $(GN_LIBINTL) |
146 | 143 | ||
147 | if LINUX | 144 | if LINUX |
@@ -206,10 +203,7 @@ gnunet_service_gns_LDADD = \ | |||
206 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ | 203 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ |
207 | $(top_builddir)/src/util/libgnunetutil.la \ | 204 | $(top_builddir)/src/util/libgnunetutil.la \ |
208 | $(top_builddir)/src/dns/libgnunetdns.la \ | 205 | $(top_builddir)/src/dns/libgnunetdns.la \ |
209 | $(top_builddir)/src/dns/libgnunetdnsparser.la \ | ||
210 | $(top_builddir)/src/dns/libgnunetdnsstub.la \ | ||
211 | $(top_builddir)/src/dht/libgnunetdht.la \ | 206 | $(top_builddir)/src/dht/libgnunetdht.la \ |
212 | $(top_builddir)/src/tun/libgnunettun.la \ | ||
213 | $(top_builddir)/src/namecache/libgnunetnamecache.la \ | 207 | $(top_builddir)/src/namecache/libgnunetnamecache.la \ |
214 | $(USE_VPN) \ | 208 | $(USE_VPN) \ |
215 | $(GN_LIBINTL) | 209 | $(GN_LIBINTL) |
diff --git a/src/gns/gns_api.c b/src/gns/gns_api.c index 0ec9209da..3b658da92 100644 --- a/src/gns/gns_api.c +++ b/src/gns/gns_api.c | |||
@@ -11,7 +11,7 @@ | |||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | */ | 17 | */ |
@@ -232,7 +232,6 @@ reconnect (struct GNUNET_GNS_Handle *handle) | |||
232 | handle), | 232 | handle), |
233 | GNUNET_MQ_handler_end () | 233 | GNUNET_MQ_handler_end () |
234 | }; | 234 | }; |
235 | struct GNUNET_GNS_LookupRequest *lh; | ||
236 | 235 | ||
237 | GNUNET_assert (NULL == handle->mq); | 236 | GNUNET_assert (NULL == handle->mq); |
238 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 237 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
@@ -244,7 +243,9 @@ reconnect (struct GNUNET_GNS_Handle *handle) | |||
244 | handle); | 243 | handle); |
245 | if (NULL == handle->mq) | 244 | if (NULL == handle->mq) |
246 | return; | 245 | return; |
247 | for (lh = handle->lookup_head; NULL != lh; lh = lh->next) | 246 | for (struct GNUNET_GNS_LookupRequest *lh = handle->lookup_head; |
247 | NULL != lh; | ||
248 | lh = lh->next) | ||
248 | GNUNET_MQ_send_copy (handle->mq, | 249 | GNUNET_MQ_send_copy (handle->mq, |
249 | lh->env); | 250 | lh->env); |
250 | } | 251 | } |
diff --git a/src/gns/gnunet-bcd.c b/src/gns/gnunet-bcd.c index 5279e83a4..9737e1a49 100644 --- a/src/gns/gnunet-bcd.c +++ b/src/gns/gnunet-bcd.c | |||
@@ -469,7 +469,7 @@ run (void *cls, | |||
469 | "open", | 469 | "open", |
470 | fn); | 470 | fn); |
471 | GNUNET_free (fn); | 471 | GNUNET_free (fn); |
472 | CLOSE (fd); | 472 | GNUNET_break (0 == CLOSE (fd)); |
473 | return; | 473 | return; |
474 | } | 474 | } |
475 | GNUNET_free (fn); | 475 | GNUNET_free (fn); |
@@ -499,6 +499,7 @@ run (void *cls, | |||
499 | return; | 499 | return; |
500 | GNUNET_SCHEDULER_add_shutdown (&server_stop, | 500 | GNUNET_SCHEDULER_add_shutdown (&server_stop, |
501 | NULL); | 501 | NULL); |
502 | GNUNET_break (0 == CLOSE(fd)); | ||
502 | } | 503 | } |
503 | 504 | ||
504 | 505 | ||
diff --git a/src/gns/gnunet-dns2gns.c b/src/gns/gnunet-dns2gns.c index e6e53d405..8d39e8c53 100644 --- a/src/gns/gnunet-dns2gns.c +++ b/src/gns/gnunet-dns2gns.c | |||
@@ -269,6 +269,7 @@ dns_result_processor (void *cls, | |||
269 | } | 269 | } |
270 | request->packet = GNUNET_DNSPARSER_parse ((char*)dns, | 270 | request->packet = GNUNET_DNSPARSER_parse ((char*)dns, |
271 | r); | 271 | r); |
272 | GNUNET_DNSSTUB_resolve_cancel (request->dns_lookup); | ||
272 | send_response (request); | 273 | send_response (request); |
273 | } | 274 | } |
274 | 275 | ||
diff --git a/src/gns/gnunet-gns.c b/src/gns/gnunet-gns.c index 149c8a7bb..463348ed3 100644 --- a/src/gns/gnunet-gns.c +++ b/src/gns/gnunet-gns.c | |||
@@ -11,7 +11,7 @@ | |||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | */ | 17 | */ |
@@ -65,8 +65,9 @@ static struct GNUNET_GNS_LookupWithTldRequest *lr; | |||
65 | /** | 65 | /** |
66 | * Global return value. | 66 | * Global return value. |
67 | * 0 on success (default), | 67 | * 0 on success (default), |
68 | * 1 on internal failures, 2 on launch failure, | 68 | * 1 on internal failures |
69 | * 3 if the name is not a GNS-supported TLD, | 69 | * 2 on launch failure, |
70 | * 4 if the name is not a GNS-supported TLD, | ||
70 | */ | 71 | */ |
71 | static int global_ret; | 72 | static int global_ret; |
72 | 73 | ||
@@ -114,7 +115,7 @@ process_lookup_result (void *cls, | |||
114 | lr = NULL; | 115 | lr = NULL; |
115 | if (GNUNET_NO == was_gns) | 116 | if (GNUNET_NO == was_gns) |
116 | { | 117 | { |
117 | global_ret = 3; | 118 | global_ret = 4; /* not for GNS */ |
118 | GNUNET_SCHEDULER_shutdown (); | 119 | GNUNET_SCHEDULER_shutdown (); |
119 | return; | 120 | return; |
120 | } | 121 | } |
@@ -183,7 +184,6 @@ run (void *cls, | |||
183 | global_ret = 2; | 184 | global_ret = 2; |
184 | return; | 185 | return; |
185 | } | 186 | } |
186 | |||
187 | GNUNET_SCHEDULER_add_shutdown (&do_shutdown, | 187 | GNUNET_SCHEDULER_add_shutdown (&do_shutdown, |
188 | NULL); | 188 | NULL); |
189 | 189 | ||
diff --git a/src/gns/nss/nss_gns.c b/src/gns/nss/nss_gns.c index 03ac6e09c..58aab47fd 100644 --- a/src/gns/nss/nss_gns.c +++ b/src/gns/nss/nss_gns.c | |||
@@ -54,121 +54,126 @@ | |||
54 | * @return a nss_status code | 54 | * @return a nss_status code |
55 | */ | 55 | */ |
56 | enum nss_status | 56 | enum nss_status |
57 | _nss_gns_gethostbyname2_r( | 57 | _nss_gns_gethostbyname2_r(const char *name, |
58 | const char *name, | 58 | int af, |
59 | int af, | 59 | struct hostent *result, |
60 | struct hostent * result, | 60 | char *buffer, |
61 | char *buffer, | 61 | size_t buflen, |
62 | size_t buflen, | 62 | int *errnop, |
63 | int *errnop, | 63 | int *h_errnop) |
64 | int *h_errnop) { | 64 | { |
65 | 65 | struct userdata u; | |
66 | struct userdata u; | 66 | enum nss_status status = NSS_STATUS_UNAVAIL; |
67 | enum nss_status status = NSS_STATUS_UNAVAIL; | 67 | int i; |
68 | int i; | 68 | size_t address_length; |
69 | size_t address_length, l, idx, astart; | 69 | size_t l; |
70 | 70 | size_t idx; | |
71 | if (af == AF_UNSPEC) | 71 | size_t astart; |
72 | |||
73 | if (af == AF_UNSPEC) | ||
72 | #ifdef NSS_IPV6_ONLY | 74 | #ifdef NSS_IPV6_ONLY |
73 | af = AF_INET6; | 75 | af = AF_INET6; |
74 | #else | 76 | #else |
75 | af = AF_INET; | 77 | af = AF_INET; |
76 | #endif | 78 | #endif |
77 | 79 | ||
78 | #ifdef NSS_IPV4_ONLY | 80 | #ifdef NSS_IPV4_ONLY |
79 | if (af != AF_INET) | 81 | if (af != AF_INET) |
80 | #elif NSS_IPV6_ONLY | 82 | #elif NSS_IPV6_ONLY |
81 | if (af != AF_INET6) | 83 | if (af != AF_INET6) |
82 | #else | 84 | #else |
83 | if (af != AF_INET && af != AF_INET6) | 85 | if ( (af != AF_INET) && |
86 | (af != AF_INET6) ) | ||
84 | #endif | 87 | #endif |
85 | { | 88 | { |
86 | *errnop = EINVAL; | 89 | *errnop = EINVAL; |
87 | *h_errnop = NO_RECOVERY; | 90 | *h_errnop = NO_RECOVERY; |
88 | 91 | ||
89 | goto finish; | 92 | goto finish; |
90 | } | 93 | } |
91 | |||
92 | address_length = af == AF_INET ? sizeof(ipv4_address_t) : sizeof(ipv6_address_t); | ||
93 | if (buflen < | ||
94 | sizeof(char*)+ /* alias names */ | ||
95 | strlen(name)+1) { /* official name */ | ||
96 | |||
97 | *errnop = ERANGE; | ||
98 | *h_errnop = NO_RECOVERY; | ||
99 | status = NSS_STATUS_TRYAGAIN; | ||
100 | |||
101 | goto finish; | ||
102 | } | ||
103 | |||
104 | u.count = 0; | ||
105 | u.data_len = 0; | ||
106 | |||
107 | i = gns_resolve_name(af, name, &u); | ||
108 | if (-3 == i) | ||
109 | { | ||
110 | status = NSS_STATUS_NOTFOUND; | ||
111 | goto finish; | ||
112 | } | ||
113 | if (-2 == i) | ||
114 | { | ||
115 | status = NSS_STATUS_UNAVAIL; | ||
116 | goto finish; | ||
117 | } | ||
118 | if ( (-1 == i) || | ||
119 | (u.count == 0) ) | ||
120 | { | ||
121 | *errnop = ETIMEDOUT; | ||
122 | *h_errnop = HOST_NOT_FOUND; | ||
123 | status = NSS_STATUS_NOTFOUND; | ||
124 | goto finish; | ||
125 | } | ||
126 | |||
127 | |||
128 | /* Alias names */ | ||
129 | *((char**) buffer) = NULL; | ||
130 | result->h_aliases = (char**) buffer; | ||
131 | idx = sizeof(char*); | ||
132 | |||
133 | /* Official name */ | ||
134 | strcpy(buffer+idx, name); | ||
135 | result->h_name = buffer+idx; | ||
136 | idx += strlen(name)+1; | ||
137 | |||
138 | ALIGN(idx); | ||
139 | |||
140 | result->h_addrtype = af; | ||
141 | result->h_length = address_length; | ||
142 | |||
143 | /* Check if there's enough space for the addresses */ | ||
144 | if (buflen < idx+u.data_len+sizeof(char*)*(u.count+1)) { | ||
145 | *errnop = ERANGE; | ||
146 | *h_errnop = NO_RECOVERY; | ||
147 | status = NSS_STATUS_TRYAGAIN; | ||
148 | goto finish; | ||
149 | } | ||
150 | 94 | ||
95 | address_length = (af == AF_INET) ? sizeof(ipv4_address_t) : sizeof(ipv6_address_t); | ||
96 | if (buflen < | ||
97 | sizeof(char*)+ /* alias names */ | ||
98 | strlen(name)+1) | ||
99 | { /* official name */ | ||
100 | *errnop = ERANGE; | ||
101 | *h_errnop = NO_RECOVERY; | ||
102 | status = NSS_STATUS_TRYAGAIN; | ||
103 | |||
104 | goto finish; | ||
105 | } | ||
106 | u.count = 0; | ||
107 | u.data_len = 0; | ||
108 | i = gns_resolve_name (af, | ||
109 | name, | ||
110 | &u); | ||
111 | if (-3 == i) | ||
112 | { | ||
113 | status = NSS_STATUS_NOTFOUND; | ||
114 | goto finish; | ||
115 | } | ||
116 | if (-2 == i) | ||
117 | { | ||
118 | status = NSS_STATUS_UNAVAIL; | ||
119 | goto finish; | ||
120 | } | ||
121 | if ( (-1 == i) || | ||
122 | (u.count == 0) ) | ||
123 | { | ||
124 | *errnop = ETIMEDOUT; | ||
125 | *h_errnop = HOST_NOT_FOUND; | ||
126 | status = NSS_STATUS_NOTFOUND; | ||
127 | goto finish; | ||
128 | } | ||
129 | /* Alias names */ | ||
130 | *((char**) buffer) = NULL; | ||
131 | result->h_aliases = (char**) buffer; | ||
132 | idx = sizeof(char*); | ||
133 | |||
134 | /* Official name */ | ||
135 | strcpy (buffer+idx, | ||
136 | name); | ||
137 | result->h_name = buffer+idx; | ||
138 | idx += strlen (name)+1; | ||
139 | |||
140 | ALIGN(idx); | ||
141 | |||
142 | result->h_addrtype = af; | ||
143 | result->h_length = address_length; | ||
144 | |||
145 | /* Check if there's enough space for the addresses */ | ||
146 | if (buflen < idx+u.data_len+sizeof(char*)*(u.count+1)) | ||
147 | { | ||
148 | *errnop = ERANGE; | ||
149 | *h_errnop = NO_RECOVERY; | ||
150 | status = NSS_STATUS_TRYAGAIN; | ||
151 | goto finish; | ||
152 | } | ||
151 | /* Addresses */ | 153 | /* Addresses */ |
152 | astart = idx; | 154 | astart = idx; |
153 | l = u.count*address_length; | 155 | l = u.count*address_length; |
154 | if (0 != l) | 156 | if (0 != l) |
155 | memcpy(buffer+astart, &u.data, l); | 157 | memcpy (buffer+astart, |
156 | /* address_length is a multiple of 32bits, so idx is still aligned | 158 | &u.data, |
157 | * correctly */ | 159 | l); |
158 | idx += l; | 160 | /* address_length is a multiple of 32bits, so idx is still aligned |
159 | 161 | * correctly */ | |
160 | /* Address array address_lenght is always a multiple of 32bits */ | 162 | idx += l; |
161 | for (i = 0; i < u.count; i++) | 163 | |
162 | ((char**) (buffer+idx))[i] = buffer+astart+address_length*i; | 164 | /* Address array address_length is always a multiple of 32bits */ |
163 | ((char**) (buffer+idx))[i] = NULL; | 165 | for (i = 0; i < u.count; i++) |
164 | result->h_addr_list = (char**) (buffer+idx); | 166 | ((char**) (buffer+idx))[i] = buffer+astart+address_length*i; |
165 | 167 | ((char**) (buffer+idx))[i] = NULL; | |
166 | status = NSS_STATUS_SUCCESS; | 168 | result->h_addr_list = (char**) (buffer+idx); |
169 | |||
170 | status = NSS_STATUS_SUCCESS; | ||
167 | 171 | ||
168 | finish: | 172 | finish: |
169 | return status; | 173 | return status; |
170 | } | 174 | } |
171 | 175 | ||
176 | |||
172 | /** | 177 | /** |
173 | * The gethostbyname hook executed by nsswitch | 178 | * The gethostbyname hook executed by nsswitch |
174 | * | 179 | * |
@@ -176,29 +181,28 @@ finish: | |||
176 | * @param result the result hostent | 181 | * @param result the result hostent |
177 | * @param buffer the result buffer | 182 | * @param buffer the result buffer |
178 | * @param buflen length of the buffer | 183 | * @param buflen length of the buffer |
179 | * @param errnop idk | 184 | * @param errnop[out] the low-level error code to return to the application |
180 | * @param h_errnop idk | 185 | * @param h_errnop idk |
181 | * @return a nss_status code | 186 | * @return a nss_status code |
182 | */ | 187 | */ |
183 | enum nss_status | 188 | enum nss_status |
184 | _nss_gns_gethostbyname_r ( | 189 | _nss_gns_gethostbyname_r (const char *name, |
185 | const char *name, | 190 | struct hostent *result, |
186 | struct hostent *result, | 191 | char *buffer, |
187 | char *buffer, | 192 | size_t buflen, |
188 | size_t buflen, | 193 | int *errnop, |
189 | int *errnop, | 194 | int *h_errnop) |
190 | int *h_errnop) { | 195 | { |
191 | 196 | return _nss_gns_gethostbyname2_r (name, | |
192 | return _nss_gns_gethostbyname2_r( | 197 | AF_UNSPEC, |
193 | name, | 198 | result, |
194 | AF_UNSPEC, | 199 | buffer, |
195 | result, | 200 | buflen, |
196 | buffer, | 201 | errnop, |
197 | buflen, | 202 | h_errnop); |
198 | errnop, | ||
199 | h_errnop); | ||
200 | } | 203 | } |
201 | 204 | ||
205 | |||
202 | /** | 206 | /** |
203 | * The gethostbyaddr hook executed by nsswitch | 207 | * The gethostbyaddr hook executed by nsswitch |
204 | * We can't do this so we always return NSS_STATUS_UNAVAIL | 208 | * We can't do this so we always return NSS_STATUS_UNAVAIL |
@@ -209,23 +213,22 @@ _nss_gns_gethostbyname_r ( | |||
209 | * @param result the result hostent | 213 | * @param result the result hostent |
210 | * @param buffer the result buffer | 214 | * @param buffer the result buffer |
211 | * @param buflen length of the buffer | 215 | * @param buflen length of the buffer |
212 | * @param errnop idk | 216 | * @param errnop[out] the low-level error code to return to the application |
213 | * @param h_errnop idk | 217 | * @param h_errnop idk |
214 | * @return NSS_STATUS_UNAVAIL | 218 | * @return NSS_STATUS_UNAVAIL |
215 | */ | 219 | */ |
216 | enum nss_status | 220 | enum nss_status |
217 | _nss_gns_gethostbyaddr_r( | 221 | _nss_gns_gethostbyaddr_r (const void* addr, |
218 | const void* addr, | 222 | int len, |
219 | int len, | 223 | int af, |
220 | int af, | 224 | struct hostent *result, |
221 | struct hostent *result, | 225 | char *buffer, |
222 | char *buffer, | 226 | size_t buflen, |
223 | size_t buflen, | 227 | int *errnop, |
224 | int *errnop, | 228 | int *h_errnop) |
225 | int *h_errnop) { | 229 | { |
226 | 230 | *errnop = EINVAL; | |
227 | *errnop = EINVAL; | 231 | *h_errnop = NO_RECOVERY; |
228 | *h_errnop = NO_RECOVERY; | 232 | //NOTE we allow to leak this into DNS so no NOTFOUND |
229 | //NOTE we allow to leak this into DNS so no NOTFOUND | 233 | return NSS_STATUS_UNAVAIL; |
230 | return NSS_STATUS_UNAVAIL; | ||
231 | } | 234 | } |
diff --git a/src/gns/nss/nss_gns_query.c b/src/gns/nss/nss_gns_query.c index 094e25ed5..867ead624 100644 --- a/src/gns/nss/nss_gns_query.c +++ b/src/gns/nss/nss_gns_query.c | |||
@@ -11,7 +11,7 @@ | |||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | */ | 17 | */ |
@@ -48,14 +48,16 @@ gns_resolve_name (int af, | |||
48 | { | 48 | { |
49 | if (-1 == asprintf (&cmd, | 49 | if (-1 == asprintf (&cmd, |
50 | "%s -t AAAA -u %s\n", | 50 | "%s -t AAAA -u %s\n", |
51 | "gnunet-gns -r", name)) | 51 | "gnunet-gns -r", |
52 | name)) | ||
52 | return -1; | 53 | return -1; |
53 | } | 54 | } |
54 | else | 55 | else |
55 | { | 56 | { |
56 | if (-1 == asprintf (&cmd, | 57 | if (-1 == asprintf (&cmd, |
57 | "%s %s\n", | 58 | "%s %s\n", |
58 | "gnunet-gns -r -u", name)) | 59 | "gnunet-gns -r -u", |
60 | name)) | ||
59 | return -1; | 61 | return -1; |
60 | } | 62 | } |
61 | if (NULL == (p = popen (cmd, "r"))) | 63 | if (NULL == (p = popen (cmd, "r"))) |
@@ -63,7 +65,9 @@ gns_resolve_name (int af, | |||
63 | free (cmd); | 65 | free (cmd); |
64 | return -1; | 66 | return -1; |
65 | } | 67 | } |
66 | while (NULL != fgets (line, sizeof(line), p)) | 68 | while (NULL != fgets (line, |
69 | sizeof(line), | ||
70 | p)) | ||
67 | { | 71 | { |
68 | if (u->count >= MAX_ENTRIES) | 72 | if (u->count >= MAX_ENTRIES) |
69 | break; | 73 | break; |
@@ -72,7 +76,9 @@ gns_resolve_name (int af, | |||
72 | line[strlen(line)-1] = '\0'; | 76 | line[strlen(line)-1] = '\0'; |
73 | if (AF_INET == af) | 77 | if (AF_INET == af) |
74 | { | 78 | { |
75 | if (inet_pton(af, line, &(u->data.ipv4[u->count]))) | 79 | if (inet_pton(af, |
80 | line, | ||
81 | &u->data.ipv4[u->count])) | ||
76 | { | 82 | { |
77 | u->count++; | 83 | u->count++; |
78 | u->data_len += sizeof(ipv4_address_t); | 84 | u->data_len += sizeof(ipv4_address_t); |
@@ -86,7 +92,9 @@ gns_resolve_name (int af, | |||
86 | } | 92 | } |
87 | else if (AF_INET6 == af) | 93 | else if (AF_INET6 == af) |
88 | { | 94 | { |
89 | if (inet_pton(af, line, &(u->data.ipv6[u->count]))) | 95 | if (inet_pton(af, |
96 | line, | ||
97 | &u->data.ipv6[u->count])) | ||
90 | { | 98 | { |
91 | u->count++; | 99 | u->count++; |
92 | u->data_len += sizeof(ipv6_address_t); | 100 | u->data_len += sizeof(ipv6_address_t); |
@@ -105,7 +113,10 @@ gns_resolve_name (int af, | |||
105 | if (4 == ret) | 113 | if (4 == ret) |
106 | return -2; /* not for GNS */ | 114 | return -2; /* not for GNS */ |
107 | if (3 == ret) | 115 | if (3 == ret) |
108 | return -3; /* timeout */ | 116 | return -3; /* timeout -> not found */ |
117 | if ( (2 == ret) || (1 == ret) ) | ||
118 | return -2; /* launch failure -> service unavailable */ | ||
109 | return 0; | 119 | return 0; |
110 | } | 120 | } |
121 | |||
111 | /* end of nss_gns_query.c */ | 122 | /* end of nss_gns_query.c */ |
diff --git a/src/gns/nss/nss_gns_query.h b/src/gns/nss/nss_gns_query.h index bb04f9004..48cab4b22 100644 --- a/src/gns/nss/nss_gns_query.h +++ b/src/gns/nss/nss_gns_query.h | |||
@@ -11,7 +11,7 @@ | |||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | */ | 17 | */ |
@@ -26,25 +26,30 @@ | |||
26 | /* Maximum number of entries to return */ | 26 | /* Maximum number of entries to return */ |
27 | #define MAX_ENTRIES 16 | 27 | #define MAX_ENTRIES 16 |
28 | 28 | ||
29 | typedef struct { | 29 | typedef struct |
30 | uint32_t address; | 30 | { |
31 | uint32_t address; | ||
31 | } ipv4_address_t; | 32 | } ipv4_address_t; |
32 | 33 | ||
33 | typedef struct { | 34 | |
34 | uint8_t address[16]; | 35 | typedef struct |
36 | { | ||
37 | uint8_t address[16]; | ||
35 | } ipv6_address_t; | 38 | } ipv6_address_t; |
36 | 39 | ||
37 | 40 | ||
38 | struct userdata { | 41 | struct userdata |
42 | { | ||
39 | int count; | 43 | int count; |
40 | int data_len; /* only valid when doing reverse lookup */ | 44 | int data_len; /* only valid when doing reverse lookup */ |
41 | union { | 45 | union { |
42 | ipv4_address_t ipv4[MAX_ENTRIES]; | 46 | ipv4_address_t ipv4[MAX_ENTRIES]; |
43 | ipv6_address_t ipv6[MAX_ENTRIES]; | 47 | ipv6_address_t ipv6[MAX_ENTRIES]; |
44 | char *name[MAX_ENTRIES]; | 48 | char *name[MAX_ENTRIES]; |
45 | } data; | 49 | } data; |
46 | }; | 50 | }; |
47 | 51 | ||
52 | |||
48 | /** | 53 | /** |
49 | * Wrapper function that uses gnunet-gns cli tool to resolve | 54 | * Wrapper function that uses gnunet-gns cli tool to resolve |
50 | * an IPv4/6 address. | 55 | * an IPv4/6 address. |
@@ -54,8 +59,9 @@ struct userdata { | |||
54 | * @param u the userdata (result struct) | 59 | * @param u the userdata (result struct) |
55 | * @return -1 on error else 0 | 60 | * @return -1 on error else 0 |
56 | */ | 61 | */ |
57 | int gns_resolve_name(int af, | 62 | int |
58 | const char *name, | 63 | gns_resolve_name(int af, |
59 | struct userdata *userdata); | 64 | const char *name, |
65 | struct userdata *userdata); | ||
60 | 66 | ||
61 | #endif | 67 | #endif |
diff --git a/src/gnsrecord/Makefile.am b/src/gnsrecord/Makefile.am index c83aa3307..f840a31a4 100644 --- a/src/gnsrecord/Makefile.am +++ b/src/gnsrecord/Makefile.am | |||
@@ -38,7 +38,6 @@ libgnunetgnsrecord_la_SOURCES = \ | |||
38 | gnsrecord_crypto.c \ | 38 | gnsrecord_crypto.c \ |
39 | gnsrecord_misc.c | 39 | gnsrecord_misc.c |
40 | libgnunetgnsrecord_la_LIBADD = \ | 40 | libgnunetgnsrecord_la_LIBADD = \ |
41 | $(top_builddir)/src/dns/libgnunetdnsparser.la \ | ||
42 | $(top_builddir)/src/util/libgnunetutil.la \ | 41 | $(top_builddir)/src/util/libgnunetutil.la \ |
43 | $(GN_LIBINTL) | 42 | $(GN_LIBINTL) |
44 | libgnunetgnsrecord_la_LDFLAGS = \ | 43 | libgnunetgnsrecord_la_LDFLAGS = \ |
@@ -53,7 +52,6 @@ plugin_LTLIBRARIES = \ | |||
53 | libgnunet_plugin_gnsrecord_dns_la_SOURCES = \ | 52 | libgnunet_plugin_gnsrecord_dns_la_SOURCES = \ |
54 | plugin_gnsrecord_dns.c | 53 | plugin_gnsrecord_dns.c |
55 | libgnunet_plugin_gnsrecord_dns_la_LIBADD = \ | 54 | libgnunet_plugin_gnsrecord_dns_la_LIBADD = \ |
56 | $(top_builddir)/src/dns/libgnunetdnsparser.la \ | ||
57 | $(top_builddir)/src/util/libgnunetutil.la \ | 55 | $(top_builddir)/src/util/libgnunetutil.la \ |
58 | $(LTLIBINTL) | 56 | $(LTLIBINTL) |
59 | libgnunet_plugin_gnsrecord_dns_la_LDFLAGS = \ | 57 | libgnunet_plugin_gnsrecord_dns_la_LDFLAGS = \ |
diff --git a/src/gnsrecord/gnsrecord_serialization.c b/src/gnsrecord/gnsrecord_serialization.c index a1cfbe984..934d36102 100644 --- a/src/gnsrecord/gnsrecord_serialization.c +++ b/src/gnsrecord/gnsrecord_serialization.c | |||
@@ -90,6 +90,9 @@ GNUNET_GNSRECORD_records_get_size (unsigned int rd_count, | |||
90 | { | 90 | { |
91 | size_t ret; | 91 | size_t ret; |
92 | 92 | ||
93 | if (0 == rd_count) | ||
94 | return 0; | ||
95 | |||
93 | ret = sizeof (struct NetworkRecord) * rd_count; | 96 | ret = sizeof (struct NetworkRecord) * rd_count; |
94 | for (unsigned int i=0;i<rd_count;i++) | 97 | for (unsigned int i=0;i<rd_count;i++) |
95 | { | 98 | { |
@@ -205,6 +208,9 @@ GNUNET_GNSRECORD_records_serialize (unsigned int rd_count, | |||
205 | } | 208 | } |
206 | #endif | 209 | #endif |
207 | } | 210 | } |
211 | memset (&dest[off], | ||
212 | 0, | ||
213 | dest_size-off); | ||
208 | return dest_size; | 214 | return dest_size; |
209 | } | 215 | } |
210 | 216 | ||
diff --git a/src/gnsrecord/plugin_gnsrecord_dns.c b/src/gnsrecord/plugin_gnsrecord_dns.c index 188afcae7..254ae15ea 100644 --- a/src/gnsrecord/plugin_gnsrecord_dns.c +++ b/src/gnsrecord/plugin_gnsrecord_dns.c | |||
@@ -11,7 +11,7 @@ | |||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | */ | 17 | */ |
@@ -463,7 +463,7 @@ dns_string_to_value (void *cls, | |||
463 | } | 463 | } |
464 | cert_size = GNUNET_STRINGS_base64_decode (certp, | 464 | cert_size = GNUNET_STRINGS_base64_decode (certp, |
465 | strlen (certp), | 465 | strlen (certp), |
466 | &cert_data); | 466 | (void **) &cert_data); |
467 | GNUNET_free (sdup); | 467 | GNUNET_free (sdup); |
468 | cert.cert_type = type; | 468 | cert.cert_type = type; |
469 | cert.cert_tag = key; | 469 | cert.cert_tag = key; |
diff --git a/src/identity/identity_api_lookup.c b/src/identity/identity_api_lookup.c index 593a5dbb0..25aec8ede 100644 --- a/src/identity/identity_api_lookup.c +++ b/src/identity/identity_api_lookup.c | |||
@@ -11,7 +11,7 @@ | |||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | */ | 17 | */ |
@@ -131,6 +131,12 @@ GNUNET_IDENTITY_ego_lookup (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
131 | el->identity = GNUNET_IDENTITY_connect (cfg, | 131 | el->identity = GNUNET_IDENTITY_connect (cfg, |
132 | &identity_cb, | 132 | &identity_cb, |
133 | el); | 133 | el); |
134 | if (NULL == el->identity) | ||
135 | { | ||
136 | GNUNET_free (el->name); | ||
137 | GNUNET_free (el); | ||
138 | return NULL; | ||
139 | } | ||
134 | return el; | 140 | return el; |
135 | } | 141 | } |
136 | 142 | ||
diff --git a/src/include/block_dns.h b/src/include/block_dns.h index f54a51232..234ed502d 100644 --- a/src/include/block_dns.h +++ b/src/include/block_dns.h | |||
@@ -38,7 +38,7 @@ GNUNET_NETWORK_STRUCT_BEGIN | |||
38 | struct GNUNET_DNS_Advertisement | 38 | struct GNUNET_DNS_Advertisement |
39 | { | 39 | { |
40 | /** | 40 | /** |
41 | * Signature of the peer affirming that he is offering the service. | 41 | * Signature of the peer affirming that it is offering the service. |
42 | */ | 42 | */ |
43 | struct GNUNET_CRYPTO_EddsaSignature signature; | 43 | struct GNUNET_CRYPTO_EddsaSignature signature; |
44 | 44 | ||
diff --git a/src/include/gnunet_cadet_service.h b/src/include/gnunet_cadet_service.h index 4f35a3f1f..552763055 100644 --- a/src/include/gnunet_cadet_service.h +++ b/src/include/gnunet_cadet_service.h | |||
@@ -425,7 +425,9 @@ typedef void | |||
425 | int tunnel, | 425 | int tunnel, |
426 | int neighbor, | 426 | int neighbor, |
427 | unsigned int n_paths, | 427 | unsigned int n_paths, |
428 | const struct GNUNET_PeerIdentity *paths); | 428 | const struct GNUNET_PeerIdentity *paths, |
429 | int offset, | ||
430 | int finished_with_paths); | ||
429 | 431 | ||
430 | 432 | ||
431 | /** | 433 | /** |
diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h index b4bf5b0aa..1b982cc15 100644 --- a/src/include/gnunet_common.h +++ b/src/include/gnunet_common.h | |||
@@ -1074,7 +1074,7 @@ GNUNET_ntoh_double (double d); | |||
1074 | * @param tsize the target size for the resulting vector, use 0 to | 1074 | * @param tsize the target size for the resulting vector, use 0 to |
1075 | * free the vector (then, arr will be NULL afterwards). | 1075 | * free the vector (then, arr will be NULL afterwards). |
1076 | */ | 1076 | */ |
1077 | #define GNUNET_array_grow(arr,size,tsize) GNUNET_xgrow_((void**)&arr, sizeof(arr[0]), &size, tsize, __FILE__, __LINE__) | 1077 | #define GNUNET_array_grow(arr,size,tsize) GNUNET_xgrow_((void**)&(arr), sizeof((arr)[0]), &size, tsize, __FILE__, __LINE__) |
1078 | 1078 | ||
1079 | /** | 1079 | /** |
1080 | * @ingroup memory | 1080 | * @ingroup memory |
@@ -1089,7 +1089,7 @@ GNUNET_ntoh_double (double d); | |||
1089 | * array size | 1089 | * array size |
1090 | * @param element the element that will be appended to the array | 1090 | * @param element the element that will be appended to the array |
1091 | */ | 1091 | */ |
1092 | #define GNUNET_array_append(arr,size,element) do { GNUNET_array_grow(arr,size,size+1); arr[size-1] = element; } while(0) | 1092 | #define GNUNET_array_append(arr,size,element) do { GNUNET_array_grow(arr,size,size+1); (arr)[size-1] = element; } while(0) |
1093 | 1093 | ||
1094 | /** | 1094 | /** |
1095 | * @ingroup memory | 1095 | * @ingroup memory |
diff --git a/src/include/gnunet_core_service.h b/src/include/gnunet_core_service.h index e25043d17..b38f38b69 100644 --- a/src/include/gnunet_core_service.h +++ b/src/include/gnunet_core_service.h | |||
@@ -232,7 +232,7 @@ enum GNUNET_CORE_KxState | |||
232 | 232 | ||
233 | /** | 233 | /** |
234 | * The other peer has confirmed our session key + PING with a PONG | 234 | * The other peer has confirmed our session key + PING with a PONG |
235 | * message encrypted with his session key (which we got). Key | 235 | * message encrypted with their session key (which we got). Key |
236 | * exchange is done. | 236 | * exchange is done. |
237 | */ | 237 | */ |
238 | GNUNET_CORE_KX_STATE_UP, | 238 | GNUNET_CORE_KX_STATE_UP, |
diff --git a/src/include/gnunet_dnsparser_lib.h b/src/include/gnunet_dnsparser_lib.h index fa4915be7..0fc6ac19c 100644 --- a/src/include/gnunet_dnsparser_lib.h +++ b/src/include/gnunet_dnsparser_lib.h | |||
@@ -31,7 +31,6 @@ | |||
31 | #define GNUNET_DNSPARSER_LIB_H | 31 | #define GNUNET_DNSPARSER_LIB_H |
32 | 32 | ||
33 | #include "gnunet_util_lib.h" | 33 | #include "gnunet_util_lib.h" |
34 | #include "gnunet_tun_lib.h" | ||
35 | 34 | ||
36 | /** | 35 | /** |
37 | * Maximum length of a label in DNS. | 36 | * Maximum length of a label in DNS. |
@@ -83,6 +82,7 @@ | |||
83 | #define GNUNET_DNSPARSER_TYPE_OPENPGPKEY 61 | 82 | #define GNUNET_DNSPARSER_TYPE_OPENPGPKEY 61 |
84 | #define GNUNET_DNSPARSER_TYPE_TKEY 249 | 83 | #define GNUNET_DNSPARSER_TYPE_TKEY 249 |
85 | #define GNUNET_DNSPARSER_TYPE_TSIG 250 | 84 | #define GNUNET_DNSPARSER_TYPE_TSIG 250 |
85 | #define GNUNET_DNSPARSER_TYPE_ALL 255 | ||
86 | #define GNUNET_DNSPARSER_TYPE_URI 256 | 86 | #define GNUNET_DNSPARSER_TYPE_URI 256 |
87 | #define GNUNET_DNSPARSER_TYPE_TA 32768 | 87 | #define GNUNET_DNSPARSER_TYPE_TA 32768 |
88 | 88 | ||
@@ -841,6 +841,58 @@ GNUNET_DNSPARSER_parse_srv (const char *udp_payload, | |||
841 | size_t udp_payload_length, | 841 | size_t udp_payload_length, |
842 | size_t *off); | 842 | size_t *off); |
843 | 843 | ||
844 | /* ***************** low-level duplication API ******************** */ | ||
845 | |||
846 | /** | ||
847 | * Duplicate (deep-copy) the given DNS record | ||
848 | * | ||
849 | * @param r the record | ||
850 | * @return the newly allocated record | ||
851 | */ | ||
852 | struct GNUNET_DNSPARSER_Record * | ||
853 | GNUNET_DNSPARSER_duplicate_record (const struct GNUNET_DNSPARSER_Record *r); | ||
854 | |||
855 | |||
856 | /** | ||
857 | * Duplicate (deep-copy) the given DNS record | ||
858 | * | ||
859 | * @param r the record | ||
860 | * @return the newly allocated record | ||
861 | */ | ||
862 | struct GNUNET_DNSPARSER_SoaRecord * | ||
863 | GNUNET_DNSPARSER_duplicate_soa_record (const struct GNUNET_DNSPARSER_SoaRecord *r); | ||
864 | |||
865 | |||
866 | /** | ||
867 | * Duplicate (deep-copy) the given DNS record | ||
868 | * | ||
869 | * @param r the record | ||
870 | * @return the newly allocated record | ||
871 | */ | ||
872 | struct GNUNET_DNSPARSER_CertRecord * | ||
873 | GNUNET_DNSPARSER_duplicate_cert_record (const struct GNUNET_DNSPARSER_CertRecord *r); | ||
874 | |||
875 | |||
876 | /** | ||
877 | * Duplicate (deep-copy) the given DNS record | ||
878 | * | ||
879 | * @param r the record | ||
880 | * @return the newly allocated record | ||
881 | */ | ||
882 | struct GNUNET_DNSPARSER_MxRecord * | ||
883 | GNUNET_DNSPARSER_duplicate_mx_record (const struct GNUNET_DNSPARSER_MxRecord *r); | ||
884 | |||
885 | |||
886 | /** | ||
887 | * Duplicate (deep-copy) the given DNS record | ||
888 | * | ||
889 | * @param r the record | ||
890 | * @return the newly allocated record | ||
891 | */ | ||
892 | struct GNUNET_DNSPARSER_SrvRecord * | ||
893 | GNUNET_DNSPARSER_duplicate_srv_record (const struct GNUNET_DNSPARSER_SrvRecord *r); | ||
894 | |||
895 | |||
844 | /* ***************** low-level deallocation API ******************** */ | 896 | /* ***************** low-level deallocation API ******************** */ |
845 | 897 | ||
846 | /** | 898 | /** |
diff --git a/src/include/gnunet_dnsstub_lib.h b/src/include/gnunet_dnsstub_lib.h index 8f1b90425..ad44be846 100644 --- a/src/include/gnunet_dnsstub_lib.h +++ b/src/include/gnunet_dnsstub_lib.h | |||
@@ -29,8 +29,7 @@ | |||
29 | #ifndef GNUNET_DNSSTUB_LIB_H | 29 | #ifndef GNUNET_DNSSTUB_LIB_H |
30 | #define GNUNET_DNSSTUB_LIB_H | 30 | #define GNUNET_DNSSTUB_LIB_H |
31 | 31 | ||
32 | #include "gnunet_common.h" | 32 | #include "gnunet_util_lib.h" |
33 | #include "gnunet_tun_lib.h" | ||
34 | 33 | ||
35 | /** | 34 | /** |
36 | * Opaque handle to the stub resolver. | 35 | * Opaque handle to the stub resolver. |
diff --git a/src/include/gnunet_os_lib.h b/src/include/gnunet_os_lib.h index 86957a25c..98469a156 100644 --- a/src/include/gnunet_os_lib.h +++ b/src/include/gnunet_os_lib.h | |||
@@ -556,7 +556,7 @@ GNUNET_OS_command_run (GNUNET_OS_LineProcessor proc, | |||
556 | 556 | ||
557 | 557 | ||
558 | /** | 558 | /** |
559 | * Retrieve the status of a process, waiting on him if dead. | 559 | * Retrieve the status of a process, waiting on it if dead. |
560 | * Nonblocking version. | 560 | * Nonblocking version. |
561 | * | 561 | * |
562 | * @param proc pointer to process structure | 562 | * @param proc pointer to process structure |
@@ -586,7 +586,7 @@ GNUNET_OS_process_wait (struct GNUNET_OS_Process *proc); | |||
586 | 586 | ||
587 | 587 | ||
588 | /** | 588 | /** |
589 | * Retrieve the status of a process, waiting on him if dead. | 589 | * Retrieve the status of a process, waiting on it if dead. |
590 | * Blocking version. | 590 | * Blocking version. |
591 | * | 591 | * |
592 | * @param proc pointer to process structure | 592 | * @param proc pointer to process structure |
diff --git a/src/include/gnunet_psyc_service.h b/src/include/gnunet_psyc_service.h index f31de0e67..053fe4495 100644 --- a/src/include/gnunet_psyc_service.h +++ b/src/include/gnunet_psyc_service.h | |||
@@ -135,7 +135,7 @@ enum GNUNET_PSYC_ChannelFlags | |||
135 | enum GNUNET_PSYC_Policy | 135 | enum GNUNET_PSYC_Policy |
136 | { | 136 | { |
137 | /** | 137 | /** |
138 | * Anyone can join the channel, without announcing his presence; | 138 | * Anyone can join the channel, without announcing their presence; |
139 | * all messages are always public and can be distributed freely. | 139 | * all messages are always public and can be distributed freely. |
140 | * Joins may be announced, but this is not required. | 140 | * Joins may be announced, but this is not required. |
141 | */ | 141 | */ |
diff --git a/src/include/gnunet_secretsharing_service.h b/src/include/gnunet_secretsharing_service.h index bd11df982..a3f44222e 100644 --- a/src/include/gnunet_secretsharing_service.h +++ b/src/include/gnunet_secretsharing_service.h | |||
@@ -248,7 +248,7 @@ GNUNET_SECRETSHARING_encrypt (const struct GNUNET_SECRETSHARING_PublicKey *publi | |||
248 | * published the same value, it will be decrypted. | 248 | * published the same value, it will be decrypted. |
249 | * | 249 | * |
250 | * When the operation is canceled, the decrypt_cb is not called anymore, but the calling | 250 | * When the operation is canceled, the decrypt_cb is not called anymore, but the calling |
251 | * peer may already have irrevocably contributed his share for the decryption of the value. | 251 | * peer may already have irrevocably contributed its share for the decryption of the value. |
252 | * | 252 | * |
253 | * @param cfg configuration to use | 253 | * @param cfg configuration to use |
254 | * @param share our secret share to use for decryption | 254 | * @param share our secret share to use for decryption |
@@ -273,7 +273,7 @@ GNUNET_SECRETSHARING_decrypt (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
273 | * Cancel a decryption. | 273 | * Cancel a decryption. |
274 | * | 274 | * |
275 | * The decrypt_cb is not called anymore, but the calling | 275 | * The decrypt_cb is not called anymore, but the calling |
276 | * peer may already have irrevocably contributed his share for the decryption of the value. | 276 | * peer may already have irrevocably contributed its share for the decryption of the value. |
277 | * | 277 | * |
278 | * @param dh to cancel | 278 | * @param dh to cancel |
279 | */ | 279 | */ |
diff --git a/src/include/gnunet_signatures.h b/src/include/gnunet_signatures.h index bc9e3dc16..d7accaf2c 100644 --- a/src/include/gnunet_signatures.h +++ b/src/include/gnunet_signatures.h | |||
@@ -134,7 +134,7 @@ extern "C" | |||
134 | 134 | ||
135 | /** | 135 | /** |
136 | * Accept state in regex DFA. Peer affirms that | 136 | * Accept state in regex DFA. Peer affirms that |
137 | * he offers the matching service. | 137 | * it offers the matching service. |
138 | */ | 138 | */ |
139 | #define GNUNET_SIGNATURE_PURPOSE_REGEX_ACCEPT 18 | 139 | #define GNUNET_SIGNATURE_PURPOSE_REGEX_ACCEPT 18 |
140 | 140 | ||
diff --git a/src/include/gnunet_strings_lib.h b/src/include/gnunet_strings_lib.h index 1fdab93b2..c1d76ef71 100644 --- a/src/include/gnunet_strings_lib.h +++ b/src/include/gnunet_strings_lib.h | |||
@@ -11,7 +11,7 @@ | |||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | */ | 17 | */ |
@@ -339,7 +339,9 @@ GNUNET_STRINGS_string_to_data (const char *enc, | |||
339 | * @return the size of the output | 339 | * @return the size of the output |
340 | */ | 340 | */ |
341 | size_t | 341 | size_t |
342 | GNUNET_STRINGS_base64_encode (const char *data, size_t len, char **output); | 342 | GNUNET_STRINGS_base64_encode (const void *in, |
343 | size_t len, | ||
344 | char **output); | ||
343 | 345 | ||
344 | 346 | ||
345 | /** | 347 | /** |
@@ -354,7 +356,7 @@ GNUNET_STRINGS_base64_encode (const char *data, size_t len, char **output); | |||
354 | size_t | 356 | size_t |
355 | GNUNET_STRINGS_base64_decode (const char *data, | 357 | GNUNET_STRINGS_base64_decode (const char *data, |
356 | size_t len, | 358 | size_t len, |
357 | char **output); | 359 | void **output); |
358 | 360 | ||
359 | 361 | ||
360 | /** | 362 | /** |
diff --git a/src/include/gnunet_tun_lib.h b/src/include/gnunet_tun_lib.h index a2e75eb5f..8de627141 100644 --- a/src/include/gnunet_tun_lib.h +++ b/src/include/gnunet_tun_lib.h | |||
@@ -30,7 +30,8 @@ | |||
30 | #ifndef GNUNET_TUN_LIB_H | 30 | #ifndef GNUNET_TUN_LIB_H |
31 | #define GNUNET_TUN_LIB_H | 31 | #define GNUNET_TUN_LIB_H |
32 | 32 | ||
33 | #include "gnunet_util_lib.h" | 33 | #include "gnunet_common.h" |
34 | #include "gnunet_crypto_lib.h" | ||
34 | 35 | ||
35 | 36 | ||
36 | /* see http://www.iana.org/assignments/ethernet-numbers */ | 37 | /* see http://www.iana.org/assignments/ethernet-numbers */ |
diff --git a/src/include/gnunet_util_lib.h b/src/include/gnunet_util_lib.h index 5e8eef1ad..091d3ba58 100644 --- a/src/include/gnunet_util_lib.h +++ b/src/include/gnunet_util_lib.h | |||
@@ -78,6 +78,9 @@ extern "C" | |||
78 | #include "gnunet_service_lib.h" | 78 | #include "gnunet_service_lib.h" |
79 | #include "gnunet_signal_lib.h" | 79 | #include "gnunet_signal_lib.h" |
80 | #include "gnunet_strings_lib.h" | 80 | #include "gnunet_strings_lib.h" |
81 | #include "gnunet_tun_lib.h" | ||
82 | #include "gnunet_dnsstub_lib.h" | ||
83 | #include "gnunet_dnsparser_lib.h" | ||
81 | 84 | ||
82 | #if 0 /* keep Emacsens' auto-indent happy */ | 85 | #if 0 /* keep Emacsens' auto-indent happy */ |
83 | { | 86 | { |
diff --git a/src/multicast/gnunet-service-multicast.c b/src/multicast/gnunet-service-multicast.c index 21eb39daa..20d29b906 100644 --- a/src/multicast/gnunet-service-multicast.c +++ b/src/multicast/gnunet-service-multicast.c | |||
@@ -1449,7 +1449,7 @@ check_client_member_join (void *cls, | |||
1449 | struct GNUNET_PeerIdentity *relays = (struct GNUNET_PeerIdentity *) &msg[1]; | 1449 | struct GNUNET_PeerIdentity *relays = (struct GNUNET_PeerIdentity *) &msg[1]; |
1450 | uint32_t relay_count = ntohl (msg->relay_count); | 1450 | uint32_t relay_count = ntohl (msg->relay_count); |
1451 | 1451 | ||
1452 | if (0 == relay_count} | 1452 | if (0 == relay_count) |
1453 | { | 1453 | { |
1454 | GNUNET_break (0); | 1454 | GNUNET_break (0); |
1455 | return GNUNET_SYSERR; | 1455 | return GNUNET_SYSERR; |
diff --git a/src/namestore/Makefile.am b/src/namestore/Makefile.am index fa85cc060..777e722c2 100644 --- a/src/namestore/Makefile.am +++ b/src/namestore/Makefile.am | |||
@@ -147,8 +147,6 @@ gnunet_zoneimport_LDADD = \ | |||
147 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ | 147 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ |
148 | $(top_builddir)/src/identity/libgnunetidentity.la \ | 148 | $(top_builddir)/src/identity/libgnunetidentity.la \ |
149 | $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ | 149 | $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ |
150 | $(top_builddir)/src/dns/libgnunetdnsparser.la \ | ||
151 | $(top_builddir)/src/dns/libgnunetdnsstub.la \ | ||
152 | $(top_builddir)/src/util/libgnunetutil.la \ | 150 | $(top_builddir)/src/util/libgnunetutil.la \ |
153 | $(GN_LIBINTL) | 151 | $(GN_LIBINTL) |
154 | 152 | ||
diff --git a/src/namestore/gnunet-zoneimport.c b/src/namestore/gnunet-zoneimport.c index 6c89cdb05..ddc8b483a 100644 --- a/src/namestore/gnunet-zoneimport.c +++ b/src/namestore/gnunet-zoneimport.c | |||
@@ -11,7 +11,7 @@ | |||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | */ | 17 | */ |
@@ -456,6 +456,7 @@ build_dns_query (struct Request *req, | |||
456 | char *rawp; | 456 | char *rawp; |
457 | struct GNUNET_DNSPARSER_Packet p; | 457 | struct GNUNET_DNSPARSER_Packet p; |
458 | struct GNUNET_DNSPARSER_Query q; | 458 | struct GNUNET_DNSPARSER_Query q; |
459 | int ret; | ||
459 | 460 | ||
460 | q.name = (char *) req->hostname; | 461 | q.name = (char *) req->hostname; |
461 | q.type = GNUNET_DNSPARSER_TYPE_NS; | 462 | q.type = GNUNET_DNSPARSER_TYPE_NS; |
@@ -467,12 +468,14 @@ build_dns_query (struct Request *req, | |||
467 | p.num_queries = 1; | 468 | p.num_queries = 1; |
468 | p.queries = &q; | 469 | p.queries = &q; |
469 | p.id = req->id; | 470 | p.id = req->id; |
470 | if (GNUNET_OK != | 471 | ret = GNUNET_DNSPARSER_pack (&p, |
471 | GNUNET_DNSPARSER_pack (&p, | 472 | UINT16_MAX, |
472 | UINT16_MAX, | 473 | &rawp, |
473 | &rawp, | 474 | raw_size); |
474 | raw_size)) | 475 | if (GNUNET_OK != ret) |
475 | { | 476 | { |
477 | if (GNUNET_NO == ret) | ||
478 | GNUNET_free (rawp); | ||
476 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 479 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
477 | "Failed to pack query for hostname `%s'\n", | 480 | "Failed to pack query for hostname `%s'\n", |
478 | req->hostname); | 481 | req->hostname); |
diff --git a/src/namestore/plugin_namestore_flat.c b/src/namestore/plugin_namestore_flat.c index 33c48b244..e16fe91b7 100644 --- a/src/namestore/plugin_namestore_flat.c +++ b/src/namestore/plugin_namestore_flat.c | |||
@@ -55,7 +55,7 @@ struct FlatFileEntry | |||
55 | /** | 55 | /** |
56 | * Entry zone | 56 | * Entry zone |
57 | */ | 57 | */ |
58 | struct GNUNET_CRYPTO_EcdsaPrivateKey *private_key; | 58 | struct GNUNET_CRYPTO_EcdsaPrivateKey private_key; |
59 | 59 | ||
60 | /** | 60 | /** |
61 | * Record cound | 61 | * Record cound |
@@ -93,7 +93,6 @@ static int | |||
93 | database_setup (struct Plugin *plugin) | 93 | database_setup (struct Plugin *plugin) |
94 | { | 94 | { |
95 | char *afsdir; | 95 | char *afsdir; |
96 | char *key; | ||
97 | char *record_data; | 96 | char *record_data; |
98 | char *zone_private_key; | 97 | char *zone_private_key; |
99 | char *record_data_b64; | 98 | char *record_data_b64; |
@@ -104,7 +103,6 @@ database_setup (struct Plugin *plugin) | |||
104 | char *record_count; | 103 | char *record_count; |
105 | size_t record_data_size; | 104 | size_t record_data_size; |
106 | uint64_t size; | 105 | uint64_t size; |
107 | size_t key_len; | ||
108 | struct GNUNET_HashCode hkey; | 106 | struct GNUNET_HashCode hkey; |
109 | struct GNUNET_DISK_FileHandle *fh; | 107 | struct GNUNET_DISK_FileHandle *fh; |
110 | struct FlatFileEntry *entry; | 108 | struct FlatFileEntry *entry; |
@@ -232,7 +230,7 @@ database_setup (struct Plugin *plugin) | |||
232 | record_data_size | 230 | record_data_size |
233 | = GNUNET_STRINGS_base64_decode (record_data_b64, | 231 | = GNUNET_STRINGS_base64_decode (record_data_b64, |
234 | strlen (record_data_b64), | 232 | strlen (record_data_b64), |
235 | &record_data); | 233 | (void **) &record_data); |
236 | entry->record_data = | 234 | entry->record_data = |
237 | GNUNET_new_array (entry->record_count, | 235 | GNUNET_new_array (entry->record_count, |
238 | struct GNUNET_GNSRECORD_Data); | 236 | struct GNUNET_GNSRECORD_Data); |
@@ -251,21 +249,34 @@ database_setup (struct Plugin *plugin) | |||
251 | break; | 249 | break; |
252 | } | 250 | } |
253 | GNUNET_free (record_data); | 251 | GNUNET_free (record_data); |
254 | GNUNET_STRINGS_base64_decode (zone_private_key, | 252 | |
255 | strlen (zone_private_key), | 253 | { |
256 | (char**)&entry->private_key); | 254 | struct GNUNET_CRYPTO_EcdsaPrivateKey *private_key; |
257 | key_len = strlen (label) + sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey); | 255 | |
258 | key = GNUNET_malloc (strlen (label) + sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)); | 256 | GNUNET_STRINGS_base64_decode (zone_private_key, |
259 | GNUNET_memcpy (key, | 257 | strlen (zone_private_key), |
260 | label, | 258 | (void**)&private_key); |
261 | strlen (label)); | 259 | entry->private_key = *private_key; |
262 | GNUNET_memcpy (key+strlen(label), | 260 | GNUNET_free (private_key); |
263 | entry->private_key, | 261 | } |
264 | sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)); | 262 | |
265 | GNUNET_CRYPTO_hash (key, | 263 | { |
266 | key_len, | 264 | char *key; |
267 | &hkey); | 265 | size_t key_len; |
268 | GNUNET_free (key); | 266 | |
267 | key_len = strlen (label) + sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey); | ||
268 | key = GNUNET_malloc (strlen (label) + sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)); | ||
269 | GNUNET_memcpy (key, | ||
270 | label, | ||
271 | strlen (label)); | ||
272 | GNUNET_memcpy (key+strlen(label), | ||
273 | &entry->private_key, | ||
274 | sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)); | ||
275 | GNUNET_CRYPTO_hash (key, | ||
276 | key_len, | ||
277 | &hkey); | ||
278 | GNUNET_free (key); | ||
279 | } | ||
269 | if (GNUNET_OK != | 280 | if (GNUNET_OK != |
270 | GNUNET_CONTAINER_multihashmap_put (plugin->hm, | 281 | GNUNET_CONTAINER_multihashmap_put (plugin->hm, |
271 | &hkey, | 282 | &hkey, |
@@ -302,7 +313,7 @@ store_and_free_entries (void *cls, | |||
302 | ssize_t data_size; | 313 | ssize_t data_size; |
303 | 314 | ||
304 | (void) key; | 315 | (void) key; |
305 | GNUNET_STRINGS_base64_encode ((char*)entry->private_key, | 316 | GNUNET_STRINGS_base64_encode (&entry->private_key, |
306 | sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey), | 317 | sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey), |
307 | &zone_private_key); | 318 | &zone_private_key); |
308 | data_size = GNUNET_GNSRECORD_records_get_size (entry->record_count, | 319 | data_size = GNUNET_GNSRECORD_records_get_size (entry->record_count, |
@@ -353,7 +364,6 @@ store_and_free_entries (void *cls, | |||
353 | strlen (line)); | 364 | strlen (line)); |
354 | 365 | ||
355 | GNUNET_free (line); | 366 | GNUNET_free (line); |
356 | GNUNET_free (entry->private_key); | ||
357 | GNUNET_free (entry->label); | 367 | GNUNET_free (entry->label); |
358 | GNUNET_free (entry->record_data); | 368 | GNUNET_free (entry->record_data); |
359 | GNUNET_free (entry); | 369 | GNUNET_free (entry); |
@@ -441,11 +451,10 @@ namestore_flat_store_records (void *cls, | |||
441 | return GNUNET_OK; | 451 | return GNUNET_OK; |
442 | } | 452 | } |
443 | entry = GNUNET_new (struct FlatFileEntry); | 453 | entry = GNUNET_new (struct FlatFileEntry); |
444 | entry->private_key = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPrivateKey); | ||
445 | GNUNET_asprintf (&entry->label, | 454 | GNUNET_asprintf (&entry->label, |
446 | label, | 455 | label, |
447 | strlen (label)); | 456 | strlen (label)); |
448 | GNUNET_memcpy (entry->private_key, | 457 | GNUNET_memcpy (&entry->private_key, |
449 | zone_key, | 458 | zone_key, |
450 | sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)); | 459 | sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)); |
451 | entry->rvalue = rvalue; | 460 | entry->rvalue = rvalue; |
@@ -519,7 +528,7 @@ namestore_flat_lookup_records (void *cls, | |||
519 | if (NULL != iter) | 528 | if (NULL != iter) |
520 | iter (iter_cls, | 529 | iter (iter_cls, |
521 | 0, | 530 | 0, |
522 | entry->private_key, | 531 | &entry->private_key, |
523 | entry->label, | 532 | entry->label, |
524 | entry->record_count, | 533 | entry->record_count, |
525 | entry->record_data); | 534 | entry->record_data); |
@@ -586,7 +595,7 @@ iterate_zones (void *cls, | |||
586 | if (0 == ic->limit) | 595 | if (0 == ic->limit) |
587 | return GNUNET_NO; | 596 | return GNUNET_NO; |
588 | if ( (NULL != ic->zone) && | 597 | if ( (NULL != ic->zone) && |
589 | (0 != memcmp (entry->private_key, | 598 | (0 != memcmp (&entry->private_key, |
590 | ic->zone, | 599 | ic->zone, |
591 | sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey))) ) | 600 | sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey))) ) |
592 | return GNUNET_YES; | 601 | return GNUNET_YES; |
@@ -598,7 +607,7 @@ iterate_zones (void *cls, | |||
598 | } | 607 | } |
599 | ic->iter (ic->iter_cls, | 608 | ic->iter (ic->iter_cls, |
600 | ic->pos, | 609 | ic->pos, |
601 | entry->private_key, | 610 | &entry->private_key, |
602 | entry->label, | 611 | entry->label, |
603 | entry->record_count, | 612 | entry->record_count, |
604 | entry->record_data); | 613 | entry->record_data); |
@@ -668,7 +677,7 @@ zone_to_name (void *cls, | |||
668 | struct FlatFileEntry *entry = value; | 677 | struct FlatFileEntry *entry = value; |
669 | 678 | ||
670 | (void) key; | 679 | (void) key; |
671 | if (0 != memcmp (entry->private_key, | 680 | if (0 != memcmp (&entry->private_key, |
672 | ztn->zone, | 681 | ztn->zone, |
673 | sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey))) | 682 | sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey))) |
674 | return GNUNET_YES; | 683 | return GNUNET_YES; |
@@ -683,7 +692,7 @@ zone_to_name (void *cls, | |||
683 | { | 692 | { |
684 | ztn->iter (ztn->iter_cls, | 693 | ztn->iter (ztn->iter_cls, |
685 | 0, | 694 | 0, |
686 | entry->private_key, | 695 | &entry->private_key, |
687 | entry->label, | 696 | entry->label, |
688 | entry->record_count, | 697 | entry->record_count, |
689 | entry->record_data); | 698 | entry->record_data); |
diff --git a/src/namestore/test_namestore_api_lookup_shadow.c b/src/namestore/test_namestore_api_lookup_shadow.c index ecfd03735..08977712b 100644 --- a/src/namestore/test_namestore_api_lookup_shadow.c +++ b/src/namestore/test_namestore_api_lookup_shadow.c | |||
@@ -277,9 +277,9 @@ main (int argc, char *argv[]) | |||
277 | { | 277 | { |
278 | res = 1; | 278 | res = 1; |
279 | } | 279 | } |
280 | GNUNET_free (cfg_name); | ||
281 | GNUNET_DISK_purge_cfg_dir (cfg_name, | 280 | GNUNET_DISK_purge_cfg_dir (cfg_name, |
282 | "GNUNET_TEST_HOME"); | 281 | "GNUNET_TEST_HOME"); |
282 | GNUNET_free (cfg_name); | ||
283 | return res; | 283 | return res; |
284 | } | 284 | } |
285 | 285 | ||
diff --git a/src/namestore/test_namestore_api_lookup_shadow_filter.c b/src/namestore/test_namestore_api_lookup_shadow_filter.c index b751ff703..7555f51e7 100644 --- a/src/namestore/test_namestore_api_lookup_shadow_filter.c +++ b/src/namestore/test_namestore_api_lookup_shadow_filter.c | |||
@@ -352,9 +352,9 @@ main (int argc, char *argv[]) | |||
352 | { | 352 | { |
353 | res = 1; | 353 | res = 1; |
354 | } | 354 | } |
355 | GNUNET_free (cfg_name); | ||
356 | GNUNET_DISK_purge_cfg_dir (cfg_name, | 355 | GNUNET_DISK_purge_cfg_dir (cfg_name, |
357 | "GNUNET_TEST_HOME"); | 356 | "GNUNET_TEST_HOME"); |
357 | GNUNET_free (cfg_name); | ||
358 | return res; | 358 | return res; |
359 | } | 359 | } |
360 | 360 | ||
diff --git a/src/namestore/test_namestore_api_sqlite.conf b/src/namestore/test_namestore_api_sqlite.conf index 82663400a..cd4822097 100644 --- a/src/namestore/test_namestore_api_sqlite.conf +++ b/src/namestore/test_namestore_api_sqlite.conf | |||
@@ -2,6 +2,7 @@ | |||
2 | 2 | ||
3 | [namestore] | 3 | [namestore] |
4 | DATABASE = sqlite | 4 | DATABASE = sqlite |
5 | # PREFIX = valgrind --leak-check=full --track-origins=yes --log-file=/tmp/v_log | ||
5 | 6 | ||
6 | [namestore-sqlite] | 7 | [namestore-sqlite] |
7 | FILENAME = $GNUNET_TEST_HOME/namestore/sqlite_test.db | 8 | FILENAME = $GNUNET_TEST_HOME/namestore/sqlite_test.db |
diff --git a/src/nat/gnunet-helper-nat-server.c b/src/nat/gnunet-helper-nat-server.c index 44817ede7..c5c6b563e 100644 --- a/src/nat/gnunet-helper-nat-server.c +++ b/src/nat/gnunet-helper-nat-server.c | |||
@@ -683,7 +683,10 @@ main (int argc, | |||
683 | if (1 == getppid ()) /* Check the parent process id, if 1 the parent has died, so we should die too */ | 683 | if (1 == getppid ()) /* Check the parent process id, if 1 the parent has died, so we should die too */ |
684 | break; | 684 | break; |
685 | if (FD_ISSET (icmpsock, &rs)) | 685 | if (FD_ISSET (icmpsock, &rs)) |
686 | { | ||
686 | process_icmp_response (); | 687 | process_icmp_response (); |
688 | continue; | ||
689 | } | ||
687 | if (0 == (++alt % 2)) | 690 | if (0 == (++alt % 2)) |
688 | send_icmp_echo (&external); | 691 | send_icmp_echo (&external); |
689 | else | 692 | else |
diff --git a/src/nat/test_nat_test_data.conf b/src/nat/test_nat_test_data.conf index 84de6159e..03850ec06 100644 --- a/src/nat/test_nat_test_data.conf +++ b/src/nat/test_nat_test_data.conf | |||
@@ -6,7 +6,7 @@ GNUNET_TEST_HOME = $GNUNET_TMP/nat-test | |||
6 | 6 | ||
7 | [gnunet-nat-server] | 7 | [gnunet-nat-server] |
8 | HOSTNAME = localhost | 8 | HOSTNAME = localhost |
9 | PORT = 12345 | 9 | PORT = 57315 |
10 | 10 | ||
11 | [nat] | 11 | [nat] |
12 | # Are we behind NAT? | 12 | # Are we behind NAT? |
diff --git a/src/psyc/Makefile.am b/src/psyc/Makefile.am index 26db608f3..d5c797f52 100644 --- a/src/psyc/Makefile.am +++ b/src/psyc/Makefile.am | |||
@@ -48,8 +48,8 @@ gnunet_service_psyc_CFLAGS = $(AM_CFLAGS) | |||
48 | 48 | ||
49 | 49 | ||
50 | if HAVE_TESTING | 50 | if HAVE_TESTING |
51 | check_PROGRAMS = \ | 51 | #check_PROGRAMS = \ |
52 | test_psyc2 | 52 | # test_psyc2 |
53 | # test_psyc | 53 | # test_psyc |
54 | endif | 54 | endif |
55 | 55 | ||
diff --git a/src/pt/Makefile.am b/src/pt/Makefile.am index e36630ae4..188387c0c 100644 --- a/src/pt/Makefile.am +++ b/src/pt/Makefile.am | |||
@@ -28,7 +28,6 @@ gnunet_daemon_pt_LDADD = \ | |||
28 | $(top_builddir)/src/cadet/libgnunetcadet.la \ | 28 | $(top_builddir)/src/cadet/libgnunetcadet.la \ |
29 | $(top_builddir)/src/dht/libgnunetdht.la \ | 29 | $(top_builddir)/src/dht/libgnunetdht.la \ |
30 | $(top_builddir)/src/dns/libgnunetdns.la \ | 30 | $(top_builddir)/src/dns/libgnunetdns.la \ |
31 | $(top_builddir)/src/dns/libgnunetdnsparser.la \ | ||
32 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ | 31 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ |
33 | $(top_builddir)/src/util/libgnunetutil.la \ | 32 | $(top_builddir)/src/util/libgnunetutil.la \ |
34 | $(GN_LIBINTL) | 33 | $(GN_LIBINTL) |
diff --git a/src/regex/Makefile.am b/src/regex/Makefile.am index 80997db40..2af6dcccd 100644 --- a/src/regex/Makefile.am +++ b/src/regex/Makefile.am | |||
@@ -171,7 +171,6 @@ test_regex_integration_SOURCES = \ | |||
171 | test_regex_integration_LDADD = -lm \ | 171 | test_regex_integration_LDADD = -lm \ |
172 | libgnunetregex.la \ | 172 | libgnunetregex.la \ |
173 | $(top_builddir)/src/testing/libgnunettesting.la \ | 173 | $(top_builddir)/src/testing/libgnunettesting.la \ |
174 | $(top_builddir)/src/tun/libgnunettun.la \ | ||
175 | $(top_builddir)/src/util/libgnunetutil.la | 174 | $(top_builddir)/src/util/libgnunetutil.la |
176 | 175 | ||
177 | test_regex_api_SOURCES = \ | 176 | test_regex_api_SOURCES = \ |
diff --git a/src/rps/gnunet-rps-profiler.c b/src/rps/gnunet-rps-profiler.c index b43ce2fa2..16f23e86c 100644 --- a/src/rps/gnunet-rps-profiler.c +++ b/src/rps/gnunet-rps-profiler.c | |||
@@ -1951,9 +1951,13 @@ static void compute_probabilities (uint32_t peer_idx) | |||
1951 | if ((GNUNET_YES == is_in_view (i, peer_idx)) && | 1951 | if ((GNUNET_YES == is_in_view (i, peer_idx)) && |
1952 | (1 <= (0.45 * view_size))) | 1952 | (1 <= (0.45 * view_size))) |
1953 | { | 1953 | { |
1954 | prob_push = 1.0 * binom (0.45 * view_size, 1) | 1954 | if (0 == binom (view_size, 0.45 * view_size)) prob_push = 0; |
1955 | / | 1955 | else |
1956 | binom (view_size, 0.45 * view_size); | 1956 | { |
1957 | prob_push = 1.0 * binom (0.45 * view_size, 1) | ||
1958 | / | ||
1959 | binom (view_size, 0.45 * view_size); | ||
1960 | } | ||
1957 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1961 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1958 | "\t\t%" PRIu32 " is in %" PRIu32 "'s view, prob: %f\n", | 1962 | "\t\t%" PRIu32 " is in %" PRIu32 "'s view, prob: %f\n", |
1959 | peer_idx, | 1963 | peer_idx, |
@@ -2318,6 +2322,7 @@ post_test_shutdown_ready_cb (void *cls, | |||
2318 | rps_peer->index); | 2322 | rps_peer->index); |
2319 | GNUNET_free (stat_cls); | 2323 | GNUNET_free (stat_cls); |
2320 | GNUNET_break (0); | 2324 | GNUNET_break (0); |
2325 | return; | ||
2321 | } | 2326 | } |
2322 | 2327 | ||
2323 | if (NULL != rps_peer->stat_op && | 2328 | if (NULL != rps_peer->stat_op && |
@@ -2494,7 +2499,6 @@ test_run (void *cls, | |||
2494 | struct OpListEntry *entry; | 2499 | struct OpListEntry *entry; |
2495 | 2500 | ||
2496 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "RUN was called\n"); | 2501 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "RUN was called\n"); |
2497 | printf ("test 1\n"); | ||
2498 | 2502 | ||
2499 | /* Check whether we timed out */ | 2503 | /* Check whether we timed out */ |
2500 | if (n_peers != num_peers || | 2504 | if (n_peers != num_peers || |
@@ -2578,7 +2582,6 @@ test_run (void *cls, | |||
2578 | * | 2582 | * |
2579 | * @param argc unused | 2583 | * @param argc unused |
2580 | * @param argv unused | 2584 | * @param argv unused |
2581 | * @return 0 on success | ||
2582 | */ | 2585 | */ |
2583 | static void | 2586 | static void |
2584 | run (void *cls, | 2587 | run (void *cls, |
@@ -2654,8 +2657,6 @@ run (void *cls, | |||
2654 | with the malicious portion */ | 2657 | with the malicious portion */ |
2655 | 2658 | ||
2656 | ok = 1; | 2659 | ok = 1; |
2657 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
2658 | "before _run()\n"); | ||
2659 | GNUNET_TESTBED_run (NULL, | 2660 | GNUNET_TESTBED_run (NULL, |
2660 | cfg, | 2661 | cfg, |
2661 | num_peers, | 2662 | num_peers, |
@@ -2664,10 +2665,6 @@ run (void *cls, | |||
2664 | NULL, | 2665 | NULL, |
2665 | &test_run, | 2666 | &test_run, |
2666 | NULL); | 2667 | NULL); |
2667 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
2668 | "after _run()\n"); | ||
2669 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
2670 | "gnunet-rps-profiler returned.\n"); | ||
2671 | } | 2668 | } |
2672 | 2669 | ||
2673 | /** | 2670 | /** |
diff --git a/src/rps/gnunet-rps.c b/src/rps/gnunet-rps.c index e09277589..b3785a733 100644 --- a/src/rps/gnunet-rps.c +++ b/src/rps/gnunet-rps.c | |||
@@ -150,12 +150,21 @@ run (void *cls, | |||
150 | static struct GNUNET_PeerIdentity zero_pid; | 150 | static struct GNUNET_PeerIdentity zero_pid; |
151 | 151 | ||
152 | rps_handle = GNUNET_RPS_connect (cfg); | 152 | rps_handle = GNUNET_RPS_connect (cfg); |
153 | if (NULL == rps_handle) | ||
154 | { | ||
155 | FPRINTF (stderr, "Failed to connect to the rps service\n"); | ||
156 | return; | ||
157 | } | ||
153 | 158 | ||
154 | if ((0 == memcmp (&zero_pid, &peer_id, sizeof (peer_id))) && | 159 | if ((0 == memcmp (&zero_pid, &peer_id, sizeof (peer_id))) && |
155 | (!view_update)) | 160 | (!view_update)) |
156 | { /* Request n PeerIDs */ | 161 | { /* Request n PeerIDs */ |
157 | /* If number was specified use it, else request single peer. */ | 162 | /* If number was specified use it, else request single peer. */ |
158 | num_peers = (NULL == args[0]) ? 1 : atoi (args[0]); | 163 | if (NULL == args[0] || |
164 | 0 == sscanf (args[0], "%lu", &num_peers)) | ||
165 | { | ||
166 | num_peers = 1; | ||
167 | } | ||
159 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 168 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
160 | "Requesting %" PRIu64 " PeerIDs\n", num_peers); | 169 | "Requesting %" PRIu64 " PeerIDs\n", num_peers); |
161 | req_handle = GNUNET_RPS_request_peers (rps_handle, num_peers, reply_handle, NULL); | 170 | req_handle = GNUNET_RPS_request_peers (rps_handle, num_peers, reply_handle, NULL); |
@@ -163,7 +172,11 @@ run (void *cls, | |||
163 | } else if (view_update) | 172 | } else if (view_update) |
164 | { | 173 | { |
165 | /* Get updates of view */ | 174 | /* Get updates of view */ |
166 | num_view_updates = (NULL == args[0]) ? 0 : atoi (args[0]); | 175 | if (NULL == args[0] || |
176 | 0 == sscanf (args[0], "%lu", &num_view_updates)) | ||
177 | { | ||
178 | num_view_updates = 0; | ||
179 | } | ||
167 | GNUNET_RPS_view_request (rps_handle, num_view_updates, view_update_handle, NULL); | 180 | GNUNET_RPS_view_request (rps_handle, num_view_updates, view_update_handle, NULL); |
168 | if (0 != num_view_updates) | 181 | if (0 != num_view_updates) |
169 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 182 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c index 1b9681663..5a75ac55a 100644 --- a/src/rps/gnunet-service-rps.c +++ b/src/rps/gnunet-service-rps.c | |||
@@ -243,7 +243,7 @@ struct PeerContext | |||
243 | 243 | ||
244 | /** | 244 | /** |
245 | * This is pobably followed by 'statistical' data (when we first saw | 245 | * This is pobably followed by 'statistical' data (when we first saw |
246 | * him, how did we get his ID, how many pushes (in a timeinterval), | 246 | * it, how did we get its ID, how many pushes (in a timeinterval), |
247 | * ...) | 247 | * ...) |
248 | */ | 248 | */ |
249 | }; | 249 | }; |
@@ -503,6 +503,8 @@ add_valid_peer (const struct GNUNET_PeerIdentity *peer) | |||
503 | return ret; | 503 | return ret; |
504 | } | 504 | } |
505 | 505 | ||
506 | static void | ||
507 | remove_pending_message (struct PendingMessage *pending_msg, int cancel); | ||
506 | 508 | ||
507 | /** | 509 | /** |
508 | * @brief Set the peer flag to living and | 510 | * @brief Set the peer flag to living and |
@@ -531,7 +533,7 @@ set_peer_live (struct PeerContext *peer_ctx) | |||
531 | GNUNET_i2s (&peer_ctx->peer_id)); | 533 | GNUNET_i2s (&peer_ctx->peer_id)); |
532 | // TODO wait until cadet sets mq->cancel_impl | 534 | // TODO wait until cadet sets mq->cancel_impl |
533 | //GNUNET_MQ_send_cancel (peer_ctx->liveliness_check_pending->ev); | 535 | //GNUNET_MQ_send_cancel (peer_ctx->liveliness_check_pending->ev); |
534 | GNUNET_free (peer_ctx->liveliness_check_pending); | 536 | remove_pending_message (peer_ctx->liveliness_check_pending, GNUNET_YES); |
535 | peer_ctx->liveliness_check_pending = NULL; | 537 | peer_ctx->liveliness_check_pending = NULL; |
536 | } | 538 | } |
537 | 539 | ||
@@ -653,56 +655,6 @@ get_mq (const struct GNUNET_PeerIdentity *peer) | |||
653 | return peer_ctx->mq; | 655 | return peer_ctx->mq; |
654 | } | 656 | } |
655 | 657 | ||
656 | |||
657 | /** | ||
658 | * @brief This is called in response to the first message we sent as a | ||
659 | * liveliness check. | ||
660 | * | ||
661 | * @param cls #PeerContext of peer with pending liveliness check | ||
662 | */ | ||
663 | static void | ||
664 | mq_liveliness_check_successful (void *cls) | ||
665 | { | ||
666 | struct PeerContext *peer_ctx = cls; | ||
667 | |||
668 | if (NULL != peer_ctx->liveliness_check_pending) | ||
669 | { | ||
670 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
671 | "Liveliness check for peer %s was successfull\n", | ||
672 | GNUNET_i2s (&peer_ctx->peer_id)); | ||
673 | GNUNET_free (peer_ctx->liveliness_check_pending); | ||
674 | peer_ctx->liveliness_check_pending = NULL; | ||
675 | set_peer_live (peer_ctx); | ||
676 | } | ||
677 | } | ||
678 | |||
679 | /** | ||
680 | * Issue a check whether peer is live | ||
681 | * | ||
682 | * @param peer_ctx the context of the peer | ||
683 | */ | ||
684 | static void | ||
685 | check_peer_live (struct PeerContext *peer_ctx) | ||
686 | { | ||
687 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
688 | "Get informed about peer %s getting live\n", | ||
689 | GNUNET_i2s (&peer_ctx->peer_id)); | ||
690 | |||
691 | struct GNUNET_MQ_Handle *mq; | ||
692 | struct GNUNET_MQ_Envelope *ev; | ||
693 | |||
694 | ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_RPS_PP_CHECK_LIVE); | ||
695 | peer_ctx->liveliness_check_pending = GNUNET_new (struct PendingMessage); | ||
696 | peer_ctx->liveliness_check_pending->ev = ev; | ||
697 | peer_ctx->liveliness_check_pending->peer_ctx = peer_ctx; | ||
698 | peer_ctx->liveliness_check_pending->type = "Check liveliness"; | ||
699 | mq = get_mq (&peer_ctx->peer_id); | ||
700 | GNUNET_MQ_notify_sent (ev, | ||
701 | mq_liveliness_check_successful, | ||
702 | peer_ctx); | ||
703 | GNUNET_MQ_send (mq, ev); | ||
704 | } | ||
705 | |||
706 | /** | 658 | /** |
707 | * @brief Add an envelope to a message passed to mq to list of pending messages | 659 | * @brief Add an envelope to a message passed to mq to list of pending messages |
708 | * | 660 | * |
@@ -757,6 +709,54 @@ remove_pending_message (struct PendingMessage *pending_msg, int cancel) | |||
757 | 709 | ||
758 | 710 | ||
759 | /** | 711 | /** |
712 | * @brief This is called in response to the first message we sent as a | ||
713 | * liveliness check. | ||
714 | * | ||
715 | * @param cls #PeerContext of peer with pending liveliness check | ||
716 | */ | ||
717 | static void | ||
718 | mq_liveliness_check_successful (void *cls) | ||
719 | { | ||
720 | struct PeerContext *peer_ctx = cls; | ||
721 | |||
722 | if (NULL != peer_ctx->liveliness_check_pending) | ||
723 | { | ||
724 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
725 | "Liveliness check for peer %s was successfull\n", | ||
726 | GNUNET_i2s (&peer_ctx->peer_id)); | ||
727 | remove_pending_message (peer_ctx->liveliness_check_pending, GNUNET_YES); | ||
728 | peer_ctx->liveliness_check_pending = NULL; | ||
729 | set_peer_live (peer_ctx); | ||
730 | } | ||
731 | } | ||
732 | |||
733 | /** | ||
734 | * Issue a check whether peer is live | ||
735 | * | ||
736 | * @param peer_ctx the context of the peer | ||
737 | */ | ||
738 | static void | ||
739 | check_peer_live (struct PeerContext *peer_ctx) | ||
740 | { | ||
741 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
742 | "Get informed about peer %s getting live\n", | ||
743 | GNUNET_i2s (&peer_ctx->peer_id)); | ||
744 | |||
745 | struct GNUNET_MQ_Handle *mq; | ||
746 | struct GNUNET_MQ_Envelope *ev; | ||
747 | |||
748 | ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_RPS_PP_CHECK_LIVE); | ||
749 | peer_ctx->liveliness_check_pending = | ||
750 | insert_pending_message (&peer_ctx->peer_id, ev, "Check liveliness"); | ||
751 | mq = get_mq (&peer_ctx->peer_id); | ||
752 | GNUNET_MQ_notify_sent (ev, | ||
753 | mq_liveliness_check_successful, | ||
754 | peer_ctx); | ||
755 | GNUNET_MQ_send (mq, ev); | ||
756 | } | ||
757 | |||
758 | |||
759 | /** | ||
760 | * @brief Check whether function of type #PeerOp was already scheduled | 760 | * @brief Check whether function of type #PeerOp was already scheduled |
761 | * | 761 | * |
762 | * The array with pending operations will probably never grow really big, so | 762 | * The array with pending operations will probably never grow really big, so |
@@ -1256,6 +1256,13 @@ Peers_remove_peer (const struct GNUNET_PeerIdentity *peer) | |||
1256 | "Removing unsent %s\n", | 1256 | "Removing unsent %s\n", |
1257 | peer_ctx->pending_messages_head->type); | 1257 | peer_ctx->pending_messages_head->type); |
1258 | /* Cancle pending message, too */ | 1258 | /* Cancle pending message, too */ |
1259 | if ( (NULL != peer_ctx->liveliness_check_pending) && | ||
1260 | (0 == memcmp (peer_ctx->pending_messages_head, | ||
1261 | peer_ctx->liveliness_check_pending, | ||
1262 | sizeof (struct PendingMessage))) ) | ||
1263 | { | ||
1264 | peer_ctx->liveliness_check_pending = NULL; | ||
1265 | } | ||
1259 | remove_pending_message (peer_ctx->pending_messages_head, GNUNET_YES); | 1266 | remove_pending_message (peer_ctx->pending_messages_head, GNUNET_YES); |
1260 | } | 1267 | } |
1261 | /* If we are still waiting for notification whether this peer is live | 1268 | /* If we are still waiting for notification whether this peer is live |
@@ -1267,7 +1274,7 @@ Peers_remove_peer (const struct GNUNET_PeerIdentity *peer) | |||
1267 | GNUNET_i2s (&peer_ctx->peer_id)); | 1274 | GNUNET_i2s (&peer_ctx->peer_id)); |
1268 | // TODO wait until cadet sets mq->cancel_impl | 1275 | // TODO wait until cadet sets mq->cancel_impl |
1269 | //GNUNET_MQ_send_cancel (peer_ctx->liveliness_check_pending->ev); | 1276 | //GNUNET_MQ_send_cancel (peer_ctx->liveliness_check_pending->ev); |
1270 | GNUNET_free (peer_ctx->liveliness_check_pending); | 1277 | remove_pending_message (peer_ctx->liveliness_check_pending, GNUNET_YES); |
1271 | peer_ctx->liveliness_check_pending = NULL; | 1278 | peer_ctx->liveliness_check_pending = NULL; |
1272 | } | 1279 | } |
1273 | channel_flag = Peers_get_channel_flag (peer, Peers_CHANNEL_ROLE_SENDING); | 1280 | channel_flag = Peers_get_channel_flag (peer, Peers_CHANNEL_ROLE_SENDING); |
@@ -1659,10 +1666,11 @@ Peers_cleanup_destroyed_channel (void *cls, | |||
1659 | { | 1666 | { |
1660 | struct GNUNET_PeerIdentity *peer = cls; | 1667 | struct GNUNET_PeerIdentity *peer = cls; |
1661 | struct PeerContext *peer_ctx; | 1668 | struct PeerContext *peer_ctx; |
1669 | uint32_t *channel_flag; | ||
1662 | 1670 | ||
1663 | if (GNUNET_NO == Peers_check_peer_known (peer)) | 1671 | if (GNUNET_NO == Peers_check_peer_known (peer)) |
1664 | {/* We don't want to implicitly create a context that we're about to kill */ | 1672 | {/* We don't want to implicitly create a context that we're about to kill */ |
1665 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1673 | LOG (GNUNET_ERROR_TYPE_WARNING, |
1666 | "channel (%s) without associated context was destroyed\n", | 1674 | "channel (%s) without associated context was destroyed\n", |
1667 | GNUNET_i2s (peer)); | 1675 | GNUNET_i2s (peer)); |
1668 | return; | 1676 | return; |
@@ -1690,12 +1698,16 @@ Peers_cleanup_destroyed_channel (void *cls, | |||
1690 | if (NULL != peer_ctx->send_channel) | 1698 | if (NULL != peer_ctx->send_channel) |
1691 | { | 1699 | { |
1692 | GNUNET_CADET_channel_destroy (peer_ctx->send_channel); | 1700 | GNUNET_CADET_channel_destroy (peer_ctx->send_channel); |
1701 | channel_flag = Peers_get_channel_flag (&peer_ctx->peer_id, Peers_CHANNEL_ROLE_SENDING); | ||
1702 | Peers_set_channel_flag (channel_flag, Peers_CHANNEL_DESTROING); | ||
1693 | peer_ctx->send_channel = NULL; | 1703 | peer_ctx->send_channel = NULL; |
1694 | peer_ctx->mq = NULL; | 1704 | peer_ctx->mq = NULL; |
1695 | } | 1705 | } |
1696 | if (NULL != peer_ctx->recv_channel) | 1706 | if (NULL != peer_ctx->recv_channel) |
1697 | { | 1707 | { |
1698 | GNUNET_CADET_channel_destroy (peer_ctx->recv_channel); | 1708 | GNUNET_CADET_channel_destroy (peer_ctx->recv_channel); |
1709 | channel_flag = Peers_get_channel_flag (&peer_ctx->peer_id, Peers_CHANNEL_ROLE_RECEIVING); | ||
1710 | Peers_set_channel_flag (channel_flag, Peers_CHANNEL_DESTROING); | ||
1699 | peer_ctx->recv_channel = NULL; | 1711 | peer_ctx->recv_channel = NULL; |
1700 | } | 1712 | } |
1701 | /* Set the #Peers_ONLINE flag accordingly */ | 1713 | /* Set the #Peers_ONLINE flag accordingly */ |
@@ -2728,7 +2740,7 @@ cleanup_destroyed_channel (void *cls, | |||
2728 | return; | 2740 | return; |
2729 | } | 2741 | } |
2730 | else | 2742 | else |
2731 | { /* Other peer destroyed our sending channel that he is supposed to keep | 2743 | { /* Other peer destroyed our sending channel that it is supposed to keep |
2732 | * open. It probably went down. Remove it from our knowledge. */ | 2744 | * open. It probably went down. Remove it from our knowledge. */ |
2733 | Peers_cleanup_destroyed_channel (cls, channel); | 2745 | Peers_cleanup_destroyed_channel (cls, channel); |
2734 | remove_peer (peer); | 2746 | remove_peer (peer); |
@@ -2893,7 +2905,6 @@ client_respond (void *cls, | |||
2893 | GNUNET_memcpy (&out_msg[1], | 2905 | GNUNET_memcpy (&out_msg[1], |
2894 | peer_ids, | 2906 | peer_ids, |
2895 | num_peers * sizeof (struct GNUNET_PeerIdentity)); | 2907 | num_peers * sizeof (struct GNUNET_PeerIdentity)); |
2896 | GNUNET_free (peer_ids); | ||
2897 | 2908 | ||
2898 | cli_ctx = reply_cls->cli_ctx; | 2909 | cli_ctx = reply_cls->cli_ctx; |
2899 | GNUNET_assert (NULL != cli_ctx); | 2910 | GNUNET_assert (NULL != cli_ctx); |
@@ -3210,6 +3221,10 @@ handle_peer_push (void *cls, | |||
3210 | tmp_att_peer); | 3221 | tmp_att_peer); |
3211 | add_peer_array_to_set (peer, 1, att_peer_set); | 3222 | add_peer_array_to_set (peer, 1, att_peer_set); |
3212 | } | 3223 | } |
3224 | else | ||
3225 | { | ||
3226 | GNUNET_free (tmp_att_peer); | ||
3227 | } | ||
3213 | } | 3228 | } |
3214 | 3229 | ||
3215 | 3230 | ||
@@ -3588,6 +3603,7 @@ handle_client_act_malicious (void *cls, | |||
3588 | 3603 | ||
3589 | num_mal_peers_sent = ntohl (msg->num_peers) - 1; | 3604 | num_mal_peers_sent = ntohl (msg->num_peers) - 1; |
3590 | num_mal_peers_old = num_mal_peers; | 3605 | num_mal_peers_old = num_mal_peers; |
3606 | GNUNET_assert (GNUNET_MAX_MALLOC_CHECKED > num_mal_peers_sent); | ||
3591 | GNUNET_array_grow (mal_peers, | 3607 | GNUNET_array_grow (mal_peers, |
3592 | num_mal_peers, | 3608 | num_mal_peers, |
3593 | num_mal_peers + num_mal_peers_sent); | 3609 | num_mal_peers + num_mal_peers_sent); |
@@ -4172,6 +4188,7 @@ shutdown_task (void *cls) | |||
4172 | { | 4188 | { |
4173 | tmp_att_peer = att_peers_head; | 4189 | tmp_att_peer = att_peers_head; |
4174 | GNUNET_CONTAINER_DLL_remove (att_peers_head, att_peers_tail, tmp_att_peer); | 4190 | GNUNET_CONTAINER_DLL_remove (att_peers_head, att_peers_tail, tmp_att_peer); |
4191 | GNUNET_free (tmp_att_peer); | ||
4175 | } | 4192 | } |
4176 | #endif /* ENABLE_MALICIOUS */ | 4193 | #endif /* ENABLE_MALICIOUS */ |
4177 | } | 4194 | } |
diff --git a/src/rps/gnunet-service-rps_custommap.c b/src/rps/gnunet-service-rps_custommap.c index 90177cb94..42507655b 100644 --- a/src/rps/gnunet-service-rps_custommap.c +++ b/src/rps/gnunet-service-rps_custommap.c | |||
@@ -220,6 +220,7 @@ CustomPeerMap_remove_peer (const struct CustomPeerMap *c_peer_map, | |||
220 | GNUNET_free (index); | 220 | GNUNET_free (index); |
221 | GNUNET_assert (GNUNET_CONTAINER_multihashmap32_size (c_peer_map->hash_map) == | 221 | GNUNET_assert (GNUNET_CONTAINER_multihashmap32_size (c_peer_map->hash_map) == |
222 | GNUNET_CONTAINER_multipeermap_size (c_peer_map->peer_map)); | 222 | GNUNET_CONTAINER_multipeermap_size (c_peer_map->peer_map)); |
223 | GNUNET_free (p); | ||
223 | return GNUNET_OK; | 224 | return GNUNET_OK; |
224 | } | 225 | } |
225 | 226 | ||
diff --git a/src/rps/gnunet-service-rps_sampler.c b/src/rps/gnunet-service-rps_sampler.c index 711d5be63..4d1ae4650 100644 --- a/src/rps/gnunet-service-rps_sampler.c +++ b/src/rps/gnunet-service-rps_sampler.c | |||
@@ -725,6 +725,7 @@ RPS_sampler_request_cancel (struct RPS_SamplerRequestHandle *req_handle) | |||
725 | } | 725 | } |
726 | GNUNET_free (i); | 726 | GNUNET_free (i); |
727 | } | 727 | } |
728 | GNUNET_free (req_handle->ids); | ||
728 | GNUNET_CONTAINER_DLL_remove (req_handle->sampler->req_handle_head, | 729 | GNUNET_CONTAINER_DLL_remove (req_handle->sampler->req_handle_head, |
729 | req_handle->sampler->req_handle_tail, | 730 | req_handle->sampler->req_handle_tail, |
730 | req_handle); | 731 | req_handle); |
diff --git a/src/rps/rps-test_util.c b/src/rps/rps-test_util.c index 9a1dfe0d8..d47e4952f 100644 --- a/src/rps/rps-test_util.c +++ b/src/rps/rps-test_util.c | |||
@@ -155,6 +155,9 @@ to_file_raw (const char *file_name, const char *buf, size_t size_buf) | |||
155 | 155 | ||
156 | return; | 156 | return; |
157 | } | 157 | } |
158 | if (GNUNET_YES != GNUNET_DISK_file_close (f)) | ||
159 | LOG (GNUNET_ERROR_TYPE_WARNING, | ||
160 | "Unable to close file\n"); | ||
158 | } | 161 | } |
159 | 162 | ||
160 | void | 163 | void |
@@ -349,10 +352,10 @@ create_file (const char *name) | |||
349 | if (NULL == strstr (name, "sampler_el")) | 352 | if (NULL == strstr (name, "sampler_el")) |
350 | {/* only append random string to sampler */ | 353 | {/* only append random string to sampler */ |
351 | if (NULL == (file_name = GNUNET_DISK_mktemp (name_buf))) | 354 | if (NULL == (file_name = GNUNET_DISK_mktemp (name_buf))) |
352 | LOG (GNUNET_ERROR_TYPE_WARNING, "Could not create file\n"); | 355 | LOG (GNUNET_ERROR_TYPE_WARNING, "Could not create file\n"); |
353 | 356 | ||
354 | GNUNET_free (name_buf); | 357 | GNUNET_free (name_buf); |
355 | return file_name; | 358 | return file_name; |
356 | } | 359 | } |
357 | 360 | ||
358 | return name_buf; | 361 | return name_buf; |
@@ -384,7 +387,7 @@ store_prefix_file_name (const struct GNUNET_PeerIdentity *peer, | |||
384 | const char *prefix) | 387 | const char *prefix) |
385 | { | 388 | { |
386 | unsigned int len_file_name; | 389 | unsigned int len_file_name; |
387 | unsigned int out_size; | 390 | int out_size; |
388 | char *file_name; | 391 | char *file_name; |
389 | const char *pid_long; | 392 | const char *pid_long; |
390 | 393 | ||
diff --git a/src/rps/test_rps.c b/src/rps/test_rps.c index 3ef1e6611..08424022f 100644 --- a/src/rps/test_rps.c +++ b/src/rps/test_rps.c | |||
@@ -841,6 +841,13 @@ seed_peers (void *cls) | |||
841 | unsigned int amount; | 841 | unsigned int amount; |
842 | unsigned int i; | 842 | unsigned int i; |
843 | 843 | ||
844 | if (GNUNET_YES == in_shutdown || GNUNET_YES == post_test) | ||
845 | { | ||
846 | return; | ||
847 | } | ||
848 | |||
849 | GNUNET_assert (NULL != peer->rps_handle); | ||
850 | |||
844 | // TODO if malicious don't seed mal peers | 851 | // TODO if malicious don't seed mal peers |
845 | amount = round (.5 * num_peers); | 852 | amount = round (.5 * num_peers); |
846 | 853 | ||
@@ -953,6 +960,8 @@ rps_connect_complete_cb (void *cls, | |||
953 | struct RPSPeer *rps_peer = cls; | 960 | struct RPSPeer *rps_peer = cls; |
954 | struct GNUNET_RPS_Handle *rps = ca_result; | 961 | struct GNUNET_RPS_Handle *rps = ca_result; |
955 | 962 | ||
963 | GNUNET_assert (NULL != ca_result); | ||
964 | |||
956 | if (GNUNET_YES == in_shutdown || GNUNET_YES == post_test) | 965 | if (GNUNET_YES == in_shutdown || GNUNET_YES == post_test) |
957 | { | 966 | { |
958 | return; | 967 | return; |
@@ -996,9 +1005,11 @@ rps_connect_adapter (void *cls, | |||
996 | struct GNUNET_RPS_Handle *h; | 1005 | struct GNUNET_RPS_Handle *h; |
997 | 1006 | ||
998 | h = GNUNET_RPS_connect (cfg); | 1007 | h = GNUNET_RPS_connect (cfg); |
1008 | GNUNET_assert (NULL != h); | ||
999 | 1009 | ||
1000 | if (NULL != cur_test_run.pre_test) | 1010 | if (NULL != cur_test_run.pre_test) |
1001 | cur_test_run.pre_test (cls, h); | 1011 | cur_test_run.pre_test (cls, h); |
1012 | GNUNET_assert (NULL != h); | ||
1002 | 1013 | ||
1003 | return h; | 1014 | return h; |
1004 | } | 1015 | } |
@@ -2905,6 +2916,7 @@ main (int argc, char *argv[]) | |||
2905 | } | 2916 | } |
2906 | 2917 | ||
2907 | ret_value = cur_test_run.eval_cb(); | 2918 | ret_value = cur_test_run.eval_cb(); |
2919 | |||
2908 | if (NO_COLLECT_VIEW == cur_test_run.have_collect_view) | 2920 | if (NO_COLLECT_VIEW == cur_test_run.have_collect_view) |
2909 | { | 2921 | { |
2910 | GNUNET_array_grow (rps_peers->cur_view, | 2922 | GNUNET_array_grow (rps_peers->cur_view, |
diff --git a/src/secretsharing/gnunet-service-secretsharing.c b/src/secretsharing/gnunet-service-secretsharing.c index 505af0fba..1f565cfeb 100644 --- a/src/secretsharing/gnunet-service-secretsharing.c +++ b/src/secretsharing/gnunet-service-secretsharing.c | |||
@@ -51,7 +51,7 @@ struct KeygenPeerInfo | |||
51 | struct GNUNET_CRYPTO_PaillierPublicKey paillier_public_key; | 51 | struct GNUNET_CRYPTO_PaillierPublicKey paillier_public_key; |
52 | 52 | ||
53 | /** | 53 | /** |
54 | * The peer's commitment to his presecret. | 54 | * The peer's commitment to its presecret. |
55 | */ | 55 | */ |
56 | gcry_mpi_t presecret_commitment; | 56 | gcry_mpi_t presecret_commitment; |
57 | 57 | ||
diff --git a/src/secretsharing/secretsharing_api.c b/src/secretsharing/secretsharing_api.c index cfb13f520..2a828f08d 100644 --- a/src/secretsharing/secretsharing_api.c +++ b/src/secretsharing/secretsharing_api.c | |||
@@ -314,7 +314,7 @@ handle_decrypt_done (void *cls, | |||
314 | * published the same value, it will be decrypted. | 314 | * published the same value, it will be decrypted. |
315 | * | 315 | * |
316 | * When the operation is canceled, the decrypt_cb is not called anymore, but the calling | 316 | * When the operation is canceled, the decrypt_cb is not called anymore, but the calling |
317 | * peer may already have irrevocably contributed his share for the decryption of the value. | 317 | * peer may already have irrevocably contributed its share for the decryption of the value. |
318 | * | 318 | * |
319 | * @param share our secret share to use for decryption | 319 | * @param share our secret share to use for decryption |
320 | * @param ciphertext ciphertext to publish in order to decrypt it (if enough peers agree) | 320 | * @param ciphertext ciphertext to publish in order to decrypt it (if enough peers agree) |
@@ -485,7 +485,7 @@ GNUNET_SECRETSHARING_encrypt (const struct GNUNET_SECRETSHARING_PublicKey *publi | |||
485 | * Cancel a decryption. | 485 | * Cancel a decryption. |
486 | * | 486 | * |
487 | * The decrypt_cb is not called anymore, but the calling | 487 | * The decrypt_cb is not called anymore, but the calling |
488 | * peer may already have irrevocably contributed his share for the decryption of the value. | 488 | * peer may already have irrevocably contributed its share for the decryption of the value. |
489 | * | 489 | * |
490 | * @param dh to cancel | 490 | * @param dh to cancel |
491 | */ | 491 | */ |
diff --git a/src/secretsharing/secretsharing_protocol.h b/src/secretsharing/secretsharing_protocol.h index 7627deb30..da1454ec0 100644 --- a/src/secretsharing/secretsharing_protocol.h +++ b/src/secretsharing/secretsharing_protocol.h | |||
@@ -58,7 +58,7 @@ struct GNUNET_SECRETSHARING_KeygenCommitData | |||
58 | */ | 58 | */ |
59 | struct GNUNET_CRYPTO_PaillierPublicKey pubkey; | 59 | struct GNUNET_CRYPTO_PaillierPublicKey pubkey; |
60 | /** | 60 | /** |
61 | * Commitment of 'peer' to his presecret. | 61 | * Commitment of 'peer' to its presecret. |
62 | */ | 62 | */ |
63 | struct GNUNET_HashCode commitment GNUNET_PACKED; | 63 | struct GNUNET_HashCode commitment GNUNET_PACKED; |
64 | }; | 64 | }; |
diff --git a/src/set/gnunet-service-set.h b/src/set/gnunet-service-set.h index c9e59b441..f7c262eac 100644 --- a/src/set/gnunet-service-set.h +++ b/src/set/gnunet-service-set.h | |||
@@ -125,7 +125,7 @@ typedef struct OperationState * | |||
125 | * @param op operation that is created, should be initialized to | 125 | * @param op operation that is created, should be initialized to |
126 | * begin the evaluation | 126 | * begin the evaluation |
127 | * @param opaque_context message to be transmitted to the listener | 127 | * @param opaque_context message to be transmitted to the listener |
128 | * to convince him to accept, may be NULL | 128 | * to convince it to accept, may be NULL |
129 | * @return operation-specific state to keep in @a op | 129 | * @return operation-specific state to keep in @a op |
130 | */ | 130 | */ |
131 | typedef struct OperationState * | 131 | typedef struct OperationState * |
diff --git a/src/set/gnunet-service-set_intersection.c b/src/set/gnunet-service-set_intersection.c index 0561df406..1083384f5 100644 --- a/src/set/gnunet-service-set_intersection.c +++ b/src/set/gnunet-service-set_intersection.c | |||
@@ -11,7 +11,7 @@ | |||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | */ | 17 | */ |
@@ -23,6 +23,7 @@ | |||
23 | */ | 23 | */ |
24 | #include "platform.h" | 24 | #include "platform.h" |
25 | #include "gnunet_util_lib.h" | 25 | #include "gnunet_util_lib.h" |
26 | #include "gnunet_statistics_service.h" | ||
26 | #include "gnunet-service-set.h" | 27 | #include "gnunet-service-set.h" |
27 | #include "gnunet_block_lib.h" | 28 | #include "gnunet_block_lib.h" |
28 | #include "gnunet-service-set_protocol.h" | 29 | #include "gnunet-service-set_protocol.h" |
@@ -215,6 +216,10 @@ send_client_removed_element (struct Operation *op, | |||
215 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 216 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
216 | "Sending removed element (size %u) to client\n", | 217 | "Sending removed element (size %u) to client\n", |
217 | element->size); | 218 | element->size); |
219 | GNUNET_STATISTICS_update (_GSS_statistics, | ||
220 | "# Element removed messages sent", | ||
221 | 1, | ||
222 | GNUNET_NO); | ||
218 | GNUNET_assert (0 != op->client_request_id); | 223 | GNUNET_assert (0 != op->client_request_id); |
219 | ev = GNUNET_MQ_msg_extra (rm, | 224 | ev = GNUNET_MQ_msg_extra (rm, |
220 | element->size, | 225 | element->size, |
@@ -406,6 +411,10 @@ fail_intersection_operation (struct Operation *op) | |||
406 | 411 | ||
407 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 412 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
408 | "Intersection operation failed\n"); | 413 | "Intersection operation failed\n"); |
414 | GNUNET_STATISTICS_update (_GSS_statistics, | ||
415 | "# Intersection operations failed", | ||
416 | 1, | ||
417 | GNUNET_NO); | ||
409 | if (NULL != op->state->my_elements) | 418 | if (NULL != op->state->my_elements) |
410 | { | 419 | { |
411 | GNUNET_CONTAINER_multihashmap_destroy (op->state->my_elements); | 420 | GNUNET_CONTAINER_multihashmap_destroy (op->state->my_elements); |
@@ -466,6 +475,10 @@ send_bloomfilter (struct Operation *op) | |||
466 | op); | 475 | op); |
467 | 476 | ||
468 | /* send our Bloom filter */ | 477 | /* send our Bloom filter */ |
478 | GNUNET_STATISTICS_update (_GSS_statistics, | ||
479 | "# Intersection Bloom filters sent", | ||
480 | 1, | ||
481 | GNUNET_NO); | ||
469 | chunk_size = 60 * 1024 - sizeof (struct BFMessage); | 482 | chunk_size = 60 * 1024 - sizeof (struct BFMessage); |
470 | if (bf_size <= chunk_size) | 483 | if (bf_size <= chunk_size) |
471 | { | 484 | { |
@@ -534,6 +547,10 @@ send_client_done_and_destroy (void *cls) | |||
534 | 547 | ||
535 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 548 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
536 | "Intersection succeeded, sending DONE to local client\n"); | 549 | "Intersection succeeded, sending DONE to local client\n"); |
550 | GNUNET_STATISTICS_update (_GSS_statistics, | ||
551 | "# Intersection operations succeeded", | ||
552 | 1, | ||
553 | GNUNET_NO); | ||
537 | ev = GNUNET_MQ_msg (rm, | 554 | ev = GNUNET_MQ_msg (rm, |
538 | GNUNET_MESSAGE_TYPE_SET_RESULT); | 555 | GNUNET_MESSAGE_TYPE_SET_RESULT); |
539 | rm->request_id = htonl (op->client_request_id); | 556 | rm->request_id = htonl (op->client_request_id); |
@@ -695,7 +712,7 @@ initialize_map_unfiltered (void *cls, | |||
695 | 712 | ||
696 | /** | 713 | /** |
697 | * Send our element count to the peer, in case our element count is | 714 | * Send our element count to the peer, in case our element count is |
698 | * lower than his. | 715 | * lower than theirs. |
699 | * | 716 | * |
700 | * @param op intersection operation | 717 | * @param op intersection operation |
701 | */ | 718 | */ |
@@ -1077,7 +1094,7 @@ handle_intersection_p2p_done (void *cls, | |||
1077 | * @param op operation that is created, should be initialized to | 1094 | * @param op operation that is created, should be initialized to |
1078 | * begin the evaluation | 1095 | * begin the evaluation |
1079 | * @param opaque_context message to be transmitted to the listener | 1096 | * @param opaque_context message to be transmitted to the listener |
1080 | * to convince him to accept, may be NULL | 1097 | * to convince it to accept, may be NULL |
1081 | * @return operation-specific state to keep in @a op | 1098 | * @return operation-specific state to keep in @a op |
1082 | */ | 1099 | */ |
1083 | static struct OperationState * | 1100 | static struct OperationState * |
diff --git a/src/set/gnunet-service-set_union.c b/src/set/gnunet-service-set_union.c index 7af220374..c1268948a 100644 --- a/src/set/gnunet-service-set_union.c +++ b/src/set/gnunet-service-set_union.c | |||
@@ -11,7 +11,7 @@ | |||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | */ | 17 | */ |
@@ -758,8 +758,8 @@ get_order_from_difference (unsigned int diff) | |||
758 | */ | 758 | */ |
759 | static int | 759 | static int |
760 | send_full_element_iterator (void *cls, | 760 | send_full_element_iterator (void *cls, |
761 | const struct GNUNET_HashCode *key, | 761 | const struct GNUNET_HashCode *key, |
762 | void *value) | 762 | void *value) |
763 | { | 763 | { |
764 | struct Operation *op = cls; | 764 | struct Operation *op = cls; |
765 | struct GNUNET_SET_ElementMessage *emsg; | 765 | struct GNUNET_SET_ElementMessage *emsg; |
@@ -1371,7 +1371,8 @@ send_client_element (struct Operation *op, | |||
1371 | * | 1371 | * |
1372 | * @param op operation | 1372 | * @param op operation |
1373 | */ | 1373 | */ |
1374 | void destroy_channel (struct Operation *op) | 1374 | static void |
1375 | destroy_channel (struct Operation *op) | ||
1375 | { | 1376 | { |
1376 | struct GNUNET_CADET_Channel *channel; | 1377 | struct GNUNET_CADET_Channel *channel; |
1377 | 1378 | ||
@@ -1404,7 +1405,11 @@ send_client_done (void *cls) | |||
1404 | 1405 | ||
1405 | if (PHASE_DONE != op->state->phase) { | 1406 | if (PHASE_DONE != op->state->phase) { |
1406 | LOG (GNUNET_ERROR_TYPE_WARNING, | 1407 | LOG (GNUNET_ERROR_TYPE_WARNING, |
1407 | "union operation failed\n"); | 1408 | "Union operation failed\n"); |
1409 | GNUNET_STATISTICS_update (_GSS_statistics, | ||
1410 | "# Union operations failed", | ||
1411 | 1, | ||
1412 | GNUNET_NO); | ||
1408 | ev = GNUNET_MQ_msg (rm, GNUNET_MESSAGE_TYPE_SET_RESULT); | 1413 | ev = GNUNET_MQ_msg (rm, GNUNET_MESSAGE_TYPE_SET_RESULT); |
1409 | rm->result_status = htons (GNUNET_SET_STATUS_FAILURE); | 1414 | rm->result_status = htons (GNUNET_SET_STATUS_FAILURE); |
1410 | rm->request_id = htonl (op->client_request_id); | 1415 | rm->request_id = htonl (op->client_request_id); |
@@ -1416,6 +1421,10 @@ send_client_done (void *cls) | |||
1416 | 1421 | ||
1417 | op->state->client_done_sent = GNUNET_YES; | 1422 | op->state->client_done_sent = GNUNET_YES; |
1418 | 1423 | ||
1424 | GNUNET_STATISTICS_update (_GSS_statistics, | ||
1425 | "# Union operations succeeded", | ||
1426 | 1, | ||
1427 | GNUNET_NO); | ||
1419 | LOG (GNUNET_ERROR_TYPE_INFO, | 1428 | LOG (GNUNET_ERROR_TYPE_INFO, |
1420 | "Signalling client that union operation is done\n"); | 1429 | "Signalling client that union operation is done\n"); |
1421 | ev = GNUNET_MQ_msg (rm, | 1430 | ev = GNUNET_MQ_msg (rm, |
@@ -2149,7 +2158,7 @@ handle_union_p2p_done (void *cls, | |||
2149 | * | 2158 | * |
2150 | * We should notify the active peer once | 2159 | * We should notify the active peer once |
2151 | * all our demands are satisfied, so that the active | 2160 | * all our demands are satisfied, so that the active |
2152 | * peer can quit if we gave him everything. | 2161 | * peer can quit if we gave it everything. |
2153 | */ | 2162 | */ |
2154 | GNUNET_CADET_receive_done (op->channel); | 2163 | GNUNET_CADET_receive_done (op->channel); |
2155 | maybe_finish (op); | 2164 | maybe_finish (op); |
@@ -2194,7 +2203,7 @@ handle_union_p2p_over (void *cls, | |||
2194 | * | 2203 | * |
2195 | * @param op operation to perform (to be initialized) | 2204 | * @param op operation to perform (to be initialized) |
2196 | * @param opaque_context message to be transmitted to the listener | 2205 | * @param opaque_context message to be transmitted to the listener |
2197 | * to convince him to accept, may be NULL | 2206 | * to convince it to accept, may be NULL |
2198 | */ | 2207 | */ |
2199 | static struct OperationState * | 2208 | static struct OperationState * |
2200 | union_evaluate (struct Operation *op, | 2209 | union_evaluate (struct Operation *op, |
diff --git a/src/template/template.conf b/src/template/template.conf index e5f675a5d..24b123390 100644 --- a/src/template/template.conf +++ b/src/template/template.conf | |||
@@ -1,6 +1,10 @@ | |||
1 | [template] | 1 | [template] |
2 | START_ON_DEMAND = NO | 2 | START_ON_DEMAND = NO |
3 | PORT = 9999 | 3 | # for tests please come up with numbers that are |
4 | # unlikely to be in use by anyone. we typically | ||
5 | # use five digit numbers < 65536 with no "beauty" | ||
6 | # (no repetitions, no sequences, no popularity). | ||
7 | PORT = 99999 | ||
4 | HOSTNAME = localhost | 8 | HOSTNAME = localhost |
5 | BINARY = gnunet-service-template | 9 | BINARY = gnunet-service-template |
6 | ACCEPT_FROM = 127.0.0.1; | 10 | ACCEPT_FROM = 127.0.0.1; |
diff --git a/src/testbed/test_testbed_api_statistics.conf b/src/testbed/test_testbed_api_statistics.conf index 50d3f2c04..edb2e2057 100644 --- a/src/testbed/test_testbed_api_statistics.conf +++ b/src/testbed/test_testbed_api_statistics.conf | |||
@@ -6,4 +6,4 @@ MAX_PARALLEL_SERVICE_CONNECTIONS = 2 | |||
6 | 6 | ||
7 | [statistics] | 7 | [statistics] |
8 | START_ON_DEMAND = YES | 8 | START_ON_DEMAND = YES |
9 | PORT = 30 | 9 | PORT = 59530 |
diff --git a/src/testing/test_testing_sharedservices.conf b/src/testing/test_testing_sharedservices.conf index e41e2863c..24ce1b358 100644 --- a/src/testing/test_testing_sharedservices.conf +++ b/src/testing/test_testing_sharedservices.conf | |||
@@ -2,7 +2,7 @@ | |||
2 | GNUNET_TEST_HOME = $GNUNET_TMP/test-gnunet-testing/ | 2 | GNUNET_TEST_HOME = $GNUNET_TMP/test-gnunet-testing/ |
3 | 3 | ||
4 | [testbed-logger] | 4 | [testbed-logger] |
5 | PORT = 15000 | 5 | PORT = 59132 |
6 | UNIXPATH = $GNUNET_RUNTIME_DIR/testbed-logger.sock | 6 | UNIXPATH = $GNUNET_RUNTIME_DIR/testbed-logger.sock |
7 | DIR = $GNUNET_TMP/testbed-logger | 7 | DIR = $GNUNET_TMP/testbed-logger |
8 | 8 | ||
diff --git a/src/topology/Makefile.am b/src/topology/Makefile.am index 97e4652d0..ae69ee8bc 100644 --- a/src/topology/Makefile.am +++ b/src/topology/Makefile.am | |||
@@ -56,6 +56,7 @@ test_gnunet_daemon_topology_SOURCES = \ | |||
56 | test_gnunet_daemon_topology.c | 56 | test_gnunet_daemon_topology.c |
57 | test_gnunet_daemon_topology_LDADD = \ | 57 | test_gnunet_daemon_topology_LDADD = \ |
58 | $(top_builddir)/src/testbed/libgnunettestbed.la \ | 58 | $(top_builddir)/src/testbed/libgnunettestbed.la \ |
59 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ | ||
59 | $(top_builddir)/src/util/libgnunetutil.la | 60 | $(top_builddir)/src/util/libgnunetutil.la |
60 | 61 | ||
61 | EXTRA_DIST = \ | 62 | EXTRA_DIST = \ |
diff --git a/src/topology/gnunet-daemon-topology.c b/src/topology/gnunet-daemon-topology.c index 829fb5352..f7a4e4525 100644 --- a/src/topology/gnunet-daemon-topology.c +++ b/src/topology/gnunet-daemon-topology.c | |||
@@ -111,7 +111,7 @@ struct Peer | |||
111 | uint32_t strength; | 111 | uint32_t strength; |
112 | 112 | ||
113 | /** | 113 | /** |
114 | * Is this peer listed here because he is a friend? | 114 | * Is this peer listed here because it is a friend? |
115 | */ | 115 | */ |
116 | int is_friend; | 116 | int is_friend; |
117 | 117 | ||
diff --git a/src/topology/test_gnunet_daemon_topology.c b/src/topology/test_gnunet_daemon_topology.c index 7c75d1137..5359c280e 100644 --- a/src/topology/test_gnunet_daemon_topology.c +++ b/src/topology/test_gnunet_daemon_topology.c | |||
@@ -11,54 +11,209 @@ | |||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | */ | 17 | */ |
18 | /** | 18 | /** |
19 | * @file topology/test_gnunet_daemon_topology.c | 19 | * @file topology/test_gnunet_daemon_topology.c |
20 | * @brief testcase for topology maintenance code | 20 | * @brief testcase for topology maintenance code |
21 | * @author Christian Grothoff | ||
22 | * @author xrs | ||
21 | */ | 23 | */ |
22 | #include "platform.h" | 24 | #include "platform.h" |
23 | #include "gnunet_testbed_service.h" | 25 | #include "gnunet_testbed_service.h" |
26 | #include "gnunet_statistics_service.h" | ||
24 | 27 | ||
25 | 28 | ||
26 | #define NUM_PEERS 8 | 29 | #define NUM_PEERS 8 |
27 | 30 | ||
31 | /* | ||
32 | * The threshold defines the number of connection that are needed | ||
33 | * for one peer to pass the test. Be aware that setting NUM_PEERS | ||
34 | * too high can cause bandwidth problems for the testing peers. | ||
35 | * Normal should be 5KB/s per peer. See gnunet-config -s ats. | ||
36 | */ | ||
37 | #define THRESHOLD NUM_PEERS/2 | ||
38 | |||
28 | /** | 39 | /** |
29 | * How long until we give up on connecting the peers? | 40 | * How long until we give up on connecting the peers? |
30 | */ | 41 | */ |
31 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 600) | 42 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60) |
32 | 43 | ||
44 | /* | ||
45 | * Store manual connections. | ||
46 | */ | ||
47 | static unsigned int connect_left; | ||
33 | 48 | ||
34 | static int ok; | 49 | /* |
50 | * Result of the testcase. | ||
51 | */ | ||
52 | static int result; | ||
35 | 53 | ||
36 | static unsigned int connect_left; | 54 | /* |
55 | * Peers that reached the threshold of connections. | ||
56 | */ | ||
57 | static int checked_peers; | ||
58 | |||
59 | /* | ||
60 | * Testbed operations. | ||
61 | */ | ||
62 | struct GNUNET_TESTBED_Operation *op[NUM_PEERS]; | ||
63 | |||
64 | /* | ||
65 | * Timeout for testcase. | ||
66 | */ | ||
67 | static struct GNUNET_SCHEDULER_Task *timeout_tid; | ||
68 | |||
69 | /* | ||
70 | * Peer context for every testbed peer. | ||
71 | */ | ||
72 | struct peerctx | ||
73 | { | ||
74 | int index; | ||
75 | struct GNUNET_STATISTICS_Handle *statistics; | ||
76 | int connections; | ||
77 | int reported; /* GNUNET_NO | GNUNET_YES */ | ||
78 | }; | ||
79 | |||
80 | |||
81 | static void | ||
82 | shutdown_task (void *cls) | ||
83 | { | ||
84 | unsigned int i; | ||
85 | |||
86 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
87 | "Shutting down testcase\n"); | ||
88 | |||
89 | for (i=0;i<NUM_PEERS;i++) { | ||
90 | if (NULL != op[i]) | ||
91 | GNUNET_TESTBED_operation_done (op[i]); | ||
92 | } | ||
93 | |||
94 | if (NULL != timeout_tid) | ||
95 | GNUNET_SCHEDULER_cancel (timeout_tid); | ||
96 | } | ||
97 | |||
98 | static void | ||
99 | timeout_task (void *cls) | ||
100 | { | ||
101 | timeout_tid = NULL; | ||
102 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
103 | "Testcase timeout\n"); | ||
104 | |||
105 | result = GNUNET_SYSERR; | ||
106 | GNUNET_SCHEDULER_shutdown(); | ||
107 | } | ||
108 | |||
109 | /* | ||
110 | * The function is called every time the topology of connected | ||
111 | * peers to a peer changes. | ||
112 | */ | ||
113 | int | ||
114 | statistics_iterator (void *cls, | ||
115 | const char *subsystem, | ||
116 | const char *name, | ||
117 | uint64_t value, | ||
118 | int is_persistent) | ||
119 | { | ||
120 | struct peerctx *p_ctx = (struct peerctx*) cls; | ||
121 | |||
122 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
123 | "Peer %d: %s = %llu\n", | ||
124 | p_ctx->index, | ||
125 | name, | ||
126 | (unsigned long long) value); | ||
127 | |||
128 | if (p_ctx->connections < value) | ||
129 | p_ctx->connections = value; | ||
130 | |||
131 | if (THRESHOLD <= value && GNUNET_NO == p_ctx->reported) { | ||
132 | p_ctx->reported = GNUNET_YES; | ||
133 | checked_peers++; | ||
134 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, | ||
135 | "Peer %d successfully connected to at least %d peers once.\n", | ||
136 | p_ctx->index, | ||
137 | THRESHOLD); | ||
138 | |||
139 | if (checked_peers == NUM_PEERS) { | ||
140 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, | ||
141 | "Test OK: All peers have connected to %d peers once.\n", | ||
142 | THRESHOLD); | ||
143 | result = GNUNET_YES; | ||
144 | GNUNET_SCHEDULER_shutdown(); | ||
145 | } | ||
146 | } | ||
147 | |||
148 | return GNUNET_YES; | ||
149 | } | ||
150 | |||
151 | static void * | ||
152 | ca_statistics (void *cls, | ||
153 | const struct GNUNET_CONFIGURATION_Handle *cfg) | ||
154 | { | ||
155 | return GNUNET_STATISTICS_create ("topology", cfg); | ||
156 | } | ||
157 | |||
158 | |||
159 | void | ||
160 | da_statistics (void *cls, | ||
161 | void *op_result) | ||
162 | { | ||
163 | struct peerctx *p_ctx = (struct peerctx *) cls; | ||
164 | |||
165 | GNUNET_break (GNUNET_OK == GNUNET_STATISTICS_watch_cancel | ||
166 | (p_ctx->statistics, "topology", "# peers connected", | ||
167 | statistics_iterator, p_ctx)); | ||
168 | |||
169 | GNUNET_STATISTICS_destroy (p_ctx->statistics, GNUNET_NO); | ||
170 | p_ctx->statistics = NULL; | ||
171 | |||
172 | GNUNET_free (p_ctx); | ||
173 | } | ||
37 | 174 | ||
38 | 175 | ||
39 | static void | 176 | static void |
177 | service_connect_complete (void *cls, | ||
178 | struct GNUNET_TESTBED_Operation *op, | ||
179 | void *ca_result, | ||
180 | const char *emsg) | ||
181 | { | ||
182 | int ret; | ||
183 | struct peerctx *p_ctx = (struct peerctx*) cls; | ||
184 | |||
185 | if (NULL == ca_result) | ||
186 | GNUNET_SCHEDULER_shutdown(); | ||
187 | |||
188 | p_ctx->statistics = ca_result; | ||
189 | |||
190 | ret = GNUNET_STATISTICS_watch (ca_result, | ||
191 | "topology", | ||
192 | "# peers connected", | ||
193 | statistics_iterator, | ||
194 | p_ctx); | ||
195 | |||
196 | if (GNUNET_NO == ret) | ||
197 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
198 | "call to GNUNET_STATISTICS_watch() failed\n"); | ||
199 | } | ||
200 | |||
201 | static void | ||
40 | notify_connect_complete (void *cls, | 202 | notify_connect_complete (void *cls, |
41 | struct GNUNET_TESTBED_Operation *op, | 203 | struct GNUNET_TESTBED_Operation *op, |
42 | const char *emsg) | 204 | const char *emsg) |
43 | { | 205 | { |
44 | GNUNET_TESTBED_operation_done (op); | 206 | GNUNET_TESTBED_operation_done (op); |
45 | if (NULL != emsg) | 207 | if (NULL != emsg) |
46 | { | 208 | { |
47 | FPRINTF (stderr, "Failed to connect two peers: %s\n", emsg); | 209 | FPRINTF (stderr, "Failed to connect two peers: %s\n", emsg); |
210 | result = GNUNET_SYSERR; | ||
48 | GNUNET_SCHEDULER_shutdown (); | 211 | GNUNET_SCHEDULER_shutdown (); |
49 | ok = 1; | ||
50 | return; | 212 | return; |
51 | } | 213 | } |
52 | connect_left--; | 214 | connect_left--; |
53 | if (0 == connect_left) | ||
54 | { | ||
55 | /* FIXME: check that topology adds a few more links | ||
56 | * in addition to those that were seeded */ | ||
57 | GNUNET_SCHEDULER_shutdown (); | ||
58 | } | ||
59 | } | 215 | } |
60 | 216 | ||
61 | |||
62 | static void | 217 | static void |
63 | do_connect (void *cls, | 218 | do_connect (void *cls, |
64 | struct GNUNET_TESTBED_RunHandle *h, | 219 | struct GNUNET_TESTBED_RunHandle *h, |
@@ -68,28 +223,62 @@ do_connect (void *cls, | |||
68 | unsigned int links_failed) | 223 | unsigned int links_failed) |
69 | { | 224 | { |
70 | unsigned int i; | 225 | unsigned int i; |
226 | struct peerctx *p_ctx; | ||
227 | |||
228 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
229 | "Threshold is set to %d.\n", | ||
230 | THRESHOLD); | ||
71 | 231 | ||
72 | GNUNET_assert (NUM_PEERS == num_peers); | 232 | GNUNET_assert (NUM_PEERS == num_peers); |
73 | for (i=0;i<num_peers-1;i++) | 233 | |
234 | for (i=0;i<NUM_PEERS;i++) | ||
74 | { | 235 | { |
75 | connect_left++; | 236 | p_ctx = GNUNET_new (struct peerctx); |
76 | GNUNET_TESTBED_overlay_connect (NULL, | 237 | p_ctx->index = i; |
77 | ¬ify_connect_complete, NULL, | 238 | p_ctx->connections = 0; |
78 | peers[i], peers[i+1]); | 239 | p_ctx->reported = GNUNET_NO; |
240 | |||
241 | if (i<NUM_PEERS-1) { | ||
242 | connect_left++; | ||
243 | GNUNET_TESTBED_overlay_connect (NULL, | ||
244 | ¬ify_connect_complete, NULL, | ||
245 | peers[i], peers[i+1]); | ||
246 | } | ||
247 | |||
248 | op[i] = | ||
249 | GNUNET_TESTBED_service_connect (cls, | ||
250 | peers[i], | ||
251 | "statistics", | ||
252 | service_connect_complete, | ||
253 | p_ctx, /* cls of completion cb */ | ||
254 | ca_statistics, /* connect adapter */ | ||
255 | da_statistics, /* disconnect adapter */ | ||
256 | p_ctx); | ||
257 | |||
79 | } | 258 | } |
259 | |||
260 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL); | ||
261 | timeout_tid = | ||
262 | GNUNET_SCHEDULER_add_delayed (TIMEOUT, | ||
263 | &timeout_task, | ||
264 | NULL); | ||
80 | } | 265 | } |
81 | 266 | ||
82 | 267 | ||
83 | int | 268 | int |
84 | main (int argc, char *argv[]) | 269 | main (int argc, char *argv[]) |
85 | { | 270 | { |
271 | result = GNUNET_SYSERR; | ||
272 | checked_peers = 0; | ||
273 | |||
86 | (void) GNUNET_TESTBED_test_run ("test-gnunet-daemon-topology", | 274 | (void) GNUNET_TESTBED_test_run ("test-gnunet-daemon-topology", |
87 | "test_gnunet_daemon_topology_data.conf", | 275 | "test_gnunet_daemon_topology_data.conf", |
88 | NUM_PEERS, | 276 | NUM_PEERS, |
89 | 0, NULL, NULL, | 277 | 0, NULL, NULL, |
90 | &do_connect, NULL); | 278 | &do_connect, NULL); |
91 | GNUNET_DISK_directory_remove ("/tmp/test-gnunet-topology"); | 279 | GNUNET_DISK_directory_remove ("/tmp/test-gnunet-topology"); |
92 | return ok; | 280 | |
281 | return (GNUNET_OK != result) ? 1 : 0; | ||
93 | } | 282 | } |
94 | 283 | ||
95 | /* end of test_gnunet_daemon_topology.c */ | 284 | /* end of test_gnunet_daemon_topology.c */ |
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index 6ebc6da8c..8c4f33fd0 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c | |||
@@ -612,7 +612,7 @@ notify_client_about_neighbour (void *cls, | |||
612 | 612 | ||
613 | /** | 613 | /** |
614 | * Initialize a normal client. We got a start message from this | 614 | * Initialize a normal client. We got a start message from this |
615 | * client, add him to the list of clients for broadcasting of inbound | 615 | * client, add it to the list of clients for broadcasting of inbound |
616 | * messages. | 616 | * messages. |
617 | * | 617 | * |
618 | * @param cls the client | 618 | * @param cls the client |
@@ -2173,7 +2173,7 @@ test_connection_ok (void *cls, | |||
2173 | 2173 | ||
2174 | /** | 2174 | /** |
2175 | * Initialize a blacklisting client. We got a blacklist-init | 2175 | * Initialize a blacklisting client. We got a blacklist-init |
2176 | * message from this client, add him to the list of clients | 2176 | * message from this client, add it to the list of clients |
2177 | * to query for blacklisting. | 2177 | * to query for blacklisting. |
2178 | * | 2178 | * |
2179 | * @param cls the client | 2179 | * @param cls the client |
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index b1f3965ad..3965bc13e 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c | |||
@@ -179,7 +179,7 @@ struct GNUNET_ATS_SessionQuotaMessage | |||
179 | 179 | ||
180 | 180 | ||
181 | /** | 181 | /** |
182 | * Message we send to the other peer to notify him that we intentionally | 182 | * Message we send to the other peer to notify it that we intentionally |
183 | * are disconnecting (to reduce timeouts). This is just a friendly | 183 | * are disconnecting (to reduce timeouts). This is just a friendly |
184 | * notification, peers must not rely on always receiving disconnect | 184 | * notification, peers must not rely on always receiving disconnect |
185 | * messages. | 185 | * messages. |
@@ -3081,7 +3081,7 @@ master_task (void *cls) | |||
3081 | 3081 | ||
3082 | /** | 3082 | /** |
3083 | * Send a ACK message to the neighbour to confirm that we | 3083 | * Send a ACK message to the neighbour to confirm that we |
3084 | * got his SYN_ACK. | 3084 | * got its SYN_ACK. |
3085 | * | 3085 | * |
3086 | * @param n neighbour to send the ACK to | 3086 | * @param n neighbour to send the ACK to |
3087 | */ | 3087 | */ |
diff --git a/src/transport/test_plugin_transport_data.conf b/src/transport/test_plugin_transport_data.conf index cbecc56ed..b667a4854 100644 --- a/src/transport/test_plugin_transport_data.conf +++ b/src/transport/test_plugin_transport_data.conf | |||
@@ -3,10 +3,10 @@ | |||
3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-gnunetd-plugin-transport/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-gnunetd-plugin-transport/ |
4 | 4 | ||
5 | [transport-tcp] | 5 | [transport-tcp] |
6 | PORT = 2400 | 6 | PORT = 52400 |
7 | 7 | ||
8 | [transport-udp] | 8 | [transport-udp] |
9 | PORT = 2401 | 9 | PORT = 52401 |
10 | 10 | ||
11 | [transport-wlan] | 11 | [transport-wlan] |
12 | INTERFACE = mon0 | 12 | INTERFACE = mon0 |
@@ -17,29 +17,29 @@ INTERFACE = hci0 | |||
17 | TESTMODE = 1 | 17 | TESTMODE = 1 |
18 | 18 | ||
19 | [transport-http_server] | 19 | [transport-http_server] |
20 | PORT = 2402 | 20 | PORT = 52402 |
21 | 21 | ||
22 | [transport-https_server] | 22 | [transport-https_server] |
23 | PORT = 2403 | 23 | PORT = 52403 |
24 | 24 | ||
25 | [arm] | 25 | [arm] |
26 | PORT = 2360 | 26 | PORT = 52360 |
27 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-arm.sock | 27 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-arm.sock |
28 | 28 | ||
29 | [statistics] | 29 | [statistics] |
30 | PORT = 2361 | 30 | PORT = 52361 |
31 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-statistics.sock | 31 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-statistics.sock |
32 | 32 | ||
33 | [resolver] | 33 | [resolver] |
34 | PORT = 2362 | 34 | PORT = 52362 |
35 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-resolver.sock | 35 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-resolver.sock |
36 | 36 | ||
37 | [peerinfo] | 37 | [peerinfo] |
38 | PORT = 2363 | 38 | PORT = 52363 |
39 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-peerinfo.sock | 39 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-peerinfo.sock |
40 | 40 | ||
41 | [transport] | 41 | [transport] |
42 | PORT = 2364 | 42 | PORT = 52364 |
43 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-transport.sock | 43 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-transport.sock |
44 | 44 | ||
45 | [nat] | 45 | [nat] |
diff --git a/src/transport/test_quota_compliance_data.conf b/src/transport/test_quota_compliance_data.conf index 47c523bcf..1bc607770 100644 --- a/src/transport/test_quota_compliance_data.conf +++ b/src/transport/test_quota_compliance_data.conf | |||
@@ -3,22 +3,22 @@ | |||
3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-gnunetd-plugin-transport/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-gnunetd-plugin-transport/ |
4 | 4 | ||
5 | [transport-tcp] | 5 | [transport-tcp] |
6 | PORT = 2368 | 6 | PORT = 52368 |
7 | TIMEOUT = 5 s | 7 | TIMEOUT = 5 s |
8 | 8 | ||
9 | [arm] | 9 | [arm] |
10 | PORT = 2366 | 10 | PORT = 52366 |
11 | 11 | ||
12 | [statistics] | 12 | [statistics] |
13 | PORT = 2367 | 13 | PORT = 52367 |
14 | 14 | ||
15 | [resolver] | 15 | [resolver] |
16 | PORT = 2364 | 16 | PORT = 52364 |
17 | 17 | ||
18 | [peerinfo] | 18 | [peerinfo] |
19 | PORT = 2369 | 19 | PORT = 52369 |
20 | 20 | ||
21 | [transport] | 21 | [transport] |
22 | PORT = 2365 | 22 | PORT = 52365 |
23 | 23 | ||
24 | 24 | ||
diff --git a/src/transport/test_quota_compliance_http_asymmetric_peer1.conf b/src/transport/test_quota_compliance_http_asymmetric_peer1.conf index 201bafd01..b2ff1913f 100644 --- a/src/transport/test_quota_compliance_http_asymmetric_peer1.conf +++ b/src/transport/test_quota_compliance_http_asymmetric_peer1.conf | |||
@@ -5,23 +5,23 @@ GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer1 | |||
5 | [transport-http_client] | 5 | [transport-http_client] |
6 | 6 | ||
7 | [arm] | 7 | [arm] |
8 | PORT = 4015 | 8 | PORT = 54015 |
9 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_arm_peer1.sock | 9 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_arm_peer1.sock |
10 | 10 | ||
11 | [statistics] | 11 | [statistics] |
12 | PORT = 4014 | 12 | PORT = 54014 |
13 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_statistics_peer1.sock | 13 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_statistics_peer1.sock |
14 | 14 | ||
15 | [resolver] | 15 | [resolver] |
16 | PORT = 4013 | 16 | PORT = 54013 |
17 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_resolver_peer1.sock | 17 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_resolver_peer1.sock |
18 | 18 | ||
19 | [peerinfo] | 19 | [peerinfo] |
20 | PORT = 4012 | 20 | PORT = 54012 |
21 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_peerinfo_peer1.sock | 21 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_peerinfo_peer1.sock |
22 | 22 | ||
23 | [transport] | 23 | [transport] |
24 | PORT = 4011 | 24 | PORT = 54011 |
25 | PLUGINS = http_client | 25 | PLUGINS = http_client |
26 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_transport_peer1.sock | 26 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_transport_peer1.sock |
27 | 27 | ||
diff --git a/src/transport/test_quota_compliance_http_asymmetric_peer2.conf b/src/transport/test_quota_compliance_http_asymmetric_peer2.conf index cdc10516b..3408d9f2e 100644 --- a/src/transport/test_quota_compliance_http_asymmetric_peer2.conf +++ b/src/transport/test_quota_compliance_http_asymmetric_peer2.conf | |||
@@ -3,29 +3,29 @@ | |||
3 | GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer2 | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer2 |
4 | 4 | ||
5 | [transport-http_server] | 5 | [transport-http_server] |
6 | PORT = 3010 | 6 | PORT = 53010 |
7 | USE_IPv6 = NO | 7 | USE_IPv6 = NO |
8 | BINDTO = 127.0.0.1 | 8 | BINDTO = 127.0.0.1 |
9 | 9 | ||
10 | 10 | ||
11 | [arm] | 11 | [arm] |
12 | PORT = 3015 | 12 | PORT = 53015 |
13 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_arm_peer2.sock | 13 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_arm_peer2.sock |
14 | 14 | ||
15 | [statistics] | 15 | [statistics] |
16 | PORT = 3014 | 16 | PORT = 53014 |
17 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_statistics_peer2.sock | 17 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_statistics_peer2.sock |
18 | 18 | ||
19 | [resolver] | 19 | [resolver] |
20 | PORT = 3013 | 20 | PORT = 53013 |
21 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_resolver_peer2.sock | 21 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_resolver_peer2.sock |
22 | 22 | ||
23 | [peerinfo] | 23 | [peerinfo] |
24 | PORT = 3012 | 24 | PORT = 53012 |
25 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_peerinfo_peer2.sock | 25 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_peerinfo_peer2.sock |
26 | 26 | ||
27 | [transport] | 27 | [transport] |
28 | PORT = 3011 | 28 | PORT = 53011 |
29 | PLUGINS = http_server | 29 | PLUGINS = http_server |
30 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_transport_peer2.sock | 30 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_transport_peer2.sock |
31 | 31 | ||
diff --git a/src/transport/test_quota_compliance_http_peer1.conf b/src/transport/test_quota_compliance_http_peer1.conf index 201bafd01..b2ff1913f 100644 --- a/src/transport/test_quota_compliance_http_peer1.conf +++ b/src/transport/test_quota_compliance_http_peer1.conf | |||
@@ -5,23 +5,23 @@ GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer1 | |||
5 | [transport-http_client] | 5 | [transport-http_client] |
6 | 6 | ||
7 | [arm] | 7 | [arm] |
8 | PORT = 4015 | 8 | PORT = 54015 |
9 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_arm_peer1.sock | 9 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_arm_peer1.sock |
10 | 10 | ||
11 | [statistics] | 11 | [statistics] |
12 | PORT = 4014 | 12 | PORT = 54014 |
13 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_statistics_peer1.sock | 13 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_statistics_peer1.sock |
14 | 14 | ||
15 | [resolver] | 15 | [resolver] |
16 | PORT = 4013 | 16 | PORT = 54013 |
17 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_resolver_peer1.sock | 17 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_resolver_peer1.sock |
18 | 18 | ||
19 | [peerinfo] | 19 | [peerinfo] |
20 | PORT = 4012 | 20 | PORT = 54012 |
21 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_peerinfo_peer1.sock | 21 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_peerinfo_peer1.sock |
22 | 22 | ||
23 | [transport] | 23 | [transport] |
24 | PORT = 4011 | 24 | PORT = 54011 |
25 | PLUGINS = http_client | 25 | PLUGINS = http_client |
26 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_transport_peer1.sock | 26 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_transport_peer1.sock |
27 | 27 | ||
diff --git a/src/transport/test_quota_compliance_http_peer2.conf b/src/transport/test_quota_compliance_http_peer2.conf index cdc10516b..3408d9f2e 100644 --- a/src/transport/test_quota_compliance_http_peer2.conf +++ b/src/transport/test_quota_compliance_http_peer2.conf | |||
@@ -3,29 +3,29 @@ | |||
3 | GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer2 | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer2 |
4 | 4 | ||
5 | [transport-http_server] | 5 | [transport-http_server] |
6 | PORT = 3010 | 6 | PORT = 53010 |
7 | USE_IPv6 = NO | 7 | USE_IPv6 = NO |
8 | BINDTO = 127.0.0.1 | 8 | BINDTO = 127.0.0.1 |
9 | 9 | ||
10 | 10 | ||
11 | [arm] | 11 | [arm] |
12 | PORT = 3015 | 12 | PORT = 53015 |
13 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_arm_peer2.sock | 13 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_arm_peer2.sock |
14 | 14 | ||
15 | [statistics] | 15 | [statistics] |
16 | PORT = 3014 | 16 | PORT = 53014 |
17 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_statistics_peer2.sock | 17 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_statistics_peer2.sock |
18 | 18 | ||
19 | [resolver] | 19 | [resolver] |
20 | PORT = 3013 | 20 | PORT = 53013 |
21 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_resolver_peer2.sock | 21 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_resolver_peer2.sock |
22 | 22 | ||
23 | [peerinfo] | 23 | [peerinfo] |
24 | PORT = 3012 | 24 | PORT = 53012 |
25 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_peerinfo_peer2.sock | 25 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_peerinfo_peer2.sock |
26 | 26 | ||
27 | [transport] | 27 | [transport] |
28 | PORT = 3011 | 28 | PORT = 53011 |
29 | PLUGINS = http_server | 29 | PLUGINS = http_server |
30 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_transport_peer2.sock | 30 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_transport_peer2.sock |
31 | 31 | ||
diff --git a/src/transport/test_quota_compliance_https_asymmetric_peer1.conf b/src/transport/test_quota_compliance_https_asymmetric_peer1.conf index 3e8895665..94aa534ef 100644 --- a/src/transport/test_quota_compliance_https_asymmetric_peer1.conf +++ b/src/transport/test_quota_compliance_https_asymmetric_peer1.conf | |||
@@ -5,23 +5,23 @@ GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer1/ | |||
5 | [transport-https_client] | 5 | [transport-https_client] |
6 | 6 | ||
7 | [arm] | 7 | [arm] |
8 | PORT = 4006 | 8 | PORT = 54006 |
9 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_arm_peer1.sock | 9 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_arm_peer1.sock |
10 | 10 | ||
11 | [statistics] | 11 | [statistics] |
12 | PORT = 4005 | 12 | PORT = 54005 |
13 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_statistics_peer1.sock | 13 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_statistics_peer1.sock |
14 | 14 | ||
15 | [resolver] | 15 | [resolver] |
16 | PORT = 4004 | 16 | PORT = 54004 |
17 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_resolver_peer1.sock | 17 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_resolver_peer1.sock |
18 | 18 | ||
19 | [peerinfo] | 19 | [peerinfo] |
20 | PORT = 4003 | 20 | PORT = 54003 |
21 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_peerinfo_peer1.sock | 21 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_peerinfo_peer1.sock |
22 | 22 | ||
23 | [transport] | 23 | [transport] |
24 | PORT = 4002 | 24 | PORT = 54002 |
25 | PLUGINS = https_client | 25 | PLUGINS = https_client |
26 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_transport_peer1.sock | 26 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_transport_peer1.sock |
27 | 27 | ||
diff --git a/src/transport/test_quota_compliance_https_asymmetric_peer2.conf b/src/transport/test_quota_compliance_https_asymmetric_peer2.conf index e0ff8da9f..8fb8861cd 100644 --- a/src/transport/test_quota_compliance_https_asymmetric_peer2.conf +++ b/src/transport/test_quota_compliance_https_asymmetric_peer2.conf | |||
@@ -3,28 +3,28 @@ | |||
3 | GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer2 | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer2 |
4 | 4 | ||
5 | [transport-https_server] | 5 | [transport-https_server] |
6 | PORT = 3001 | 6 | PORT = 53001 |
7 | KEY_FILE = https_key_quota_p2.key | 7 | KEY_FILE = https_key_quota_p2.key |
8 | CERT_FILE = https_cert_qutoa_p2.crt | 8 | CERT_FILE = https_cert_qutoa_p2.crt |
9 | 9 | ||
10 | [arm] | 10 | [arm] |
11 | PORT = 3006 | 11 | PORT = 53006 |
12 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_arm_peer2.sock | 12 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_arm_peer2.sock |
13 | 13 | ||
14 | [statistics] | 14 | [statistics] |
15 | PORT = 3005 | 15 | PORT = 53005 |
16 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_statistics_peer2.sock | 16 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_statistics_peer2.sock |
17 | 17 | ||
18 | [resolver] | 18 | [resolver] |
19 | PORT = 3004 | 19 | PORT = 53004 |
20 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_resolver_peer2.sock | 20 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_resolver_peer2.sock |
21 | 21 | ||
22 | [peerinfo] | 22 | [peerinfo] |
23 | PORT = 3003 | 23 | PORT = 53003 |
24 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_peerinfo_peer2.sock | 24 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_peerinfo_peer2.sock |
25 | 25 | ||
26 | [transport] | 26 | [transport] |
27 | PORT = 3002 | 27 | PORT = 53002 |
28 | PLUGINS = https_server | 28 | PLUGINS = https_server |
29 | UNIXPATH = $GNUNET_RUNTIME_DIR/https_transport_peer2.sock | 29 | UNIXPATH = $GNUNET_RUNTIME_DIR/https_transport_peer2.sock |
30 | 30 | ||
diff --git a/src/transport/test_quota_compliance_https_peer1.conf b/src/transport/test_quota_compliance_https_peer1.conf index 3e8895665..94aa534ef 100644 --- a/src/transport/test_quota_compliance_https_peer1.conf +++ b/src/transport/test_quota_compliance_https_peer1.conf | |||
@@ -5,23 +5,23 @@ GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer1/ | |||
5 | [transport-https_client] | 5 | [transport-https_client] |
6 | 6 | ||
7 | [arm] | 7 | [arm] |
8 | PORT = 4006 | 8 | PORT = 54006 |
9 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_arm_peer1.sock | 9 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_arm_peer1.sock |
10 | 10 | ||
11 | [statistics] | 11 | [statistics] |
12 | PORT = 4005 | 12 | PORT = 54005 |
13 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_statistics_peer1.sock | 13 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_statistics_peer1.sock |
14 | 14 | ||
15 | [resolver] | 15 | [resolver] |
16 | PORT = 4004 | 16 | PORT = 54004 |
17 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_resolver_peer1.sock | 17 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_resolver_peer1.sock |
18 | 18 | ||
19 | [peerinfo] | 19 | [peerinfo] |
20 | PORT = 4003 | 20 | PORT = 54003 |
21 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_peerinfo_peer1.sock | 21 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_peerinfo_peer1.sock |
22 | 22 | ||
23 | [transport] | 23 | [transport] |
24 | PORT = 4002 | 24 | PORT = 54002 |
25 | PLUGINS = https_client | 25 | PLUGINS = https_client |
26 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_transport_peer1.sock | 26 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_transport_peer1.sock |
27 | 27 | ||
diff --git a/src/transport/test_quota_compliance_https_peer2.conf b/src/transport/test_quota_compliance_https_peer2.conf index e0ff8da9f..8fb8861cd 100644 --- a/src/transport/test_quota_compliance_https_peer2.conf +++ b/src/transport/test_quota_compliance_https_peer2.conf | |||
@@ -3,28 +3,28 @@ | |||
3 | GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer2 | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer2 |
4 | 4 | ||
5 | [transport-https_server] | 5 | [transport-https_server] |
6 | PORT = 3001 | 6 | PORT = 53001 |
7 | KEY_FILE = https_key_quota_p2.key | 7 | KEY_FILE = https_key_quota_p2.key |
8 | CERT_FILE = https_cert_qutoa_p2.crt | 8 | CERT_FILE = https_cert_qutoa_p2.crt |
9 | 9 | ||
10 | [arm] | 10 | [arm] |
11 | PORT = 3006 | 11 | PORT = 53006 |
12 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_arm_peer2.sock | 12 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_arm_peer2.sock |
13 | 13 | ||
14 | [statistics] | 14 | [statistics] |
15 | PORT = 3005 | 15 | PORT = 53005 |
16 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_statistics_peer2.sock | 16 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_statistics_peer2.sock |
17 | 17 | ||
18 | [resolver] | 18 | [resolver] |
19 | PORT = 3004 | 19 | PORT = 53004 |
20 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_resolver_peer2.sock | 20 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_resolver_peer2.sock |
21 | 21 | ||
22 | [peerinfo] | 22 | [peerinfo] |
23 | PORT = 3003 | 23 | PORT = 53003 |
24 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_peerinfo_peer2.sock | 24 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_peerinfo_peer2.sock |
25 | 25 | ||
26 | [transport] | 26 | [transport] |
27 | PORT = 3002 | 27 | PORT = 53002 |
28 | PLUGINS = https_server | 28 | PLUGINS = https_server |
29 | UNIXPATH = $GNUNET_RUNTIME_DIR/https_transport_peer2.sock | 29 | UNIXPATH = $GNUNET_RUNTIME_DIR/https_transport_peer2.sock |
30 | 30 | ||
diff --git a/src/transport/test_quota_compliance_tcp_asymmetric_peer1.conf b/src/transport/test_quota_compliance_tcp_asymmetric_peer1.conf index 59fbbff5b..0e0cbff24 100644 --- a/src/transport/test_quota_compliance_tcp_asymmetric_peer1.conf +++ b/src/transport/test_quota_compliance_tcp_asymmetric_peer1.conf | |||
@@ -3,29 +3,29 @@ | |||
3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/quota-tcp-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/quota-tcp-p1/ |
4 | 4 | ||
5 | [transport-tcp] | 5 | [transport-tcp] |
6 | PORT = 4094 | 6 | PORT = 54094 |
7 | 7 | ||
8 | [transport-udp] | 8 | [transport-udp] |
9 | PORT = 4094 | 9 | PORT = 54094 |
10 | 10 | ||
11 | [arm] | 11 | [arm] |
12 | PORT = 4087 | 12 | PORT = 54087 |
13 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_arm_peer1.sock | 13 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_arm_peer1.sock |
14 | 14 | ||
15 | [statistics] | 15 | [statistics] |
16 | PORT = 4088 | 16 | PORT = 54088 |
17 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_statistics_peer1.sock | 17 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_statistics_peer1.sock |
18 | 18 | ||
19 | [resolver] | 19 | [resolver] |
20 | PORT = 4089 | 20 | PORT = 54089 |
21 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_resolver_peer1.sock | 21 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_resolver_peer1.sock |
22 | 22 | ||
23 | [peerinfo] | 23 | [peerinfo] |
24 | PORT = 4090 | 24 | PORT = 54090 |
25 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_peerinfo_peer1.sock | 25 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_peerinfo_peer1.sock |
26 | 26 | ||
27 | [transport] | 27 | [transport] |
28 | PORT = 4091 | 28 | PORT = 54091 |
29 | PLUGINS = tcp | 29 | PLUGINS = tcp |
30 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_transport_peer1.sock | 30 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_transport_peer1.sock |
31 | 31 | ||
diff --git a/src/transport/test_quota_compliance_tcp_peer1.conf b/src/transport/test_quota_compliance_tcp_peer1.conf index 59fbbff5b..0e0cbff24 100644 --- a/src/transport/test_quota_compliance_tcp_peer1.conf +++ b/src/transport/test_quota_compliance_tcp_peer1.conf | |||
@@ -3,29 +3,29 @@ | |||
3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/quota-tcp-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/quota-tcp-p1/ |
4 | 4 | ||
5 | [transport-tcp] | 5 | [transport-tcp] |
6 | PORT = 4094 | 6 | PORT = 54094 |
7 | 7 | ||
8 | [transport-udp] | 8 | [transport-udp] |
9 | PORT = 4094 | 9 | PORT = 54094 |
10 | 10 | ||
11 | [arm] | 11 | [arm] |
12 | PORT = 4087 | 12 | PORT = 54087 |
13 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_arm_peer1.sock | 13 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_arm_peer1.sock |
14 | 14 | ||
15 | [statistics] | 15 | [statistics] |
16 | PORT = 4088 | 16 | PORT = 54088 |
17 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_statistics_peer1.sock | 17 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_statistics_peer1.sock |
18 | 18 | ||
19 | [resolver] | 19 | [resolver] |
20 | PORT = 4089 | 20 | PORT = 54089 |
21 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_resolver_peer1.sock | 21 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_resolver_peer1.sock |
22 | 22 | ||
23 | [peerinfo] | 23 | [peerinfo] |
24 | PORT = 4090 | 24 | PORT = 54090 |
25 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_peerinfo_peer1.sock | 25 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_peerinfo_peer1.sock |
26 | 26 | ||
27 | [transport] | 27 | [transport] |
28 | PORT = 4091 | 28 | PORT = 54091 |
29 | PLUGINS = tcp | 29 | PLUGINS = tcp |
30 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_transport_peer1.sock | 30 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_transport_peer1.sock |
31 | 31 | ||
diff --git a/src/transport/test_quota_compliance_udp_peer1.conf b/src/transport/test_quota_compliance_udp_peer1.conf index b7c3159b8..bba75c168 100644 --- a/src/transport/test_quota_compliance_udp_peer1.conf +++ b/src/transport/test_quota_compliance_udp_peer1.conf | |||
@@ -3,27 +3,27 @@ | |||
3 | GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer1/ |
4 | 4 | ||
5 | [transport-udp] | 5 | [transport-udp] |
6 | PORT = 4368 | 6 | PORT = 54368 |
7 | MAX_BPS = 50000000 | 7 | MAX_BPS = 50000000 |
8 | 8 | ||
9 | [arm] | 9 | [arm] |
10 | PORT = 4087 | 10 | PORT = 54087 |
11 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_arm_peer1.sock | 11 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_arm_peer1.sock |
12 | 12 | ||
13 | [statistics] | 13 | [statistics] |
14 | PORT = 4088 | 14 | PORT = 54088 |
15 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_statistics_peer1.sock | 15 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_statistics_peer1.sock |
16 | 16 | ||
17 | [resolver] | 17 | [resolver] |
18 | PORT = 4089 | 18 | PORT = 54089 |
19 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_resolver_peer1.sock | 19 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_resolver_peer1.sock |
20 | 20 | ||
21 | [peerinfo] | 21 | [peerinfo] |
22 | PORT = 4090 | 22 | PORT = 54090 |
23 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_peerinfo_peer1.sock | 23 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_peerinfo_peer1.sock |
24 | 24 | ||
25 | [transport] | 25 | [transport] |
26 | PORT = 4091 | 26 | PORT = 54091 |
27 | PLUGINS = udp | 27 | PLUGINS = udp |
28 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_transport_peer1.sock | 28 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_transport_peer1.sock |
29 | 29 | ||
diff --git a/src/transport/test_quota_compliance_udp_peer2.conf b/src/transport/test_quota_compliance_udp_peer2.conf index 70e61db05..1cb04038c 100644 --- a/src/transport/test_quota_compliance_udp_peer2.conf +++ b/src/transport/test_quota_compliance_udp_peer2.conf | |||
@@ -3,27 +3,27 @@ | |||
3 | GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer2 | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer2 |
4 | 4 | ||
5 | [transport-udp] | 5 | [transport-udp] |
6 | PORT = 3368 | 6 | PORT = 53368 |
7 | MAX_BPS = 50000000 | 7 | MAX_BPS = 50000000 |
8 | 8 | ||
9 | [arm] | 9 | [arm] |
10 | PORT = 3087 | 10 | PORT = 53087 |
11 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_arm_peer2.sock | 11 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_arm_peer2.sock |
12 | 12 | ||
13 | [statistics] | 13 | [statistics] |
14 | PORT = 3088 | 14 | PORT = 53088 |
15 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_statistics_peer2.sock | 15 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_statistics_peer2.sock |
16 | 16 | ||
17 | [resolver] | 17 | [resolver] |
18 | PORT = 3089 | 18 | PORT = 53089 |
19 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_resolver_peer2.sock | 19 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_resolver_peer2.sock |
20 | 20 | ||
21 | [peerinfo] | 21 | [peerinfo] |
22 | PORT = 3090 | 22 | PORT = 53090 |
23 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_peerinfo_peer2.sock | 23 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_peerinfo_peer2.sock |
24 | 24 | ||
25 | [transport] | 25 | [transport] |
26 | PORT = 3091 | 26 | PORT = 53091 |
27 | PLUGINS = udp | 27 | PLUGINS = udp |
28 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_transport_peer2.sock | 28 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_transport_peer2.sock |
29 | 29 | ||
diff --git a/src/transport/test_quota_compliance_unix_asymmetric_peer1.conf b/src/transport/test_quota_compliance_unix_asymmetric_peer1.conf index 8d6073b67..a8ee6d77a 100644 --- a/src/transport/test_quota_compliance_unix_asymmetric_peer1.conf +++ b/src/transport/test_quota_compliance_unix_asymmetric_peer1.conf | |||
@@ -3,26 +3,26 @@ | |||
3 | GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer1/ |
4 | 4 | ||
5 | [arm] | 5 | [arm] |
6 | PORT = 4087 | 6 | PORT = 54087 |
7 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_arm_peer1.sock | 7 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_arm_peer1.sock |
8 | 8 | ||
9 | [statistics] | 9 | [statistics] |
10 | PORT = 4088 | 10 | PORT = 54088 |
11 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_statistics_peer1.sock | 11 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_statistics_peer1.sock |
12 | 12 | ||
13 | [resolver] | 13 | [resolver] |
14 | PORT = 4089 | 14 | PORT = 54089 |
15 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_resolver_peer1.sock | 15 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_resolver_peer1.sock |
16 | 16 | ||
17 | [peerinfo] | 17 | [peerinfo] |
18 | PORT = 4090 | 18 | PORT = 54090 |
19 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_peerinfo_peer1.sock | 19 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_peerinfo_peer1.sock |
20 | 20 | ||
21 | [transport] | 21 | [transport] |
22 | PORT = 4091 | 22 | PORT = 54091 |
23 | PLUGINS = unix | 23 | PLUGINS = unix |
24 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_transport_peer1.sock | 24 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_transport_peer1.sock |
25 | 25 | ||
26 | [transport-unix] | 26 | [transport-unix] |
27 | PORT = 4092 | 27 | PORT = 54092 |
28 | 28 | ||
diff --git a/src/transport/test_quota_compliance_unix_asymmetric_peer2.conf b/src/transport/test_quota_compliance_unix_asymmetric_peer2.conf index a3a42f739..6edbcac9f 100644 --- a/src/transport/test_quota_compliance_unix_asymmetric_peer2.conf +++ b/src/transport/test_quota_compliance_unix_asymmetric_peer2.conf | |||
@@ -3,26 +3,26 @@ | |||
3 | GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer2 | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer2 |
4 | 4 | ||
5 | [arm] | 5 | [arm] |
6 | PORT = 3087 | 6 | PORT = 53087 |
7 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_arm_peer2.sock | 7 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_arm_peer2.sock |
8 | 8 | ||
9 | [statistics] | 9 | [statistics] |
10 | PORT = 3088 | 10 | PORT = 53088 |
11 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_statistics_peer2.sock | 11 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_statistics_peer2.sock |
12 | 12 | ||
13 | [resolver] | 13 | [resolver] |
14 | PORT = 3089 | 14 | PORT = 53089 |
15 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_resolver_peer2.sock | 15 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_resolver_peer2.sock |
16 | 16 | ||
17 | [peerinfo] | 17 | [peerinfo] |
18 | PORT = 3090 | 18 | PORT = 53090 |
19 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_peerinfo_peer2.sock | 19 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_peerinfo_peer2.sock |
20 | 20 | ||
21 | [transport] | 21 | [transport] |
22 | PORT = 3091 | 22 | PORT = 53091 |
23 | PLUGINS = unix | 23 | PLUGINS = unix |
24 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_transport_peer2.sock | 24 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_transport_peer2.sock |
25 | 25 | ||
26 | [transport-unix] | 26 | [transport-unix] |
27 | PORT = 3368 | 27 | PORT = 53368 |
28 | 28 | ||
diff --git a/src/transport/test_quota_compliance_unix_peer1.conf b/src/transport/test_quota_compliance_unix_peer1.conf index d9255705c..59c8d6d9e 100644 --- a/src/transport/test_quota_compliance_unix_peer1.conf +++ b/src/transport/test_quota_compliance_unix_peer1.conf | |||
@@ -6,22 +6,22 @@ GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer1/ | |||
6 | PORT = 12120 | 6 | PORT = 12120 |
7 | 7 | ||
8 | [arm] | 8 | [arm] |
9 | PORT = 4087 | 9 | PORT = 54087 |
10 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_arm_peer1.sock | 10 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_arm_peer1.sock |
11 | 11 | ||
12 | [statistics] | 12 | [statistics] |
13 | PORT = 4088 | 13 | PORT = 54088 |
14 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_statistics_peer1.sock | 14 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_statistics_peer1.sock |
15 | 15 | ||
16 | [resolver] | 16 | [resolver] |
17 | PORT = 4089 | 17 | PORT = 54089 |
18 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_resolver_peer1.sock | 18 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_resolver_peer1.sock |
19 | 19 | ||
20 | [peerinfo] | 20 | [peerinfo] |
21 | PORT = 4090 | 21 | PORT = 54090 |
22 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_peerinfo_peer1.sock | 22 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_peerinfo_peer1.sock |
23 | 23 | ||
24 | [transport] | 24 | [transport] |
25 | PORT = 4091 | 25 | PORT = 54091 |
26 | PLUGINS = unix | 26 | PLUGINS = unix |
27 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_transport_peer1.sock | 27 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_transport_peer1.sock |
diff --git a/src/transport/test_quota_compliance_unix_peer2.conf b/src/transport/test_quota_compliance_unix_peer2.conf index b7ba15d86..8c2f9989e 100644 --- a/src/transport/test_quota_compliance_unix_peer2.conf +++ b/src/transport/test_quota_compliance_unix_peer2.conf | |||
@@ -6,26 +6,26 @@ GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer2 | |||
6 | PORT = 12136 | 6 | PORT = 12136 |
7 | 7 | ||
8 | [arm] | 8 | [arm] |
9 | PORT = 3087 | 9 | PORT = 53087 |
10 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_arm_peer2.sock | 10 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_arm_peer2.sock |
11 | 11 | ||
12 | [statistics] | 12 | [statistics] |
13 | PORT = 3088 | 13 | PORT = 53088 |
14 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_statistics_peer2.sock | 14 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_statistics_peer2.sock |
15 | 15 | ||
16 | [resolver] | 16 | [resolver] |
17 | PORT = 3089 | 17 | PORT = 53089 |
18 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_resolver_peer2.sock | 18 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_resolver_peer2.sock |
19 | 19 | ||
20 | [peerinfo] | 20 | [peerinfo] |
21 | PORT = 3090 | 21 | PORT = 53090 |
22 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_peerinfo_peer2.sock | 22 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_peerinfo_peer2.sock |
23 | 23 | ||
24 | [transport] | 24 | [transport] |
25 | PORT = 3091 | 25 | PORT = 53091 |
26 | PLUGINS = unix | 26 | PLUGINS = unix |
27 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_transport_peer2.sock | 27 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_transport_peer2.sock |
28 | 28 | ||
29 | [transport-unix] | 29 | [transport-unix] |
30 | PORT = 3368 | 30 | PORT = 53368 |
31 | 31 | ||
diff --git a/src/transport/test_transport_api_data.conf b/src/transport/test_transport_api_data.conf index 58b8e17b0..c06235a0a 100644 --- a/src/transport/test_transport_api_data.conf +++ b/src/transport/test_transport_api_data.conf | |||
@@ -2,8 +2,8 @@ | |||
2 | [PATHS] | 2 | [PATHS] |
3 | 3 | ||
4 | [transport-tcp] | 4 | [transport-tcp] |
5 | PORT = 2094 | 5 | PORT = 52094 |
6 | 6 | ||
7 | [transport-udp] | 7 | [transport-udp] |
8 | PORT = 2094 | 8 | PORT = 52094 |
9 | 9 | ||
diff --git a/src/transport/test_transport_api_reliability_tcp_nat_peer1.conf b/src/transport/test_transport_api_reliability_tcp_nat_peer1.conf index 6aa9dbf22..6a2029b09 100644 --- a/src/transport/test_transport_api_reliability_tcp_nat_peer1.conf +++ b/src/transport/test_transport_api_reliability_tcp_nat_peer1.conf | |||
@@ -12,7 +12,7 @@ PORT = 0 | |||
12 | TIMEOUT = 5 s | 12 | TIMEOUT = 5 s |
13 | 13 | ||
14 | [arm] | 14 | [arm] |
15 | PORT = 1204 | 15 | PORT = 51204 |
16 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-arm.sock | 16 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-arm.sock |
17 | 17 | ||
18 | [statistics] | 18 | [statistics] |
diff --git a/src/transport/test_transport_api_tcp_nat_peer1.conf b/src/transport/test_transport_api_tcp_nat_peer1.conf index b8d83ce29..fb2fcecc6 100644 --- a/src/transport/test_transport_api_tcp_nat_peer1.conf +++ b/src/transport/test_transport_api_tcp_nat_peer1.conf | |||
@@ -12,7 +12,7 @@ PORT = 0 | |||
12 | TIMEOUT = 5 s | 12 | TIMEOUT = 5 s |
13 | 13 | ||
14 | [arm] | 14 | [arm] |
15 | PORT = 1204 | 15 | PORT = 51204 |
16 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-arm.sock | 16 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-arm.sock |
17 | 17 | ||
18 | [statistics] | 18 | [statistics] |
diff --git a/src/transport/transport.conf.in b/src/transport/transport.conf.in index 4185acc29..c6b207ad7 100644 --- a/src/transport/transport.conf.in +++ b/src/transport/transport.conf.in | |||
@@ -9,7 +9,8 @@ BINARY = gnunet-service-transport | |||
9 | NEIGHBOUR_LIMIT = 50 | 9 | NEIGHBOUR_LIMIT = 50 |
10 | ACCEPT_FROM = 127.0.0.1; | 10 | ACCEPT_FROM = 127.0.0.1; |
11 | ACCEPT_FROM6 = ::1; | 11 | ACCEPT_FROM6 = ::1; |
12 | PLUGINS = tcp udp | 12 | # TCP is the only transport plugin known to work "reliably" |
13 | PLUGINS = tcp | ||
13 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-transport.sock | 14 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-transport.sock |
14 | BLACKLIST_FILE = $GNUNET_CONFIG_HOME/transport/blacklist | 15 | BLACKLIST_FILE = $GNUNET_CONFIG_HOME/transport/blacklist |
15 | UNIX_MATCH_UID = NO | 16 | UNIX_MATCH_UID = NO |
diff --git a/src/tun/.gitignore b/src/tun/.gitignore deleted file mode 100644 index b26685596..000000000 --- a/src/tun/.gitignore +++ /dev/null | |||
@@ -1,2 +0,0 @@ | |||
1 | test_regex | ||
2 | test_tun | ||
diff --git a/src/tun/Makefile.am b/src/tun/Makefile.am deleted file mode 100644 index c741f5654..000000000 --- a/src/tun/Makefile.am +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
1 | # This Makefile.am is in the public domain | ||
2 | AM_CPPFLAGS = -I$(top_srcdir)/src/include | ||
3 | |||
4 | if MINGW | ||
5 | WINFLAGS = -Wl,--no-undefined -Wl,--export-all-symbols | ||
6 | endif | ||
7 | |||
8 | if USE_COVERAGE | ||
9 | AM_CFLAGS = --coverage -O0 | ||
10 | XLIB = -lgcov | ||
11 | endif | ||
12 | |||
13 | lib_LTLIBRARIES = libgnunettun.la | ||
14 | |||
15 | libgnunettun_la_SOURCES = \ | ||
16 | tun.c \ | ||
17 | regex.c | ||
18 | libgnunettun_la_LIBADD = \ | ||
19 | $(top_builddir)/src/util/libgnunetutil.la $(XLIB) \ | ||
20 | $(LTLIBINTL) | ||
21 | libgnunettun_la_LDFLAGS = \ | ||
22 | $(GN_LIB_LDFLAGS) \ | ||
23 | -version-info 1:0:1 | ||
24 | |||
25 | |||
26 | check_PROGRAMS = \ | ||
27 | test_tun \ | ||
28 | test_regex | ||
29 | |||
30 | if ENABLE_TEST_RUN | ||
31 | AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME; | ||
32 | TESTS = $(check_PROGRAMS) | ||
33 | endif | ||
34 | |||
35 | test_tun_SOURCES = \ | ||
36 | test_tun.c | ||
37 | test_tun_LDADD = \ | ||
38 | $(top_builddir)/src/util/libgnunetutil.la \ | ||
39 | libgnunettun.la | ||
40 | |||
41 | |||
42 | test_regex_SOURCES = \ | ||
43 | test_regex.c | ||
44 | test_regex_LDADD = \ | ||
45 | $(top_builddir)/src/util/libgnunetutil.la \ | ||
46 | libgnunettun.la | ||
diff --git a/src/util/.gitignore b/src/util/.gitignore index 23139a1ab..7b190ca76 100644 --- a/src/util/.gitignore +++ b/src/util/.gitignore | |||
@@ -69,3 +69,7 @@ perf_crypto_hash | |||
69 | perf_crypto_symmetric | 69 | perf_crypto_symmetric |
70 | perf_crypto_rsa | 70 | perf_crypto_rsa |
71 | perf_crypto_ecc_dlog | 71 | perf_crypto_ecc_dlog |
72 | test_hexcoder | ||
73 | test_regex | ||
74 | test_tun | ||
75 | gnunet-timeout | ||
diff --git a/src/util/Makefile.am b/src/util/Makefile.am index 4296199db..4ae073c2c 100644 --- a/src/util/Makefile.am +++ b/src/util/Makefile.am | |||
@@ -89,6 +89,8 @@ libgnunetutil_la_SOURCES = \ | |||
89 | crypto_rsa.c \ | 89 | crypto_rsa.c \ |
90 | disk.c \ | 90 | disk.c \ |
91 | disk.h \ | 91 | disk.h \ |
92 | dnsparser.c \ | ||
93 | dnsstub.c \ | ||
92 | getopt.c \ | 94 | getopt.c \ |
93 | getopt_helpers.c \ | 95 | getopt_helpers.c \ |
94 | helper.c \ | 96 | helper.c \ |
@@ -104,12 +106,14 @@ libgnunetutil_la_SOURCES = \ | |||
104 | peer.c \ | 106 | peer.c \ |
105 | plugin.c \ | 107 | plugin.c \ |
106 | program.c \ | 108 | program.c \ |
109 | regex.c \ | ||
107 | resolver_api.c resolver.h \ | 110 | resolver_api.c resolver.h \ |
108 | scheduler.c \ | 111 | scheduler.c \ |
109 | service.c \ | 112 | service.c \ |
110 | signal.c \ | 113 | signal.c \ |
111 | strings.c \ | 114 | strings.c \ |
112 | time.c \ | 115 | time.c \ |
116 | tun.c \ | ||
113 | speedup.c speedup.h | 117 | speedup.c speedup.h |
114 | 118 | ||
115 | libgnunetutil_la_LIBADD = \ | 119 | libgnunetutil_la_LIBADD = \ |
@@ -117,7 +121,7 @@ libgnunetutil_la_LIBADD = \ | |||
117 | $(LIBGCRYPT_LIBS) \ | 121 | $(LIBGCRYPT_LIBS) \ |
118 | $(LTLIBICONV) \ | 122 | $(LTLIBICONV) \ |
119 | $(LTLIBINTL) \ | 123 | $(LTLIBINTL) \ |
120 | -lltdl $(Z_LIBS) -lunistring $(XLIB) | 124 | -lltdl -lidn $(Z_LIBS) -lunistring $(XLIB) |
121 | 125 | ||
122 | libgnunetutil_la_LDFLAGS = \ | 126 | libgnunetutil_la_LDFLAGS = \ |
123 | $(GN_LIB_LDFLAGS) \ | 127 | $(GN_LIB_LDFLAGS) \ |
@@ -162,6 +166,7 @@ lib_LTLIBRARIES = libgnunetutil.la | |||
162 | 166 | ||
163 | libexec_PROGRAMS = \ | 167 | libexec_PROGRAMS = \ |
164 | gnunet-service-resolver \ | 168 | gnunet-service-resolver \ |
169 | gnunet-timeout \ | ||
165 | $(W32CONSOLEHELPER) | 170 | $(W32CONSOLEHELPER) |
166 | 171 | ||
167 | bin_SCRIPTS =\ | 172 | bin_SCRIPTS =\ |
@@ -188,6 +193,15 @@ endif | |||
188 | endif | 193 | endif |
189 | 194 | ||
190 | 195 | ||
196 | if !MINGW | ||
197 | gnunet_timeout_SOURCES = \ | ||
198 | gnunet-timeout.c | ||
199 | else | ||
200 | gnunet_timeout_SOURCES = \ | ||
201 | gnunet-timeout-w32.c | ||
202 | endif | ||
203 | |||
204 | |||
191 | do_subst = $(SED) -e 's,[@]PYTHON[@],$(PYTHON),g' | 205 | do_subst = $(SED) -e 's,[@]PYTHON[@],$(PYTHON),g' |
192 | 206 | ||
193 | gnunet-qr: gnunet-qr.py.in Makefile | 207 | gnunet-qr: gnunet-qr.py.in Makefile |
@@ -291,19 +305,22 @@ check_PROGRAMS = \ | |||
291 | test_crypto_rsa \ | 305 | test_crypto_rsa \ |
292 | test_disk \ | 306 | test_disk \ |
293 | test_getopt \ | 307 | test_getopt \ |
308 | test_hexcoder \ | ||
294 | test_mq \ | 309 | test_mq \ |
295 | test_os_network \ | 310 | test_os_network \ |
296 | test_peer \ | 311 | test_peer \ |
297 | test_plugin \ | 312 | test_plugin \ |
298 | test_program \ | 313 | test_program \ |
314 | test_regex \ | ||
299 | test_resolver_api.nc \ | 315 | test_resolver_api.nc \ |
300 | test_scheduler \ | 316 | test_scheduler \ |
301 | test_scheduler_delay \ | 317 | test_scheduler_delay \ |
302 | test_service \ | 318 | test_service \ |
303 | test_strings \ | 319 | test_strings \ |
304 | test_strings_to_data \ | 320 | test_strings_to_data \ |
305 | test_time \ | ||
306 | test_speedup \ | 321 | test_speedup \ |
322 | test_time \ | ||
323 | test_tun \ | ||
307 | $(BENCHMARKS) \ | 324 | $(BENCHMARKS) \ |
308 | test_os_start_process \ | 325 | test_os_start_process \ |
309 | test_common_logging_runtime_loglevels | 326 | test_common_logging_runtime_loglevels |
@@ -319,6 +336,20 @@ test_bio_SOURCES = \ | |||
319 | test_bio_LDADD = \ | 336 | test_bio_LDADD = \ |
320 | libgnunetutil.la | 337 | libgnunetutil.la |
321 | 338 | ||
339 | test_hexcoder_SOURCES = \ | ||
340 | test_hexcoder.c | ||
341 | test_hexcoder_LDADD = \ | ||
342 | libgnunetutil.la | ||
343 | |||
344 | test_tun_SOURCES = \ | ||
345 | test_tun.c | ||
346 | test_tun_LDADD = \ | ||
347 | libgnunetutil.la | ||
348 | |||
349 | test_regex_SOURCES = \ | ||
350 | test_regex.c | ||
351 | test_regex_LDADD = \ | ||
352 | libgnunetutil.la | ||
322 | 353 | ||
323 | test_os_start_process_SOURCES = \ | 354 | test_os_start_process_SOURCES = \ |
324 | test_os_start_process.c | 355 | test_os_start_process.c |
@@ -601,4 +632,4 @@ EXTRA_DIST = \ | |||
601 | test_resolver_api_data.conf \ | 632 | test_resolver_api_data.conf \ |
602 | test_service_data.conf \ | 633 | test_service_data.conf \ |
603 | test_speedup_data.conf \ | 634 | test_speedup_data.conf \ |
604 | gnunet-qr.py.in | 635 | gnunet-qr.py.in |
diff --git a/src/util/client.c b/src/util/client.c index 44e326eab..1f569255a 100644 --- a/src/util/client.c +++ b/src/util/client.c | |||
@@ -11,7 +11,7 @@ | |||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | */ | 17 | */ |
@@ -721,6 +721,17 @@ test_service_configuration (const char *service_name, | |||
721 | &unixpath)) && | 721 | &unixpath)) && |
722 | (0 < strlen (unixpath))) | 722 | (0 < strlen (unixpath))) |
723 | ret = GNUNET_OK; | 723 | ret = GNUNET_OK; |
724 | else if ((GNUNET_OK == | ||
725 | GNUNET_CONFIGURATION_have_value (cfg, | ||
726 | service_name, | ||
727 | "UNIXPATH"))) | ||
728 | { | ||
729 | GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, | ||
730 | service_name, | ||
731 | "UNIXPATH", | ||
732 | _("not a valid filename")); | ||
733 | return GNUNET_SYSERR; /* UNIXPATH specified but invalid! */ | ||
734 | } | ||
724 | GNUNET_free_non_null (unixpath); | 735 | GNUNET_free_non_null (unixpath); |
725 | #endif | 736 | #endif |
726 | 737 | ||
diff --git a/src/dns/dnsparser.c b/src/util/dnsparser.c index 32ad7c0c2..6fb6d657f 100644 --- a/src/dns/dnsparser.c +++ b/src/util/dnsparser.c | |||
@@ -11,7 +11,7 @@ | |||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | */ | 17 | */ |
@@ -28,8 +28,6 @@ | |||
28 | #include <idn-free.h> | 28 | #include <idn-free.h> |
29 | #endif | 29 | #endif |
30 | #include "gnunet_util_lib.h" | 30 | #include "gnunet_util_lib.h" |
31 | #include "gnunet_dnsparser_lib.h" | ||
32 | #include "gnunet_tun_lib.h" | ||
33 | 31 | ||
34 | 32 | ||
35 | /** | 33 | /** |
@@ -545,7 +543,9 @@ GNUNET_DNSPARSER_parse_cert (const char *udp_payload, | |||
545 | GNUNET_break_op (0); | 543 | GNUNET_break_op (0); |
546 | return NULL; | 544 | return NULL; |
547 | } | 545 | } |
548 | GNUNET_memcpy (&dcert, &udp_payload[*off], sizeof (struct GNUNET_TUN_DnsCertRecord)); | 546 | GNUNET_memcpy (&dcert, |
547 | &udp_payload[*off], | ||
548 | sizeof (struct GNUNET_TUN_DnsCertRecord)); | ||
549 | (*off) += sizeof (struct GNUNET_TUN_DnsCertRecord); | 549 | (*off) += sizeof (struct GNUNET_TUN_DnsCertRecord); |
550 | cert = GNUNET_new (struct GNUNET_DNSPARSER_CertRecord); | 550 | cert = GNUNET_new (struct GNUNET_DNSPARSER_CertRecord); |
551 | cert->cert_type = ntohs (dcert.cert_type); | 551 | cert->cert_type = ntohs (dcert.cert_type); |
@@ -554,8 +554,8 @@ GNUNET_DNSPARSER_parse_cert (const char *udp_payload, | |||
554 | cert->certificate_size = udp_payload_length - (*off); | 554 | cert->certificate_size = udp_payload_length - (*off); |
555 | cert->certificate_data = GNUNET_malloc (cert->certificate_size); | 555 | cert->certificate_data = GNUNET_malloc (cert->certificate_size); |
556 | GNUNET_memcpy (cert->certificate_data, | 556 | GNUNET_memcpy (cert->certificate_data, |
557 | &udp_payload[*off], | 557 | &udp_payload[*off], |
558 | cert->certificate_size); | 558 | cert->certificate_size); |
559 | (*off) += cert->certificate_size; | 559 | (*off) += cert->certificate_size; |
560 | return cert; | 560 | return cert; |
561 | } | 561 | } |
@@ -684,7 +684,6 @@ GNUNET_DNSPARSER_parse (const char *udp_payload, | |||
684 | const struct GNUNET_TUN_DnsHeader *dns; | 684 | const struct GNUNET_TUN_DnsHeader *dns; |
685 | size_t off; | 685 | size_t off; |
686 | unsigned int n; | 686 | unsigned int n; |
687 | unsigned int i; | ||
688 | 687 | ||
689 | if (udp_payload_length < sizeof (struct GNUNET_TUN_DnsHeader)) | 688 | if (udp_payload_length < sizeof (struct GNUNET_TUN_DnsHeader)) |
690 | return NULL; | 689 | return NULL; |
@@ -696,9 +695,10 @@ GNUNET_DNSPARSER_parse (const char *udp_payload, | |||
696 | n = ntohs (dns->query_count); | 695 | n = ntohs (dns->query_count); |
697 | if (n > 0) | 696 | if (n > 0) |
698 | { | 697 | { |
699 | p->queries = GNUNET_malloc (n * sizeof (struct GNUNET_DNSPARSER_Query)); | 698 | p->queries = GNUNET_new_array (n, |
699 | struct GNUNET_DNSPARSER_Query); | ||
700 | p->num_queries = n; | 700 | p->num_queries = n; |
701 | for (i=0;i<n;i++) | 701 | for (unsigned int i=0;i<n;i++) |
702 | if (GNUNET_OK != | 702 | if (GNUNET_OK != |
703 | GNUNET_DNSPARSER_parse_query (udp_payload, | 703 | GNUNET_DNSPARSER_parse_query (udp_payload, |
704 | udp_payload_length, | 704 | udp_payload_length, |
@@ -709,9 +709,10 @@ GNUNET_DNSPARSER_parse (const char *udp_payload, | |||
709 | n = ntohs (dns->answer_rcount); | 709 | n = ntohs (dns->answer_rcount); |
710 | if (n > 0) | 710 | if (n > 0) |
711 | { | 711 | { |
712 | p->answers = GNUNET_malloc (n * sizeof (struct GNUNET_DNSPARSER_Record)); | 712 | p->answers = GNUNET_new_array (n, |
713 | struct GNUNET_DNSPARSER_Record); | ||
713 | p->num_answers = n; | 714 | p->num_answers = n; |
714 | for (i=0;i<n;i++) | 715 | for (unsigned int i=0;i<n;i++) |
715 | if (GNUNET_OK != | 716 | if (GNUNET_OK != |
716 | GNUNET_DNSPARSER_parse_record (udp_payload, | 717 | GNUNET_DNSPARSER_parse_record (udp_payload, |
717 | udp_payload_length, | 718 | udp_payload_length, |
@@ -722,9 +723,10 @@ GNUNET_DNSPARSER_parse (const char *udp_payload, | |||
722 | n = ntohs (dns->authority_rcount); | 723 | n = ntohs (dns->authority_rcount); |
723 | if (n > 0) | 724 | if (n > 0) |
724 | { | 725 | { |
725 | p->authority_records = GNUNET_malloc (n * sizeof (struct GNUNET_DNSPARSER_Record)); | 726 | p->authority_records = GNUNET_new_array (n, |
727 | struct GNUNET_DNSPARSER_Record); | ||
726 | p->num_authority_records = n; | 728 | p->num_authority_records = n; |
727 | for (i=0;i<n;i++) | 729 | for (unsigned int i=0;i<n;i++) |
728 | if (GNUNET_OK != | 730 | if (GNUNET_OK != |
729 | GNUNET_DNSPARSER_parse_record (udp_payload, | 731 | GNUNET_DNSPARSER_parse_record (udp_payload, |
730 | udp_payload_length, | 732 | udp_payload_length, |
@@ -735,15 +737,18 @@ GNUNET_DNSPARSER_parse (const char *udp_payload, | |||
735 | n = ntohs (dns->additional_rcount); | 737 | n = ntohs (dns->additional_rcount); |
736 | if (n > 0) | 738 | if (n > 0) |
737 | { | 739 | { |
738 | p->additional_records = GNUNET_malloc (n * sizeof (struct GNUNET_DNSPARSER_Record)); | 740 | p->additional_records = GNUNET_new_array (n, |
741 | struct GNUNET_DNSPARSER_Record); | ||
739 | p->num_additional_records = n; | 742 | p->num_additional_records = n; |
740 | for (i=0;i<n;i++) | 743 | for (unsigned int i=0;i<n;i++) |
744 | { | ||
741 | if (GNUNET_OK != | 745 | if (GNUNET_OK != |
742 | GNUNET_DNSPARSER_parse_record (udp_payload, | 746 | GNUNET_DNSPARSER_parse_record (udp_payload, |
743 | udp_payload_length, | 747 | udp_payload_length, |
744 | &off, | 748 | &off, |
745 | &p->additional_records[i])) | 749 | &p->additional_records[i])) |
746 | goto error; | 750 | goto error; |
751 | } | ||
747 | } | 752 | } |
748 | return p; | 753 | return p; |
749 | error: | 754 | error: |
@@ -754,6 +759,122 @@ GNUNET_DNSPARSER_parse (const char *udp_payload, | |||
754 | 759 | ||
755 | 760 | ||
756 | /** | 761 | /** |
762 | * Duplicate (deep-copy) the given DNS record | ||
763 | * | ||
764 | * @param r the record | ||
765 | * @return the newly allocated record | ||
766 | */ | ||
767 | struct GNUNET_DNSPARSER_Record * | ||
768 | GNUNET_DNSPARSER_duplicate_record (const struct GNUNET_DNSPARSER_Record *r) | ||
769 | { | ||
770 | struct GNUNET_DNSPARSER_Record *dup = GNUNET_memdup (r, sizeof (*r)); | ||
771 | |||
772 | dup->name = GNUNET_strdup (r->name); | ||
773 | switch (r->type) | ||
774 | { | ||
775 | case GNUNET_DNSPARSER_TYPE_NS: | ||
776 | case GNUNET_DNSPARSER_TYPE_CNAME: | ||
777 | case GNUNET_DNSPARSER_TYPE_PTR: | ||
778 | { | ||
779 | dup->data.hostname = GNUNET_strdup (r->data.hostname); | ||
780 | break; | ||
781 | } | ||
782 | case GNUNET_DNSPARSER_TYPE_SOA: | ||
783 | { | ||
784 | dup->data.soa = GNUNET_DNSPARSER_duplicate_soa_record (r->data.soa); | ||
785 | break; | ||
786 | } | ||
787 | case GNUNET_DNSPARSER_TYPE_CERT: | ||
788 | { | ||
789 | dup->data.cert = GNUNET_DNSPARSER_duplicate_cert_record (r->data.cert); | ||
790 | break; | ||
791 | } | ||
792 | case GNUNET_DNSPARSER_TYPE_MX: | ||
793 | { | ||
794 | dup->data.mx = GNUNET_DNSPARSER_duplicate_mx_record (r->data.mx); | ||
795 | break; | ||
796 | } | ||
797 | case GNUNET_DNSPARSER_TYPE_SRV: | ||
798 | { | ||
799 | dup->data.srv = GNUNET_DNSPARSER_duplicate_srv_record (r->data.srv); | ||
800 | break; | ||
801 | } | ||
802 | default: | ||
803 | { | ||
804 | dup->data.raw.data = GNUNET_memdup (r->data.raw.data, | ||
805 | r->data.raw.data_len); | ||
806 | } | ||
807 | } | ||
808 | return dup; | ||
809 | } | ||
810 | |||
811 | |||
812 | /** | ||
813 | * Duplicate (deep-copy) the given DNS record | ||
814 | * | ||
815 | * @param r the record | ||
816 | * @return the newly allocated record | ||
817 | */ | ||
818 | struct GNUNET_DNSPARSER_SoaRecord * | ||
819 | GNUNET_DNSPARSER_duplicate_soa_record (const struct GNUNET_DNSPARSER_SoaRecord *r) | ||
820 | { | ||
821 | struct GNUNET_DNSPARSER_SoaRecord *dup = GNUNET_memdup (r, sizeof (*r)); | ||
822 | |||
823 | dup->mname = GNUNET_strdup (r->mname); | ||
824 | dup->rname = GNUNET_strdup (r->rname); | ||
825 | return dup; | ||
826 | } | ||
827 | |||
828 | |||
829 | /** | ||
830 | * Duplicate (deep-copy) the given DNS record | ||
831 | * | ||
832 | * @param r the record | ||
833 | * @return the newly allocated record | ||
834 | */ | ||
835 | struct GNUNET_DNSPARSER_CertRecord * | ||
836 | GNUNET_DNSPARSER_duplicate_cert_record (const struct GNUNET_DNSPARSER_CertRecord *r) | ||
837 | { | ||
838 | struct GNUNET_DNSPARSER_CertRecord *dup = GNUNET_memdup (r, sizeof (*r)); | ||
839 | |||
840 | dup->certificate_data = GNUNET_strdup (r->certificate_data); | ||
841 | return dup; | ||
842 | } | ||
843 | |||
844 | |||
845 | /** | ||
846 | * Duplicate (deep-copy) the given DNS record | ||
847 | * | ||
848 | * @param r the record | ||
849 | * @return the newly allocated record | ||
850 | */ | ||
851 | struct GNUNET_DNSPARSER_MxRecord * | ||
852 | GNUNET_DNSPARSER_duplicate_mx_record (const struct GNUNET_DNSPARSER_MxRecord *r) | ||
853 | { | ||
854 | struct GNUNET_DNSPARSER_MxRecord *dup = GNUNET_memdup (r, sizeof (*r)); | ||
855 | |||
856 | dup->mxhost = GNUNET_strdup (r->mxhost); | ||
857 | return dup; | ||
858 | } | ||
859 | |||
860 | |||
861 | /** | ||
862 | * Duplicate (deep-copy) the given DNS record | ||
863 | * | ||
864 | * @param r the record | ||
865 | * @return the newly allocated record | ||
866 | */ | ||
867 | struct GNUNET_DNSPARSER_SrvRecord * | ||
868 | GNUNET_DNSPARSER_duplicate_srv_record (const struct GNUNET_DNSPARSER_SrvRecord *r) | ||
869 | { | ||
870 | struct GNUNET_DNSPARSER_SrvRecord *dup = GNUNET_memdup (r, sizeof (*r)); | ||
871 | |||
872 | dup->target = GNUNET_strdup (r->target); | ||
873 | return dup; | ||
874 | } | ||
875 | |||
876 | |||
877 | /** | ||
757 | * Free memory taken by a packet. | 878 | * Free memory taken by a packet. |
758 | * | 879 | * |
759 | * @param p packet to free | 880 | * @param p packet to free |
@@ -761,18 +882,16 @@ GNUNET_DNSPARSER_parse (const char *udp_payload, | |||
761 | void | 882 | void |
762 | GNUNET_DNSPARSER_free_packet (struct GNUNET_DNSPARSER_Packet *p) | 883 | GNUNET_DNSPARSER_free_packet (struct GNUNET_DNSPARSER_Packet *p) |
763 | { | 884 | { |
764 | unsigned int i; | 885 | for (unsigned int i=0;i<p->num_queries;i++) |
765 | |||
766 | for (i=0;i<p->num_queries;i++) | ||
767 | GNUNET_free_non_null (p->queries[i].name); | 886 | GNUNET_free_non_null (p->queries[i].name); |
768 | GNUNET_free_non_null (p->queries); | 887 | GNUNET_free_non_null (p->queries); |
769 | for (i=0;i<p->num_answers;i++) | 888 | for (unsigned int i=0;i<p->num_answers;i++) |
770 | GNUNET_DNSPARSER_free_record (&p->answers[i]); | 889 | GNUNET_DNSPARSER_free_record (&p->answers[i]); |
771 | GNUNET_free_non_null (p->answers); | 890 | GNUNET_free_non_null (p->answers); |
772 | for (i=0;i<p->num_authority_records;i++) | 891 | for (unsigned int i=0;i<p->num_authority_records;i++) |
773 | GNUNET_DNSPARSER_free_record (&p->authority_records[i]); | 892 | GNUNET_DNSPARSER_free_record (&p->authority_records[i]); |
774 | GNUNET_free_non_null (p->authority_records); | 893 | GNUNET_free_non_null (p->authority_records); |
775 | for (i=0;i<p->num_additional_records;i++) | 894 | for (unsigned int i=0;i<p->num_additional_records;i++) |
776 | GNUNET_DNSPARSER_free_record (&p->additional_records[i]); | 895 | GNUNET_DNSPARSER_free_record (&p->additional_records[i]); |
777 | GNUNET_free_non_null (p->additional_records); | 896 | GNUNET_free_non_null (p->additional_records); |
778 | GNUNET_free (p); | 897 | GNUNET_free (p); |
@@ -837,8 +956,11 @@ GNUNET_DNSPARSER_builder_add_name (char *dst, | |||
837 | len = dot - idna_name; | 956 | len = dot - idna_name; |
838 | if ( (len >= 64) || (0 == len) ) | 957 | if ( (len >= 64) || (0 == len) ) |
839 | { | 958 | { |
840 | GNUNET_break (0); | 959 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
841 | goto fail; /* segment too long or empty */ | 960 | "Invalid DNS name `%s': label with %u characters encountered\n", |
961 | name, | ||
962 | len); | ||
963 | goto fail; /* label too long or empty */ | ||
842 | } | 964 | } |
843 | dst[pos++] = (char) (uint8_t) len; | 965 | dst[pos++] = (char) (uint8_t) len; |
844 | GNUNET_memcpy (&dst[pos], | 966 | GNUNET_memcpy (&dst[pos], |
@@ -953,7 +1075,6 @@ GNUNET_DNSPARSER_builder_add_cert (char *dst, | |||
953 | struct GNUNET_TUN_DnsCertRecord dcert; | 1075 | struct GNUNET_TUN_DnsCertRecord dcert; |
954 | 1076 | ||
955 | if ( (cert->cert_type > UINT16_MAX) || | 1077 | if ( (cert->cert_type > UINT16_MAX) || |
956 | (cert->cert_tag > UINT16_MAX) || | ||
957 | (cert->algorithm > UINT8_MAX) ) | 1078 | (cert->algorithm > UINT8_MAX) ) |
958 | { | 1079 | { |
959 | GNUNET_break (0); | 1080 | GNUNET_break (0); |
@@ -1041,12 +1162,14 @@ GNUNET_DNSPARSER_builder_add_srv (char *dst, | |||
1041 | sd.prio = htons (srv->priority); | 1162 | sd.prio = htons (srv->priority); |
1042 | sd.weight = htons (srv->weight); | 1163 | sd.weight = htons (srv->weight); |
1043 | sd.port = htons (srv->port); | 1164 | sd.port = htons (srv->port); |
1044 | GNUNET_memcpy (&dst[*off], &sd, sizeof (sd)); | 1165 | GNUNET_memcpy (&dst[*off], |
1166 | &sd, | ||
1167 | sizeof (sd)); | ||
1045 | (*off) += sizeof (sd); | 1168 | (*off) += sizeof (sd); |
1046 | if (GNUNET_OK != (ret = GNUNET_DNSPARSER_builder_add_name (dst, | 1169 | if (GNUNET_OK != (ret = GNUNET_DNSPARSER_builder_add_name (dst, |
1047 | dst_len, | 1170 | dst_len, |
1048 | off, | 1171 | off, |
1049 | srv->target))) | 1172 | srv->target))) |
1050 | return ret; | 1173 | return ret; |
1051 | return GNUNET_OK; | 1174 | return GNUNET_OK; |
1052 | } | 1175 | } |
@@ -1148,7 +1271,9 @@ add_record (char *dst, | |||
1148 | rl.dns_traffic_class = htons (record->dns_traffic_class); | 1271 | rl.dns_traffic_class = htons (record->dns_traffic_class); |
1149 | rl.ttl = htonl (GNUNET_TIME_absolute_get_remaining (record->expiration_time).rel_value_us / 1000LL / 1000LL); /* in seconds */ | 1272 | rl.ttl = htonl (GNUNET_TIME_absolute_get_remaining (record->expiration_time).rel_value_us / 1000LL / 1000LL); /* in seconds */ |
1150 | rl.data_len = htons ((uint16_t) (pos - (*off + sizeof (struct GNUNET_TUN_DnsRecordLine)))); | 1273 | rl.data_len = htons ((uint16_t) (pos - (*off + sizeof (struct GNUNET_TUN_DnsRecordLine)))); |
1151 | GNUNET_memcpy (&dst[*off], &rl, sizeof (struct GNUNET_TUN_DnsRecordLine)); | 1274 | GNUNET_memcpy (&dst[*off], |
1275 | &rl, | ||
1276 | sizeof (struct GNUNET_TUN_DnsRecordLine)); | ||
1152 | *off = pos; | 1277 | *off = pos; |
1153 | return GNUNET_OK; | 1278 | return GNUNET_OK; |
1154 | } | 1279 | } |
@@ -1177,7 +1302,6 @@ GNUNET_DNSPARSER_pack (const struct GNUNET_DNSPARSER_Packet *p, | |||
1177 | struct GNUNET_TUN_DnsHeader dns; | 1302 | struct GNUNET_TUN_DnsHeader dns; |
1178 | size_t off; | 1303 | size_t off; |
1179 | char tmp[max]; | 1304 | char tmp[max]; |
1180 | unsigned int i; | ||
1181 | int ret; | 1305 | int ret; |
1182 | int trc; | 1306 | int trc; |
1183 | 1307 | ||
@@ -1195,7 +1319,7 @@ GNUNET_DNSPARSER_pack (const struct GNUNET_DNSPARSER_Packet *p, | |||
1195 | 1319 | ||
1196 | off = sizeof (struct GNUNET_TUN_DnsHeader); | 1320 | off = sizeof (struct GNUNET_TUN_DnsHeader); |
1197 | trc = GNUNET_NO; | 1321 | trc = GNUNET_NO; |
1198 | for (i=0;i<p->num_queries;i++) | 1322 | for (unsigned int i=0;i<p->num_queries;i++) |
1199 | { | 1323 | { |
1200 | ret = GNUNET_DNSPARSER_builder_add_query (tmp, | 1324 | ret = GNUNET_DNSPARSER_builder_add_query (tmp, |
1201 | sizeof (tmp), | 1325 | sizeof (tmp), |
@@ -1210,7 +1334,7 @@ GNUNET_DNSPARSER_pack (const struct GNUNET_DNSPARSER_Packet *p, | |||
1210 | break; | 1334 | break; |
1211 | } | 1335 | } |
1212 | } | 1336 | } |
1213 | for (i=0;i<p->num_answers;i++) | 1337 | for (unsigned int i=0;i<p->num_answers;i++) |
1214 | { | 1338 | { |
1215 | ret = add_record (tmp, | 1339 | ret = add_record (tmp, |
1216 | sizeof (tmp), | 1340 | sizeof (tmp), |
@@ -1225,7 +1349,7 @@ GNUNET_DNSPARSER_pack (const struct GNUNET_DNSPARSER_Packet *p, | |||
1225 | break; | 1349 | break; |
1226 | } | 1350 | } |
1227 | } | 1351 | } |
1228 | for (i=0;i<p->num_authority_records;i++) | 1352 | for (unsigned int i=0;i<p->num_authority_records;i++) |
1229 | { | 1353 | { |
1230 | ret = add_record (tmp, | 1354 | ret = add_record (tmp, |
1231 | sizeof (tmp), | 1355 | sizeof (tmp), |
@@ -1240,7 +1364,7 @@ GNUNET_DNSPARSER_pack (const struct GNUNET_DNSPARSER_Packet *p, | |||
1240 | break; | 1364 | break; |
1241 | } | 1365 | } |
1242 | } | 1366 | } |
1243 | for (i=0;i<p->num_additional_records;i++) | 1367 | for (unsigned int i=0;i<p->num_additional_records;i++) |
1244 | { | 1368 | { |
1245 | ret = add_record (tmp, | 1369 | ret = add_record (tmp, |
1246 | sizeof (tmp), | 1370 | sizeof (tmp), |
diff --git a/src/dns/dnsstub.c b/src/util/dnsstub.c index 969ff7beb..5b84e6e63 100644 --- a/src/dns/dnsstub.c +++ b/src/util/dnsstub.c | |||
@@ -22,8 +22,6 @@ | |||
22 | */ | 22 | */ |
23 | #include "platform.h" | 23 | #include "platform.h" |
24 | #include "gnunet_util_lib.h" | 24 | #include "gnunet_util_lib.h" |
25 | #include "gnunet_tun_lib.h" | ||
26 | #include "gnunet_dnsstub_lib.h" | ||
27 | 25 | ||
28 | /** | 26 | /** |
29 | * Timeout for retrying DNS queries. | 27 | * Timeout for retrying DNS queries. |
@@ -356,7 +354,7 @@ do_dns_read (struct GNUNET_DNSSTUB_RequestSocket *rs, | |||
356 | "Received DNS response from server we never asked (ignored)"); | 354 | "Received DNS response from server we never asked (ignored)"); |
357 | return GNUNET_NO; | 355 | return GNUNET_NO; |
358 | } | 356 | } |
359 | if (sizeof (struct GNUNET_TUN_DnsHeader) > r) | 357 | if (sizeof (struct GNUNET_TUN_DnsHeader) > (size_t) r) |
360 | { | 358 | { |
361 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 359 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
362 | _("Received DNS response that is too small (%u bytes)"), | 360 | _("Received DNS response that is too small (%u bytes)"), |
diff --git a/src/util/gnunet-config.c b/src/util/gnunet-config.c index 16b826ee2..4528bbe24 100644 --- a/src/util/gnunet-config.c +++ b/src/util/gnunet-config.c | |||
@@ -75,27 +75,36 @@ print_option (void *cls, | |||
75 | const char *option, | 75 | const char *option, |
76 | const char *value) | 76 | const char *value) |
77 | { | 77 | { |
78 | (void) section; | ||
79 | const struct GNUNET_CONFIGURATION_Handle *cfg = cls; | 78 | const struct GNUNET_CONFIGURATION_Handle *cfg = cls; |
80 | char *value_fn; | 79 | |
80 | (void) section; | ||
81 | if (is_filename) | 81 | if (is_filename) |
82 | { | 82 | { |
83 | char *value_fn; | ||
84 | char *fn; | ||
85 | |||
83 | GNUNET_assert (GNUNET_OK == | 86 | GNUNET_assert (GNUNET_OK == |
84 | GNUNET_CONFIGURATION_get_value_filename (cfg, | 87 | GNUNET_CONFIGURATION_get_value_filename (cfg, |
85 | section, | 88 | section, |
86 | option, | 89 | option, |
87 | &value_fn)); | 90 | &value_fn)); |
91 | fn = GNUNET_STRINGS_filename_expand (value_fn); | ||
92 | if (NULL == fn) | ||
93 | fn = value_fn; | ||
94 | else | ||
95 | GNUNET_free (value_fn); | ||
88 | fprintf (stdout, | 96 | fprintf (stdout, |
89 | "%s = %s\n", | 97 | "%s = %s\n", |
90 | option, | 98 | option, |
91 | GNUNET_STRINGS_filename_expand (value_fn)); | 99 | fn); |
100 | GNUNET_free (fn); | ||
92 | } | 101 | } |
93 | else | 102 | else |
94 | { | 103 | { |
95 | fprintf (stdout, | 104 | fprintf (stdout, |
96 | "%s = %s\n", | 105 | "%s = %s\n", |
97 | option, | 106 | option, |
98 | value); | 107 | value); |
99 | } | 108 | } |
100 | } | 109 | } |
101 | 110 | ||
diff --git a/src/util/gnunet-service-resolver.c b/src/util/gnunet-service-resolver.c index d90d8ec10..5b890261b 100644 --- a/src/util/gnunet-service-resolver.c +++ b/src/util/gnunet-service-resolver.c | |||
@@ -27,721 +27,559 @@ | |||
27 | #include "gnunet_statistics_service.h" | 27 | #include "gnunet_statistics_service.h" |
28 | #include "resolver.h" | 28 | #include "resolver.h" |
29 | 29 | ||
30 | |||
31 | struct Record | ||
32 | { | ||
33 | struct Record *next; | ||
34 | |||
35 | struct Record *prev; | ||
36 | |||
37 | struct GNUNET_DNSPARSER_Record *record; | ||
38 | }; | ||
39 | |||
30 | /** | 40 | /** |
31 | * A cached DNS lookup result (for reverse lookup). | 41 | * A cached DNS lookup result. |
32 | */ | 42 | */ |
33 | struct IPCache | 43 | struct ResolveCache |
34 | { | 44 | { |
35 | /** | 45 | /** |
36 | * This is a doubly linked list. | 46 | * This is a doubly linked list. |
37 | */ | 47 | */ |
38 | struct IPCache *next; | 48 | struct ResolveCache *next; |
39 | 49 | ||
40 | /** | 50 | /** |
41 | * This is a doubly linked list. | 51 | * This is a doubly linked list. |
42 | */ | 52 | */ |
43 | struct IPCache *prev; | 53 | struct ResolveCache *prev; |
44 | 54 | ||
45 | /** | 55 | /** |
46 | * Hostname in human-readable form. | 56 | * type of queried DNS record |
47 | */ | 57 | */ |
48 | char *addr; | 58 | uint16_t record_type; |
49 | 59 | ||
50 | /** | 60 | /** |
51 | * Binary IP address, allocated at the end of this struct. | 61 | * a pointer to the request_id if a query for this hostname/record_type |
62 | * is currently pending, NULL otherwise. | ||
52 | */ | 63 | */ |
53 | const void *ip; | 64 | int16_t *request_id; |
54 | 65 | ||
55 | /** | 66 | /** |
56 | * Last time this entry was updated. | 67 | * The client that queried the records contained in this cache entry. |
57 | */ | 68 | */ |
58 | struct GNUNET_TIME_Absolute last_refresh; | 69 | struct GNUNET_SERVICE_Client *client; |
59 | 70 | ||
60 | /** | 71 | /** |
61 | * Last time this entry was requested. | 72 | * head of a double linked list containing the lookup results |
62 | */ | 73 | */ |
63 | struct GNUNET_TIME_Absolute last_request; | 74 | struct Record *records_head; |
64 | 75 | ||
65 | /** | 76 | /** |
66 | * Number of bytes in ip. | 77 | * tail of a double linked list containing the lookup results |
67 | */ | 78 | */ |
68 | size_t ip_len; | 79 | struct Record *records_tail; |
69 | 80 | ||
70 | /** | 81 | /** |
71 | * Address family of the IP. | 82 | * handle for cancelling a request |
72 | */ | 83 | */ |
73 | int af; | 84 | struct GNUNET_DNSSTUB_RequestSocket *resolve_handle; |
85 | |||
86 | /** | ||
87 | * handle for the resolution timeout task | ||
88 | */ | ||
89 | struct GNUNET_SCHEDULER_Task *timeout_task; | ||
90 | |||
74 | }; | 91 | }; |
75 | 92 | ||
76 | 93 | ||
77 | /** | 94 | /** |
78 | * Start of the linked list of cached DNS lookup results. | 95 | * Start of the linked list of cached DNS lookup results. |
79 | */ | 96 | */ |
80 | static struct IPCache *cache_head; | 97 | static struct ResolveCache *cache_head; |
81 | 98 | ||
82 | /** | 99 | /** |
83 | * Tail of the linked list of cached DNS lookup results. | 100 | * Tail of the linked list of cached DNS lookup results. |
84 | */ | 101 | */ |
85 | static struct IPCache *cache_tail; | 102 | static struct ResolveCache *cache_tail; |
86 | 103 | ||
87 | /** | 104 | /** |
88 | * Pipe for asynchronously notifying about resolve result | 105 | * context of dnsstub library |
89 | */ | 106 | */ |
90 | static struct GNUNET_DISK_PipeHandle *resolve_result_pipe; | 107 | static struct GNUNET_DNSSTUB_Context *dnsstub_ctx; |
91 | 108 | ||
92 | /** | ||
93 | * Task for reading from resolve_result_pipe | ||
94 | */ | ||
95 | static struct GNUNET_SCHEDULER_Task *resolve_result_pipe_task; | ||
96 | 109 | ||
97 | 110 | void free_cache_entry (struct ResolveCache *entry) | |
98 | #if HAVE_GETNAMEINFO | ||
99 | /** | ||
100 | * Resolve the given request using getnameinfo | ||
101 | * | ||
102 | * @param cache the request to resolve (and where to store the result) | ||
103 | */ | ||
104 | static void | ||
105 | getnameinfo_resolve (struct IPCache *cache) | ||
106 | { | 111 | { |
107 | char hostname[256]; | 112 | struct Record *pos; |
108 | const struct sockaddr *sa; | 113 | struct Record *next; |
109 | struct sockaddr_in v4; | 114 | |
110 | struct sockaddr_in6 v6; | 115 | next = entry->records_head; |
111 | size_t salen; | 116 | while (NULL != (pos = next)) |
112 | int ret; | ||
113 | |||
114 | switch (cache->af) | ||
115 | { | 117 | { |
116 | case AF_INET: | 118 | next = pos->next; |
117 | GNUNET_assert (cache->ip_len == sizeof (struct in_addr)); | 119 | GNUNET_CONTAINER_DLL_remove (entry->records_head, |
118 | sa = (const struct sockaddr*) &v4; | 120 | entry->records_tail, |
119 | memset (&v4, 0, sizeof (v4)); | 121 | pos); |
120 | v4.sin_addr = * (const struct in_addr*) cache->ip; | 122 | if (NULL != pos->record) |
121 | v4.sin_family = AF_INET; | 123 | { |
122 | #if HAVE_SOCKADDR_IN_SIN_LEN | 124 | GNUNET_DNSPARSER_free_record (pos->record); |
123 | v4.sin_len = sizeof (v4); | 125 | GNUNET_free (pos->record); |
124 | #endif | 126 | } |
125 | salen = sizeof (v4); | 127 | GNUNET_free (pos); |
126 | break; | ||
127 | case AF_INET6: | ||
128 | GNUNET_assert (cache->ip_len == sizeof (struct in6_addr)); | ||
129 | sa = (const struct sockaddr*) &v6; | ||
130 | memset (&v6, 0, sizeof (v6)); | ||
131 | v6.sin6_addr = * (const struct in6_addr*) cache->ip; | ||
132 | v6.sin6_family = AF_INET6; | ||
133 | #if HAVE_SOCKADDR_IN_SIN_LEN | ||
134 | v6.sin6_len = sizeof (v6); | ||
135 | #endif | ||
136 | salen = sizeof (v6); | ||
137 | break; | ||
138 | default: | ||
139 | GNUNET_assert (0); | ||
140 | } | 128 | } |
141 | 129 | if (NULL != entry->resolve_handle) | |
142 | if (0 == | ||
143 | (ret = getnameinfo (sa, salen, | ||
144 | hostname, sizeof (hostname), | ||
145 | NULL, | ||
146 | 0, 0))) | ||
147 | { | 130 | { |
148 | cache->addr = GNUNET_strdup (hostname); | 131 | GNUNET_DNSSTUB_resolve_cancel (entry->resolve_handle); |
132 | entry->resolve_handle = NULL; | ||
149 | } | 133 | } |
150 | else | 134 | if (NULL != entry->timeout_task) |
151 | { | 135 | { |
152 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 136 | GNUNET_SCHEDULER_cancel (entry->timeout_task); |
153 | "getnameinfo failed: %s\n", | 137 | entry->timeout_task = NULL; |
154 | gai_strerror (ret)); | ||
155 | } | 138 | } |
139 | GNUNET_free_non_null (entry->request_id); | ||
140 | GNUNET_free (entry); | ||
156 | } | 141 | } |
157 | #endif | ||
158 | 142 | ||
159 | 143 | ||
160 | #if HAVE_GETHOSTBYADDR | 144 | static char* |
145 | extract_dns_server (const char* line, size_t line_len) | ||
146 | { | ||
147 | if (0 == strncmp (line, "nameserver ", 11)) | ||
148 | return GNUNET_strndup (line + 11, line_len - 11); | ||
149 | return NULL; | ||
150 | } | ||
151 | |||
152 | |||
161 | /** | 153 | /** |
162 | * Resolve the given request using gethostbyaddr | 154 | * reads the list of nameservers from /etc/resolve.conf |
163 | * | 155 | * |
164 | * @param cache the request to resolve (and where to store the result) | 156 | * @param server_addrs[out] a list of null-terminated server address strings |
157 | * @return the number of server addresses in @server_addrs, -1 on error | ||
165 | */ | 158 | */ |
166 | static void | 159 | static ssize_t |
167 | gethostbyaddr_resolve (struct IPCache *cache) | 160 | lookup_dns_servers (char ***server_addrs) |
168 | { | 161 | { |
169 | struct hostent *ent; | 162 | struct GNUNET_DISK_FileHandle *fh; |
170 | 163 | char buf[2048]; | |
171 | ent = gethostbyaddr (cache->ip, | 164 | ssize_t bytes_read; |
172 | cache->ip_len, | 165 | size_t read_offset = 0; |
173 | cache->af); | 166 | unsigned int num_dns_servers = 0; |
174 | if (NULL != ent) | 167 | |
168 | fh = GNUNET_DISK_file_open ("/etc/resolv.conf", | ||
169 | GNUNET_DISK_OPEN_READ, | ||
170 | GNUNET_DISK_PERM_NONE); | ||
171 | if (NULL == fh) | ||
175 | { | 172 | { |
176 | cache->addr = GNUNET_strdup (ent->h_name); | 173 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
174 | "Could not open /etc/resolv.conf. " | ||
175 | "DNS resolution will not be possible.\n"); | ||
176 | return -1; | ||
177 | } | 177 | } |
178 | else | 178 | bytes_read = GNUNET_DISK_file_read (fh, |
179 | buf, | ||
180 | sizeof (buf)); | ||
181 | *server_addrs = NULL; | ||
182 | while (read_offset < bytes_read) | ||
179 | { | 183 | { |
180 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 184 | char *newline; |
181 | "gethostbyaddr failed: %s\n", | 185 | size_t line_len; |
182 | hstrerror (h_errno)); | 186 | char *dns_server; |
187 | |||
188 | newline = strchr (buf + read_offset, '\n'); | ||
189 | if (NULL == newline) | ||
190 | { | ||
191 | break; | ||
192 | } | ||
193 | line_len = newline - buf - read_offset; | ||
194 | dns_server = extract_dns_server (buf + read_offset, line_len); | ||
195 | if (NULL != dns_server) | ||
196 | { | ||
197 | GNUNET_array_append (*server_addrs, | ||
198 | num_dns_servers, | ||
199 | dns_server); | ||
200 | } | ||
201 | read_offset += line_len + 1; | ||
183 | } | 202 | } |
203 | GNUNET_DISK_file_close (fh); | ||
204 | return num_dns_servers; | ||
184 | } | 205 | } |
185 | #endif | ||
186 | 206 | ||
187 | 207 | ||
188 | /** | 208 | static char * |
189 | * Resolve the given request using the available methods. | 209 | make_reverse_hostname (const void *ip, int af) |
190 | * | ||
191 | * @param cache the request to resolve (and where to store the result) | ||
192 | */ | ||
193 | static void | ||
194 | cache_resolve (struct IPCache *cache) | ||
195 | { | 210 | { |
196 | #if HAVE_GETNAMEINFO | 211 | char *buf = GNUNET_new_array (80, char); |
197 | if (NULL == cache->addr) | 212 | int pos = 0; |
198 | getnameinfo_resolve (cache); | 213 | if (AF_INET == af) |
199 | #endif | 214 | { |
200 | #if HAVE_GETHOSTBYADDR | 215 | struct in_addr *addr = (struct in_addr *)ip; |
201 | if (NULL == cache->addr) | 216 | uint32_t ip_int = addr->s_addr; |
202 | gethostbyaddr_resolve (cache); | 217 | for (int i = 3; i >= 0; i--) |
203 | #endif | 218 | { |
219 | int n = GNUNET_snprintf (buf + pos, | ||
220 | 80 - pos, | ||
221 | "%u.", | ||
222 | ((uint8_t *)&ip_int)[i]); | ||
223 | if (n < 0) | ||
224 | { | ||
225 | GNUNET_free (buf); | ||
226 | return NULL; | ||
227 | } | ||
228 | pos += n; | ||
229 | } | ||
230 | pos += GNUNET_snprintf (buf + pos, 80 - pos, "in-addr.arpa"); | ||
231 | } | ||
232 | else if (AF_INET6 == af) | ||
233 | { | ||
234 | struct in6_addr *addr = (struct in6_addr *)ip; | ||
235 | for (int i = 15; i >= 0; i--) | ||
236 | { | ||
237 | int n = GNUNET_snprintf (buf + pos, 80 - pos, "%x.", addr->s6_addr[i] & 0xf); | ||
238 | if (n < 0) | ||
239 | { | ||
240 | GNUNET_free (buf); | ||
241 | return NULL; | ||
242 | } | ||
243 | pos += n; | ||
244 | n = GNUNET_snprintf (buf + pos, 80 - pos, "%x.", addr->s6_addr[i] >> 4); | ||
245 | if (n < 0) | ||
246 | { | ||
247 | GNUNET_free (buf); | ||
248 | return NULL; | ||
249 | } | ||
250 | pos += n; | ||
251 | } | ||
252 | pos += GNUNET_snprintf (buf + pos, 80 - pos, "ip6.arpa"); | ||
253 | } | ||
254 | buf[pos] = '\0'; | ||
255 | return buf; | ||
204 | } | 256 | } |
205 | 257 | ||
206 | 258 | ||
207 | /** | ||
208 | * Function called after the replies for the request have all | ||
209 | * been transmitted to the client, and we can now read the next | ||
210 | * request from the client. | ||
211 | * | ||
212 | * @param cls the `struct GNUNET_SERVICE_Client` to continue with | ||
213 | */ | ||
214 | static void | 259 | static void |
215 | notify_service_client_done (void *cls) | 260 | send_reply (struct GNUNET_DNSPARSER_Record *record, |
261 | uint16_t request_id, | ||
262 | struct GNUNET_SERVICE_Client *client) | ||
216 | { | 263 | { |
217 | struct GNUNET_SERVICE_Client *client = cls; | ||
218 | |||
219 | GNUNET_SERVICE_client_continue (client); | ||
220 | } | ||
221 | |||
222 | |||
223 | /** | ||
224 | * Get an IP address as a string (works for both IPv4 and IPv6). Note | ||
225 | * that the resolution happens asynchronously and that the first call | ||
226 | * may not immediately result in the FQN (but instead in a | ||
227 | * human-readable IP address). | ||
228 | * | ||
229 | * @param client handle to the client making the request (for sending the reply) | ||
230 | * @param af AF_INET or AF_INET6 | ||
231 | * @param ip `struct in_addr` or `struct in6_addr` | ||
232 | */ | ||
233 | static void | ||
234 | get_ip_as_string (struct GNUNET_SERVICE_Client *client, | ||
235 | int af, | ||
236 | const void *ip, | ||
237 | uint32_t request_id) | ||
238 | { | ||
239 | struct IPCache *pos; | ||
240 | struct IPCache *next; | ||
241 | struct GNUNET_TIME_Absolute now; | ||
242 | struct GNUNET_MQ_Envelope *env; | ||
243 | struct GNUNET_MQ_Handle *mq; | ||
244 | struct GNUNET_RESOLVER_ResponseMessage *msg; | 264 | struct GNUNET_RESOLVER_ResponseMessage *msg; |
245 | size_t ip_len; | 265 | struct GNUNET_MQ_Envelope *env; |
246 | struct in6_addr ix; | 266 | void *payload; |
247 | size_t alen; | 267 | size_t payload_len; |
248 | 268 | ||
249 | switch (af) | 269 | switch (record->type) |
250 | { | ||
251 | case AF_INET: | ||
252 | ip_len = sizeof (struct in_addr); | ||
253 | break; | ||
254 | case AF_INET6: | ||
255 | ip_len = sizeof (struct in6_addr); | ||
256 | break; | ||
257 | default: | ||
258 | GNUNET_assert (0); | ||
259 | } | ||
260 | now = GNUNET_TIME_absolute_get (); | ||
261 | next = cache_head; | ||
262 | while ( (NULL != (pos = next)) && | ||
263 | ( (pos->af != af) || | ||
264 | (pos->ip_len != ip_len) || | ||
265 | (0 != memcmp (pos->ip, ip, ip_len))) ) | ||
266 | { | 270 | { |
267 | next = pos->next; | 271 | case GNUNET_DNSPARSER_TYPE_PTR: |
268 | if (GNUNET_TIME_absolute_get_duration (pos->last_request).rel_value_us < | ||
269 | 60 * 60 * 1000 * 1000LL) | ||
270 | { | 272 | { |
271 | GNUNET_CONTAINER_DLL_remove (cache_head, | 273 | char *hostname = record->data.hostname; |
272 | cache_tail, | 274 | payload = hostname; |
273 | pos); | 275 | payload_len = strlen (hostname) + 1; |
274 | GNUNET_free_non_null (pos->addr); | 276 | break; |
275 | GNUNET_free (pos); | ||
276 | continue; | ||
277 | } | 277 | } |
278 | } | 278 | case GNUNET_DNSPARSER_TYPE_A: |
279 | if (NULL != pos) | 279 | case GNUNET_DNSPARSER_TYPE_AAAA: |
280 | { | ||
281 | if ( (1 == inet_pton (af, | ||
282 | pos->ip, | ||
283 | &ix)) && | ||
284 | (GNUNET_TIME_absolute_get_duration (pos->last_request).rel_value_us > | ||
285 | 120 * 1000 * 1000LL) ) | ||
286 | { | 280 | { |
287 | /* try again if still numeric AND 2 minutes have expired */ | 281 | payload = record->data.raw.data; |
288 | GNUNET_free_non_null (pos->addr); | 282 | payload_len = record->data.raw.data_len; |
289 | pos->addr = NULL; | 283 | break; |
290 | cache_resolve (pos); | 284 | } |
291 | pos->last_request = now; | 285 | default: |
286 | { | ||
287 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
288 | "Cannot handle DNS response type: unimplemented\n"); | ||
289 | return; | ||
292 | } | 290 | } |
293 | } | 291 | } |
294 | else | ||
295 | { | ||
296 | pos = GNUNET_malloc (sizeof (struct IPCache) + ip_len); | ||
297 | pos->ip = &pos[1]; | ||
298 | GNUNET_memcpy (&pos[1], | ||
299 | ip, | ||
300 | ip_len); | ||
301 | pos->last_request = now; | ||
302 | pos->last_refresh = now; | ||
303 | pos->ip_len = ip_len; | ||
304 | pos->af = af; | ||
305 | GNUNET_CONTAINER_DLL_insert (cache_head, | ||
306 | cache_tail, | ||
307 | pos); | ||
308 | cache_resolve (pos); | ||
309 | } | ||
310 | if (NULL != pos->addr) | ||
311 | alen = strlen (pos->addr) + 1; | ||
312 | else | ||
313 | alen = 0; | ||
314 | mq = GNUNET_SERVICE_client_get_mq (client); | ||
315 | env = GNUNET_MQ_msg_extra (msg, | 292 | env = GNUNET_MQ_msg_extra (msg, |
316 | alen, | 293 | payload_len, |
317 | GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE); | 294 | GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE); |
318 | msg->id = request_id; | 295 | msg->id = request_id; |
319 | GNUNET_memcpy (&msg[1], | 296 | GNUNET_memcpy (&msg[1], |
320 | pos->addr, | 297 | payload, |
321 | alen); | 298 | payload_len); |
322 | GNUNET_MQ_send (mq, | 299 | GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (client), |
323 | env); | 300 | env); |
324 | // send end message | ||
325 | env = GNUNET_MQ_msg (msg, | ||
326 | GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE); | ||
327 | msg->id = request_id; | ||
328 | GNUNET_MQ_notify_sent (env, | ||
329 | ¬ify_service_client_done, | ||
330 | client); | ||
331 | GNUNET_MQ_send (mq, | ||
332 | env); | ||
333 | } | 301 | } |
334 | 302 | ||
335 | 303 | ||
336 | #if HAVE_GETADDRINFO_A | ||
337 | struct AsyncCls | ||
338 | { | ||
339 | struct gaicb *host; | ||
340 | struct sigevent *sig; | ||
341 | struct GNUNET_MQ_Handle *mq; | ||
342 | uint32_t request_id; | ||
343 | }; | ||
344 | |||
345 | |||
346 | static void | 304 | static void |
347 | resolve_result_pipe_cb (void *cls) | 305 | send_end_msg (uint16_t request_id, |
306 | struct GNUNET_SERVICE_Client *client) | ||
348 | { | 307 | { |
349 | struct AsyncCls *async_cls; | ||
350 | struct gaicb *host; | ||
351 | struct GNUNET_RESOLVER_ResponseMessage *msg; | 308 | struct GNUNET_RESOLVER_ResponseMessage *msg; |
352 | struct GNUNET_MQ_Envelope *env; | 309 | struct GNUNET_MQ_Envelope *env; |
353 | 310 | ||
354 | GNUNET_DISK_file_read (GNUNET_DISK_pipe_handle (resolve_result_pipe, | 311 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
355 | GNUNET_DISK_PIPE_END_READ), | 312 | "Sending end message\n"); |
356 | &async_cls, | 313 | env = GNUNET_MQ_msg (msg, |
357 | sizeof (struct AsyncCls *)); | 314 | GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE); |
358 | resolve_result_pipe_task = | 315 | msg->id = request_id; |
359 | GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, | 316 | GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (client), |
360 | GNUNET_DISK_pipe_handle (resolve_result_pipe, | 317 | env); |
361 | GNUNET_DISK_PIPE_END_READ), | 318 | } |
362 | &resolve_result_pipe_cb, | 319 | |
363 | NULL); | 320 | |
364 | host = async_cls->host; | 321 | static void |
365 | for (struct addrinfo *pos = host->ar_result; pos != NULL; pos = pos->ai_next) | 322 | handle_resolve_result (void *cls, |
323 | const struct GNUNET_TUN_DnsHeader *dns, | ||
324 | size_t dns_len) | ||
325 | { | ||
326 | struct ResolveCache *cache = cls; | ||
327 | struct GNUNET_DNSPARSER_Packet *parsed; | ||
328 | uint16_t request_id = *cache->request_id; | ||
329 | struct GNUNET_SERVICE_Client *client = cache->client; | ||
330 | |||
331 | parsed = GNUNET_DNSPARSER_parse ((const char *)dns, | ||
332 | dns_len); | ||
333 | if (NULL == parsed) | ||
334 | { | ||
335 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
336 | "Failed to parse DNS reply (request ID %u\n", | ||
337 | request_id); | ||
338 | return; | ||
339 | } | ||
340 | if (request_id != ntohs (parsed->id)) | ||
341 | { | ||
342 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
343 | "Request ID in DNS reply does not match\n"); | ||
344 | return; | ||
345 | } | ||
346 | else if (0 == parsed->num_answers) | ||
347 | { | ||
348 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
349 | "DNS reply (request ID %u) contains no answers\n", | ||
350 | request_id); | ||
351 | GNUNET_CONTAINER_DLL_remove (cache_head, | ||
352 | cache_tail, | ||
353 | cache); | ||
354 | free_cache_entry (cache); | ||
355 | cache = NULL; | ||
356 | } | ||
357 | else | ||
366 | { | 358 | { |
367 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 359 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
368 | "Lookup result for hostname %s: %s (request ID %u)\n", | 360 | "Got reply for request ID %u\n", |
369 | host->ar_name, | 361 | request_id); |
370 | GNUNET_a2s (pos->ai_addr, pos->ai_addrlen), | 362 | for (unsigned int i = 0; i != parsed->num_answers; i++) |
371 | async_cls->request_id); | ||
372 | switch (pos->ai_family) | ||
373 | { | 363 | { |
374 | case AF_INET: | 364 | struct Record *cache_entry = GNUNET_new (struct Record); |
375 | env = GNUNET_MQ_msg_extra (msg, | 365 | struct GNUNET_DNSPARSER_Record *record = &parsed->answers[i]; |
376 | sizeof (struct in_addr), | 366 | cache_entry->record = GNUNET_DNSPARSER_duplicate_record (record); |
377 | GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE); | 367 | GNUNET_CONTAINER_DLL_insert (cache->records_head, |
378 | msg->id = async_cls->request_id; | 368 | cache->records_tail, |
379 | GNUNET_memcpy (&msg[1], | 369 | cache_entry); |
380 | &((struct sockaddr_in*) pos->ai_addr)->sin_addr, | 370 | send_reply (cache_entry->record, |
381 | sizeof (struct in_addr)); | 371 | request_id, |
382 | GNUNET_MQ_send (async_cls->mq, | 372 | cache->client); |
383 | env); | ||
384 | break; | ||
385 | case AF_INET6: | ||
386 | env = GNUNET_MQ_msg_extra (msg, | ||
387 | sizeof (struct in6_addr), | ||
388 | GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE); | ||
389 | msg->id = async_cls->request_id; | ||
390 | GNUNET_memcpy (&msg[1], | ||
391 | &((struct sockaddr_in6*) pos->ai_addr)->sin6_addr, | ||
392 | sizeof (struct in6_addr)); | ||
393 | GNUNET_MQ_send (async_cls->mq, | ||
394 | env); | ||
395 | break; | ||
396 | default: | ||
397 | /* unsupported, skip */ | ||
398 | break; | ||
399 | } | 373 | } |
374 | GNUNET_free_non_null (cache->request_id); | ||
375 | cache->request_id = NULL; | ||
400 | } | 376 | } |
401 | // send end message | 377 | send_end_msg (request_id, |
402 | env = GNUNET_MQ_msg (msg, | 378 | client); |
403 | GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE); | 379 | if (NULL != cache) |
404 | msg->id = async_cls->request_id; | 380 | cache->client = NULL; |
405 | GNUNET_MQ_send (async_cls->mq, | 381 | if (NULL != cache) |
406 | env); | 382 | { |
407 | freeaddrinfo (host->ar_result); | 383 | if (NULL != cache->timeout_task) |
408 | GNUNET_free ((struct gaicb *)host->ar_request); // free hints | 384 | { |
409 | GNUNET_free (host); | 385 | GNUNET_SCHEDULER_cancel (cache->timeout_task); |
410 | GNUNET_free (async_cls->sig); | 386 | cache->timeout_task = NULL; |
411 | GNUNET_free (async_cls); | 387 | } |
388 | if (NULL != cache->resolve_handle) | ||
389 | { | ||
390 | GNUNET_DNSSTUB_resolve_cancel (cache->resolve_handle); | ||
391 | cache->resolve_handle = NULL; | ||
392 | } | ||
393 | } | ||
394 | GNUNET_DNSPARSER_free_packet (parsed); | ||
412 | } | 395 | } |
413 | 396 | ||
414 | 397 | ||
415 | static void | 398 | static void |
416 | handle_async_result (union sigval val) | 399 | handle_resolve_timeout (void *cls) |
417 | { | 400 | { |
418 | GNUNET_DISK_file_write (GNUNET_DISK_pipe_handle (resolve_result_pipe, | 401 | struct ResolveCache *cache = cls; |
419 | GNUNET_DISK_PIPE_END_WRITE), | 402 | |
420 | &val.sival_ptr, | 403 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
421 | sizeof (val.sival_ptr)); | 404 | "timeout!\n"); |
405 | if (NULL != cache->resolve_handle) | ||
406 | { | ||
407 | GNUNET_DNSSTUB_resolve_cancel (cache->resolve_handle); | ||
408 | cache->resolve_handle = NULL; | ||
409 | } | ||
410 | GNUNET_CONTAINER_DLL_remove (cache_head, | ||
411 | cache_tail, | ||
412 | cache); | ||
413 | free_cache_entry (cache); | ||
422 | } | 414 | } |
423 | 415 | ||
424 | 416 | ||
425 | static int | 417 | static int |
426 | getaddrinfo_a_resolve (struct GNUNET_MQ_Handle *mq, | 418 | resolve_and_cache (const char* hostname, |
427 | const char *hostname, | 419 | uint16_t record_type, |
428 | int af, | 420 | uint16_t request_id, |
429 | uint32_t request_id) | 421 | struct GNUNET_SERVICE_Client *client) |
430 | { | 422 | { |
431 | int ret; | 423 | char *packet_buf; |
432 | struct gaicb *host; | 424 | size_t packet_size; |
433 | struct addrinfo *hints; | 425 | struct GNUNET_DNSPARSER_Query query; |
434 | struct sigevent *sig; | 426 | struct GNUNET_DNSPARSER_Packet packet; |
435 | struct AsyncCls *async_cls; | 427 | struct ResolveCache *cache; |
436 | 428 | struct GNUNET_TIME_Relative timeout = | |
437 | host = GNUNET_new (struct gaicb); | 429 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5); |
438 | hints = GNUNET_new (struct addrinfo); | 430 | |
439 | sig = GNUNET_new (struct sigevent); | 431 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
440 | async_cls = GNUNET_new (struct AsyncCls); | 432 | "resolve_and_cache\n"); |
441 | memset (hints, | 433 | query.name = (char *)hostname; |
434 | query.type = record_type; | ||
435 | query.dns_traffic_class = GNUNET_TUN_DNS_CLASS_INTERNET; | ||
436 | memset (&packet, | ||
442 | 0, | 437 | 0, |
443 | sizeof (struct addrinfo)); | 438 | sizeof (packet)); |
444 | memset (sig, | 439 | packet.num_queries = 1; |
445 | 0, | 440 | packet.queries = &query; |
446 | sizeof (struct sigevent)); | 441 | packet.id = htons (request_id); |
447 | hints->ai_family = af; | 442 | packet.flags.recursion_desired = 1; |
448 | hints->ai_socktype = SOCK_STREAM; /* go for TCP */ | 443 | if (GNUNET_OK != |
449 | host->ar_name = hostname; | 444 | GNUNET_DNSPARSER_pack (&packet, |
450 | host->ar_service = NULL; | 445 | UINT16_MAX, |
451 | host->ar_request = hints; | 446 | &packet_buf, |
452 | host->ar_result = NULL; | 447 | &packet_size)) |
453 | sig->sigev_notify = SIGEV_THREAD; | 448 | { |
454 | sig->sigev_value.sival_ptr = async_cls; | 449 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
455 | sig->sigev_notify_function = &handle_async_result; | 450 | "Failed to pack query for hostname `%s'\n", |
456 | async_cls->host = host; | 451 | hostname); |
457 | async_cls->sig = sig; | ||
458 | async_cls->mq = mq; | ||
459 | async_cls->request_id = request_id; | ||
460 | ret = getaddrinfo_a (GAI_NOWAIT, | ||
461 | &host, | ||
462 | 1, | ||
463 | sig); | ||
464 | if (0 != ret) | ||
465 | return GNUNET_SYSERR; | 452 | return GNUNET_SYSERR; |
453 | |||
454 | } | ||
455 | cache = GNUNET_malloc (sizeof (struct ResolveCache)); | ||
456 | cache->record_type = record_type; | ||
457 | cache->request_id = GNUNET_memdup (&request_id, sizeof (request_id)); | ||
458 | cache->client = client; | ||
459 | cache->timeout_task = GNUNET_SCHEDULER_add_delayed (timeout, | ||
460 | &handle_resolve_timeout, | ||
461 | cache); | ||
462 | cache->resolve_handle = | ||
463 | GNUNET_DNSSTUB_resolve (dnsstub_ctx, | ||
464 | packet_buf, | ||
465 | packet_size, | ||
466 | &handle_resolve_result, | ||
467 | cache); | ||
468 | GNUNET_CONTAINER_DLL_insert (cache_head, | ||
469 | cache_tail, | ||
470 | cache); | ||
471 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
472 | "resolve %s, request_id = %u\n", | ||
473 | hostname, | ||
474 | request_id); | ||
475 | GNUNET_free (packet_buf); | ||
466 | return GNUNET_OK; | 476 | return GNUNET_OK; |
467 | } | 477 | } |
468 | 478 | ||
469 | 479 | ||
470 | #elif HAVE_GETADDRINFO | 480 | static const char * |
471 | static int | 481 | get_hostname (struct ResolveCache *cache_entry) |
472 | getaddrinfo_resolve (struct GNUNET_MQ_Handle *mq, | ||
473 | const char *hostname, | ||
474 | int af, | ||
475 | uint32_t request_id) | ||
476 | { | 482 | { |
477 | int s; | 483 | if (NULL != cache_entry->records_head) |
478 | struct addrinfo hints; | ||
479 | struct addrinfo *result; | ||
480 | struct addrinfo *pos; | ||
481 | struct GNUNET_RESOLVER_ResponseMessage *msg; | ||
482 | struct GNUNET_MQ_Envelope *env; | ||
483 | |||
484 | #ifdef WINDOWS | ||
485 | /* Due to a bug, getaddrinfo will not return a mix of different families */ | ||
486 | if (AF_UNSPEC == af) | ||
487 | { | 484 | { |
488 | int ret1; | 485 | GNUNET_assert (NULL != cache_entry->records_head); |
489 | int ret2; | 486 | GNUNET_assert (NULL != cache_entry->records_head->record); |
490 | ret1 = getaddrinfo_resolve (mq, | 487 | GNUNET_assert (NULL != cache_entry->records_head->record->name); |
491 | hostname, | 488 | return cache_entry->records_head->record->name; |
492 | AF_INET, | ||
493 | request_id); | ||
494 | ret2 = getaddrinfo_resolve (mq, | ||
495 | hostname, | ||
496 | AF_INET6, | ||
497 | request_id); | ||
498 | if ( (ret1 == GNUNET_OK) || | ||
499 | (ret2 == GNUNET_OK) ) | ||
500 | return GNUNET_OK; | ||
501 | if ( (ret1 == GNUNET_SYSERR) || | ||
502 | (ret2 == GNUNET_SYSERR) ) | ||
503 | return GNUNET_SYSERR; | ||
504 | return GNUNET_NO; | ||
505 | } | 489 | } |
506 | #endif | 490 | return NULL; |
507 | |||
508 | memset (&hints, | ||
509 | 0, | ||
510 | sizeof (struct addrinfo)); | ||
511 | hints.ai_family = af; | ||
512 | hints.ai_socktype = SOCK_STREAM; /* go for TCP */ | ||
513 | |||
514 | if (0 != (s = getaddrinfo (hostname, | ||
515 | NULL, | ||
516 | &hints, | ||
517 | &result))) | ||
518 | { | ||
519 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
520 | _("Could not resolve `%s' (%s): %s\n"), | ||
521 | hostname, | ||
522 | (af == | ||
523 | AF_INET) ? "IPv4" : ((af == AF_INET6) ? "IPv6" : "any"), | ||
524 | gai_strerror (s)); | ||
525 | if ( (s == EAI_BADFLAGS) || | ||
526 | #ifndef WINDOWS | ||
527 | (s == EAI_SYSTEM) || | ||
528 | #endif | ||
529 | (s == EAI_MEMORY) ) | ||
530 | return GNUNET_NO; /* other function may still succeed */ | ||
531 | return GNUNET_SYSERR; | ||
532 | } | ||
533 | if (NULL == result) | ||
534 | return GNUNET_SYSERR; | ||
535 | for (pos = result; pos != NULL; pos = pos->ai_next) | ||
536 | { | ||
537 | switch (pos->ai_family) | ||
538 | { | ||
539 | case AF_INET: | ||
540 | env = GNUNET_MQ_msg_extra (msg, | ||
541 | sizeof (struct in_addr), | ||
542 | GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE); | ||
543 | msg->id = request_id; | ||
544 | GNUNET_memcpy (&msg[1], | ||
545 | &((struct sockaddr_in*) pos->ai_addr)->sin_addr, | ||
546 | sizeof (struct in_addr)); | ||
547 | GNUNET_MQ_send (mq, | ||
548 | env); | ||
549 | break; | ||
550 | case AF_INET6: | ||
551 | env = GNUNET_MQ_msg_extra (msg, | ||
552 | sizeof (struct in6_addr), | ||
553 | GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE); | ||
554 | msg->id = request_id; | ||
555 | GNUNET_memcpy (&msg[1], | ||
556 | &((struct sockaddr_in6*) pos->ai_addr)->sin6_addr, | ||
557 | sizeof (struct in6_addr)); | ||
558 | GNUNET_MQ_send (mq, | ||
559 | env); | ||
560 | break; | ||
561 | default: | ||
562 | /* unsupported, skip */ | ||
563 | break; | ||
564 | } | ||
565 | } | ||
566 | freeaddrinfo (result); | ||
567 | return GNUNET_OK; | ||
568 | } | 491 | } |
569 | 492 | ||
570 | 493 | ||
571 | #elif HAVE_GETHOSTBYNAME2 | 494 | static const uint16_t * |
572 | 495 | get_record_type (struct ResolveCache *cache_entry) | |
573 | |||
574 | static int | ||
575 | gethostbyname2_resolve (struct GNUNET_MQ_Handle *mq, | ||
576 | const char *hostname, | ||
577 | int af, | ||
578 | uint32_t request_id) | ||
579 | { | 496 | { |
580 | struct hostent *hp; | 497 | if (NULL != cache_entry->records_head) |
581 | int ret1; | 498 | return &cache_entry->record_type; |
582 | int ret2; | 499 | return NULL; |
583 | struct GNUNET_MQ_Envelope *env; | 500 | } |
584 | struct GNUNET_RESOLVER_ResponseMessage *msg; | ||
585 | 501 | ||
586 | #ifdef WINDOWS | ||
587 | /* gethostbyname2() in plibc is a compat dummy that calls gethostbyname(). */ | ||
588 | return GNUNET_NO; | ||
589 | #endif | ||
590 | 502 | ||
591 | if (af == AF_UNSPEC) | 503 | static const struct GNUNET_TIME_Absolute * |
592 | { | 504 | get_expiration_time (struct ResolveCache *cache_entry) |
593 | ret1 = gethostbyname2_resolve (mq, | 505 | { |
594 | hostname, | 506 | if (NULL != cache_entry->records_head) |
595 | AF_INET, | 507 | return &cache_entry->records_head->record->expiration_time; |
596 | request_id); | 508 | return NULL; |
597 | ret2 = gethostbyname2_resolve (mq, | ||
598 | hostname, | ||
599 | AF_INET6, | ||
600 | request_id); | ||
601 | if ( (ret1 == GNUNET_OK) || | ||
602 | (ret2 == GNUNET_OK) ) | ||
603 | return GNUNET_OK; | ||
604 | if ( (ret1 == GNUNET_SYSERR) || | ||
605 | (ret2 == GNUNET_SYSERR) ) | ||
606 | return GNUNET_SYSERR; | ||
607 | return GNUNET_NO; | ||
608 | } | ||
609 | hp = gethostbyname2 (hostname, | ||
610 | af); | ||
611 | if (hp == NULL) | ||
612 | { | ||
613 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
614 | _("Could not find IP of host `%s': %s\n"), | ||
615 | hostname, | ||
616 | hstrerror (h_errno)); | ||
617 | return GNUNET_SYSERR; | ||
618 | } | ||
619 | GNUNET_assert (hp->h_addrtype == af); | ||
620 | switch (af) | ||
621 | { | ||
622 | case AF_INET: | ||
623 | GNUNET_assert (hp->h_length == sizeof (struct in_addr)); | ||
624 | env = GNUNET_MQ_msg_extra (msg, | ||
625 | hp->h_length, | ||
626 | GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE); | ||
627 | msg->id = request_id; | ||
628 | GNUNET_memcpy (&msg[1], | ||
629 | hp->h_addr_list[0], | ||
630 | hp->h_length); | ||
631 | GNUNET_MQ_send (mq, | ||
632 | env); | ||
633 | break; | ||
634 | case AF_INET6: | ||
635 | GNUNET_assert (hp->h_length == sizeof (struct in6_addr)); | ||
636 | env = GNUNET_MQ_msg_extra (msg, | ||
637 | hp->h_length, | ||
638 | GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE); | ||
639 | msg->id = request_id; | ||
640 | GNUNET_memcpy (&msg[1], | ||
641 | hp->h_addr_list[0], | ||
642 | hp->h_length); | ||
643 | GNUNET_MQ_send (mq, | ||
644 | env); | ||
645 | break; | ||
646 | default: | ||
647 | GNUNET_break (0); | ||
648 | return GNUNET_SYSERR; | ||
649 | } | ||
650 | return GNUNET_OK; | ||
651 | } | 509 | } |
652 | 510 | ||
653 | #elif HAVE_GETHOSTBYNAME | ||
654 | |||
655 | 511 | ||
656 | static int | 512 | static int |
657 | gethostbyname_resolve (struct GNUNET_MQ_Handle *mq, | 513 | remove_if_expired (struct ResolveCache *cache_entry) |
658 | const char *hostname, | ||
659 | uint32_t request_id) | ||
660 | { | 514 | { |
661 | struct hostent *hp; | 515 | struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get (); |
662 | struct GNUNET_RESOLVER_ResponseMessage *msg; | ||
663 | struct GNUNET_MQ_Envelope *env; | ||
664 | 516 | ||
665 | hp = GETHOSTBYNAME (hostname); | 517 | if ( (NULL != cache_entry->records_head) && |
666 | if (NULL == hp) | 518 | (now.abs_value_us > get_expiration_time (cache_entry)->abs_value_us) ) |
667 | { | 519 | { |
668 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 520 | GNUNET_CONTAINER_DLL_remove (cache_head, |
669 | _("Could not find IP of host `%s': %s\n"), | 521 | cache_tail, |
670 | hostname, | 522 | cache_entry); |
671 | hstrerror (h_errno)); | 523 | free_cache_entry (cache_entry); |
672 | return GNUNET_SYSERR; | 524 | return GNUNET_YES; |
673 | } | ||
674 | if (hp->h_addrtype != AF_INET) | ||
675 | { | ||
676 | GNUNET_break (0); | ||
677 | return GNUNET_SYSERR; | ||
678 | } | 525 | } |
679 | GNUNET_assert (hp->h_length == sizeof (struct in_addr)); | 526 | return GNUNET_NO; |
680 | env = GNUNET_MQ_msg_extra (msg, | ||
681 | hp->h_length, | ||
682 | GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE); | ||
683 | msg->id = request_id; | ||
684 | GNUNET_memcpy (&msg[1], | ||
685 | hp->h_addr_list[0], | ||
686 | hp->h_length); | ||
687 | GNUNET_MQ_send (mq, | ||
688 | env); | ||
689 | return GNUNET_OK; | ||
690 | } | 527 | } |
691 | #endif | ||
692 | 528 | ||
693 | 529 | ||
694 | /** | 530 | /** |
695 | * Convert a string to an IP address. | 531 | * Get an IP address as a string (works for both IPv4 and IPv6). Note |
532 | * that the resolution happens asynchronously and that the first call | ||
533 | * may not immediately result in the FQN (but instead in a | ||
534 | * human-readable IP address). | ||
696 | * | 535 | * |
697 | * @param client where to send the IP address | 536 | * @param client handle to the client making the request (for sending the reply) |
698 | * @param hostname the hostname to resolve | 537 | * @param af AF_INET or AF_INET6 |
699 | * @param af AF_INET or AF_INET6; use AF_UNSPEC for "any" | 538 | * @param ip `struct in_addr` or `struct in6_addr` |
700 | */ | 539 | */ |
701 | static void | 540 | static int |
702 | get_ip_from_hostname (struct GNUNET_SERVICE_Client *client, | 541 | try_cache (const char *hostname, |
703 | const char *hostname, | 542 | uint16_t record_type, |
704 | int af, | 543 | uint16_t request_id, |
705 | uint32_t request_id) | 544 | struct GNUNET_SERVICE_Client *client) |
706 | { | 545 | { |
707 | struct GNUNET_MQ_Envelope *env; | 546 | struct ResolveCache *pos; |
708 | struct GNUNET_RESOLVER_ResponseMessage *msg; | 547 | struct ResolveCache *next; |
709 | struct GNUNET_MQ_Handle *mq; | 548 | |
710 | 549 | next = cache_head; | |
711 | mq = GNUNET_SERVICE_client_get_mq (client); | 550 | while ( (NULL != (pos = next)) && |
712 | #if HAVE_GETADDRINFO_A | 551 | ( (NULL == pos->records_head) || |
713 | getaddrinfo_a_resolve (mq, | 552 | (0 != strcmp (get_hostname (pos), hostname)) || |
714 | hostname, | 553 | (*get_record_type (pos) != record_type) ) ) |
715 | af, | 554 | { |
716 | request_id); | 555 | next = pos->next; |
717 | GNUNET_SERVICE_client_continue (client); | 556 | remove_if_expired (pos); |
718 | return; | 557 | } |
719 | #elif HAVE_GETADDRINFO | 558 | if (NULL != pos) |
720 | getaddrinfo_resolve (mq, | 559 | { |
721 | hostname, | 560 | if (GNUNET_NO == remove_if_expired (pos)) |
722 | af, | 561 | { |
723 | request_id); | 562 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
724 | #elif HAVE_GETHOSTBYNAME2 | 563 | "found cache entry for '%s', record type '%u'\n", |
725 | gethostbyname2_resolve (mq, | 564 | hostname, |
726 | hostname, | 565 | record_type); |
727 | af, | 566 | struct Record *cache_pos = pos->records_head; |
728 | request_id); | 567 | while (NULL != cache_pos) |
729 | #elif HAVE_GETHOSTBYNAME | 568 | { |
730 | if ( ( (af == AF_UNSPEC) || | 569 | send_reply (cache_pos->record, |
731 | (af == PF_INET) ) ) | 570 | request_id, |
732 | gethostbyname_resolve (mq, | 571 | client); |
733 | hostname, | 572 | cache_pos = cache_pos->next; |
734 | request_id); | 573 | } |
735 | #endif | 574 | send_end_msg (request_id, |
736 | // send end message | 575 | client); |
737 | env = GNUNET_MQ_msg (msg, | 576 | return GNUNET_YES; |
738 | GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE); | 577 | } |
739 | msg->id = request_id; | 578 | } |
740 | GNUNET_MQ_notify_sent (env, | 579 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
741 | ¬ify_service_client_done, | 580 | "no cache entry for '%s'\n", |
742 | client); | 581 | hostname); |
743 | GNUNET_MQ_send (mq, | 582 | return GNUNET_NO; |
744 | env); | ||
745 | } | 583 | } |
746 | 584 | ||
747 | 585 | ||
@@ -801,6 +639,23 @@ check_get (void *cls, | |||
801 | } | 639 | } |
802 | 640 | ||
803 | 641 | ||
642 | static void | ||
643 | process_get (const char *hostname, | ||
644 | uint16_t record_type, | ||
645 | uint16_t request_id, | ||
646 | struct GNUNET_SERVICE_Client *client) | ||
647 | { | ||
648 | if (GNUNET_NO == try_cache (hostname, record_type, request_id, client)) | ||
649 | { | ||
650 | int result = resolve_and_cache (hostname, | ||
651 | record_type, | ||
652 | request_id, | ||
653 | client); | ||
654 | GNUNET_assert (GNUNET_OK == result); | ||
655 | } | ||
656 | } | ||
657 | |||
658 | |||
804 | /** | 659 | /** |
805 | * Handle GET-message. | 660 | * Handle GET-message. |
806 | * | 661 | * |
@@ -812,45 +667,100 @@ handle_get (void *cls, | |||
812 | const struct GNUNET_RESOLVER_GetMessage *msg) | 667 | const struct GNUNET_RESOLVER_GetMessage *msg) |
813 | { | 668 | { |
814 | struct GNUNET_SERVICE_Client *client = cls; | 669 | struct GNUNET_SERVICE_Client *client = cls; |
815 | const void *ip; | ||
816 | int direction; | 670 | int direction; |
817 | int af; | 671 | int af; |
818 | uint32_t id; | 672 | uint16_t request_id; |
673 | const char *hostname; | ||
819 | 674 | ||
820 | direction = ntohl (msg->direction); | 675 | direction = ntohl (msg->direction); |
821 | af = ntohl (msg->af); | 676 | af = ntohl (msg->af); |
822 | id = ntohl (msg->id); | 677 | request_id = ntohs (msg->id); |
823 | if (GNUNET_NO == direction) | 678 | if (GNUNET_NO == direction) |
824 | { | 679 | { |
825 | /* IP from hostname */ | 680 | /* IP from hostname */ |
826 | const char *hostname; | 681 | hostname = GNUNET_strdup ((const char *) &msg[1]); |
827 | 682 | switch (af) | |
828 | hostname = (const char *) &msg[1]; | 683 | { |
829 | get_ip_from_hostname (client, | 684 | case AF_UNSPEC: |
830 | hostname, | 685 | { |
831 | af, | 686 | process_get (hostname, GNUNET_DNSPARSER_TYPE_ALL, request_id, client); |
832 | id); | 687 | break; |
833 | return; | 688 | } |
689 | case AF_INET: | ||
690 | { | ||
691 | process_get (hostname, GNUNET_DNSPARSER_TYPE_A, request_id, client); | ||
692 | break; | ||
693 | } | ||
694 | case AF_INET6: | ||
695 | { | ||
696 | process_get (hostname, GNUNET_DNSPARSER_TYPE_AAAA, request_id, client); | ||
697 | break; | ||
698 | } | ||
699 | default: | ||
700 | { | ||
701 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
702 | "got invalid af: %d\n", | ||
703 | af); | ||
704 | GNUNET_assert (0); | ||
705 | } | ||
706 | } | ||
707 | } | ||
708 | else | ||
709 | { | ||
710 | /* hostname from IP */ | ||
711 | hostname = make_reverse_hostname (&msg[1], af); | ||
712 | process_get (hostname, GNUNET_DNSPARSER_TYPE_PTR, request_id, client); | ||
834 | } | 713 | } |
835 | ip = &msg[1]; | 714 | GNUNET_free_non_null ((char *)hostname); |
715 | GNUNET_SERVICE_client_continue (client); | ||
716 | } | ||
836 | 717 | ||
837 | #if !defined(GNUNET_CULL_LOGGING) | 718 | |
719 | static void | ||
720 | shutdown_task (void *cls) | ||
721 | { | ||
722 | (void) cls; | ||
723 | struct ResolveCache *pos; | ||
724 | |||
725 | while (NULL != (pos = cache_head)) | ||
838 | { | 726 | { |
839 | char buf[INET6_ADDRSTRLEN]; | 727 | GNUNET_CONTAINER_DLL_remove (cache_head, |
728 | cache_tail, | ||
729 | pos); | ||
730 | free_cache_entry (pos); | ||
731 | } | ||
732 | GNUNET_DNSSTUB_stop (dnsstub_ctx); | ||
733 | } | ||
734 | |||
840 | 735 | ||
736 | static void | ||
737 | init_cb (void *cls, | ||
738 | const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
739 | struct GNUNET_SERVICE_Handle *sh) | ||
740 | { | ||
741 | (void) cfg; | ||
742 | (void) sh; | ||
743 | |||
744 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, | ||
745 | cls); | ||
746 | dnsstub_ctx = GNUNET_DNSSTUB_start (128); | ||
747 | char **dns_servers; | ||
748 | ssize_t num_dns_servers = lookup_dns_servers (&dns_servers); | ||
749 | if (0 == num_dns_servers) | ||
750 | { | ||
751 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
752 | "no DNS server available. DNS resolution will not be possible.\n"); | ||
753 | } | ||
754 | for (int i = 0; i != num_dns_servers; i++) | ||
755 | { | ||
756 | int result = GNUNET_DNSSTUB_add_dns_ip (dnsstub_ctx, dns_servers[i]); | ||
841 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 757 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
842 | "Resolver asked to look up IP address `%s (request ID %u)'.\n", | 758 | "Adding DNS server '%s': %s\n", |
843 | inet_ntop (af, | 759 | dns_servers[i], |
844 | ip, | 760 | GNUNET_OK == result ? "success" : "failure"); |
845 | buf, | 761 | GNUNET_free (dns_servers[i]); |
846 | sizeof (buf)), | ||
847 | id); | ||
848 | } | 762 | } |
849 | #endif | 763 | GNUNET_free_non_null (dns_servers); |
850 | get_ip_as_string (client, | ||
851 | af, | ||
852 | ip, | ||
853 | id); | ||
854 | } | 764 | } |
855 | 765 | ||
856 | 766 | ||
@@ -870,19 +780,6 @@ connect_cb (void *cls, | |||
870 | (void) cls; | 780 | (void) cls; |
871 | (void) mq; | 781 | (void) mq; |
872 | 782 | ||
873 | #if HAVE_GETADDRINFO_A | ||
874 | resolve_result_pipe = GNUNET_DISK_pipe (GNUNET_NO, | ||
875 | GNUNET_NO, | ||
876 | GNUNET_NO, | ||
877 | GNUNET_NO); | ||
878 | GNUNET_assert (NULL != resolve_result_pipe); | ||
879 | resolve_result_pipe_task = | ||
880 | GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, | ||
881 | GNUNET_DISK_pipe_handle (resolve_result_pipe, | ||
882 | GNUNET_DISK_PIPE_END_READ), | ||
883 | &resolve_result_pipe_cb, | ||
884 | NULL); | ||
885 | #endif | ||
886 | return c; | 783 | return c; |
887 | } | 784 | } |
888 | 785 | ||
@@ -900,19 +797,16 @@ disconnect_cb (void *cls, | |||
900 | void *internal_cls) | 797 | void *internal_cls) |
901 | { | 798 | { |
902 | (void) cls; | 799 | (void) cls; |
800 | struct ResolveCache *pos = cache_head; | ||
903 | 801 | ||
904 | #if HAVE_GETADDRINFO_A | 802 | while (NULL != pos) |
905 | if (NULL != resolve_result_pipe_task) | ||
906 | { | ||
907 | GNUNET_SCHEDULER_cancel (resolve_result_pipe_task); | ||
908 | resolve_result_pipe_task = NULL; | ||
909 | } | ||
910 | if (NULL != resolve_result_pipe) | ||
911 | { | 803 | { |
912 | GNUNET_DISK_pipe_close (resolve_result_pipe); | 804 | if (pos->client == c) |
913 | resolve_result_pipe = NULL; | 805 | { |
806 | pos->client = NULL; | ||
807 | } | ||
808 | pos = pos->next; | ||
914 | } | 809 | } |
915 | #endif | ||
916 | GNUNET_assert (c == internal_cls); | 810 | GNUNET_assert (c == internal_cls); |
917 | } | 811 | } |
918 | 812 | ||
@@ -923,7 +817,7 @@ disconnect_cb (void *cls, | |||
923 | GNUNET_SERVICE_MAIN | 817 | GNUNET_SERVICE_MAIN |
924 | ("resolver", | 818 | ("resolver", |
925 | GNUNET_SERVICE_OPTION_NONE, | 819 | GNUNET_SERVICE_OPTION_NONE, |
926 | NULL, | 820 | &init_cb, |
927 | &connect_cb, | 821 | &connect_cb, |
928 | &disconnect_cb, | 822 | &disconnect_cb, |
929 | NULL, | 823 | NULL, |
@@ -950,23 +844,4 @@ GNUNET_RESOLVER_memory_init () | |||
950 | #endif | 844 | #endif |
951 | 845 | ||
952 | 846 | ||
953 | /** | ||
954 | * Free globals on exit. | ||
955 | */ | ||
956 | void __attribute__ ((destructor)) | ||
957 | GNUNET_RESOLVER_memory_done () | ||
958 | { | ||
959 | struct IPCache *pos; | ||
960 | |||
961 | while (NULL != (pos = cache_head)) | ||
962 | { | ||
963 | GNUNET_CONTAINER_DLL_remove (cache_head, | ||
964 | cache_tail, | ||
965 | pos); | ||
966 | GNUNET_free_non_null (pos->addr); | ||
967 | GNUNET_free (pos); | ||
968 | } | ||
969 | } | ||
970 | |||
971 | |||
972 | /* end of gnunet-service-resolver.c */ | 847 | /* end of gnunet-service-resolver.c */ |
diff --git a/src/util/gnunet-timeout-w32.c b/src/util/gnunet-timeout-w32.c new file mode 100644 index 000000000..78b268fe2 --- /dev/null +++ b/src/util/gnunet-timeout-w32.c | |||
@@ -0,0 +1,191 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | Copyright (C) 2010 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, or | ||
8 | (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | */ | ||
18 | |||
19 | /** | ||
20 | * @file src/util/gnunet-timeout-w32.c | ||
21 | * @brief small tool starting a child process, waiting that it terminates or killing it after a given timeout period | ||
22 | * @author LRN | ||
23 | */ | ||
24 | |||
25 | #include <windows.h> | ||
26 | #include <sys/types.h> | ||
27 | #include <stdio.h> | ||
28 | |||
29 | int | ||
30 | main (int argc, char *argv[]) | ||
31 | { | ||
32 | int i; | ||
33 | DWORD wait_result; | ||
34 | wchar_t *commandline; | ||
35 | wchar_t **wargv; | ||
36 | wchar_t *arg; | ||
37 | unsigned int cmdlen; | ||
38 | STARTUPINFOW start; | ||
39 | PROCESS_INFORMATION proc; | ||
40 | |||
41 | wchar_t wpath[MAX_PATH + 1]; | ||
42 | |||
43 | wchar_t *pathbuf; | ||
44 | DWORD pathbuf_len, alloc_len; | ||
45 | wchar_t *ptr; | ||
46 | wchar_t *non_const_filename; | ||
47 | wchar_t *wcmd; | ||
48 | int wargc; | ||
49 | int timeout = 0; | ||
50 | ssize_t wrote; | ||
51 | |||
52 | HANDLE job; | ||
53 | |||
54 | if (argc < 3) | ||
55 | { | ||
56 | printf | ||
57 | ("arg 1: timeout in sec., arg 2: executable, arg<n> arguments\n"); | ||
58 | exit (1); | ||
59 | } | ||
60 | |||
61 | timeout = atoi (argv[1]); | ||
62 | |||
63 | if (timeout == 0) | ||
64 | timeout = 600; | ||
65 | |||
66 | commandline = GetCommandLineW (); | ||
67 | if (commandline == NULL) | ||
68 | { | ||
69 | printf ("Failed to get commandline: %lu\n", GetLastError ()); | ||
70 | exit (2); | ||
71 | } | ||
72 | |||
73 | wargv = CommandLineToArgvW (commandline, &wargc); | ||
74 | if (wargv == NULL || wargc <= 1) | ||
75 | { | ||
76 | printf ("Failed to get parse commandline: %lu\n", GetLastError ()); | ||
77 | exit (3); | ||
78 | } | ||
79 | |||
80 | job = CreateJobObject (NULL, NULL); | ||
81 | if (job == NULL) | ||
82 | { | ||
83 | printf ("Failed to create a job: %lu\n", GetLastError ()); | ||
84 | exit (4); | ||
85 | } | ||
86 | |||
87 | pathbuf_len = GetEnvironmentVariableW (L"PATH", (wchar_t *) &pathbuf, 0); | ||
88 | |||
89 | alloc_len = pathbuf_len + 1; | ||
90 | |||
91 | pathbuf = malloc (alloc_len * sizeof (wchar_t)); | ||
92 | |||
93 | ptr = pathbuf; | ||
94 | |||
95 | alloc_len = GetEnvironmentVariableW (L"PATH", ptr, pathbuf_len); | ||
96 | |||
97 | cmdlen = wcslen (wargv[2]); | ||
98 | if (cmdlen < 5 || wcscmp (&wargv[2][cmdlen - 4], L".exe") != 0) | ||
99 | { | ||
100 | non_const_filename = malloc (sizeof (wchar_t) * (cmdlen + 5)); | ||
101 | swprintf (non_const_filename, cmdlen + 5, L"%S.exe", wargv[2]); | ||
102 | } | ||
103 | else | ||
104 | { | ||
105 | non_const_filename = wcsdup (wargv[2]); | ||
106 | } | ||
107 | |||
108 | /* Check that this is the full path. If it isn't, search. */ | ||
109 | if (non_const_filename[1] == L':') | ||
110 | swprintf (wpath, sizeof (wpath) / sizeof (wchar_t), L"%S", non_const_filename); | ||
111 | else if (!SearchPathW | ||
112 | (pathbuf, non_const_filename, NULL, sizeof (wpath) / sizeof (wchar_t), | ||
113 | wpath, NULL)) | ||
114 | { | ||
115 | printf ("Failed to get find executable: %lu\n", GetLastError ()); | ||
116 | exit (5); | ||
117 | } | ||
118 | free (pathbuf); | ||
119 | free (non_const_filename); | ||
120 | |||
121 | cmdlen = wcslen (wpath) + 4; | ||
122 | i = 3; | ||
123 | while (NULL != (arg = wargv[i++])) | ||
124 | cmdlen += wcslen (arg) + 4; | ||
125 | |||
126 | wcmd = malloc (sizeof (wchar_t) * (cmdlen + 1)); | ||
127 | wrote = 0; | ||
128 | i = 2; | ||
129 | while (NULL != (arg = wargv[i++])) | ||
130 | { | ||
131 | /* This is to escape trailing slash */ | ||
132 | wchar_t arg_lastchar = arg[wcslen (arg) - 1]; | ||
133 | if (wrote == 0) | ||
134 | { | ||
135 | wrote += swprintf (&wcmd[wrote], cmdlen + 1 - wrote, L"\"%S%S\" ", wpath, | ||
136 | arg_lastchar == L'\\' ? L"\\" : L""); | ||
137 | } | ||
138 | else | ||
139 | { | ||
140 | if (wcschr (arg, L' ') != NULL) | ||
141 | wrote += swprintf (&wcmd[wrote], cmdlen + 1 - wrote, L"\"%S%S\"%S", arg, | ||
142 | arg_lastchar == L'\\' ? L"\\" : L"", i == wargc ? L"" : L" "); | ||
143 | else | ||
144 | wrote += swprintf (&wcmd[wrote], cmdlen + 1 - wrote, L"%S%S%S", arg, | ||
145 | arg_lastchar == L'\\' ? L"\\" : L"", i == wargc ? L"" : L" "); | ||
146 | } | ||
147 | } | ||
148 | |||
149 | LocalFree (wargv); | ||
150 | |||
151 | memset (&start, 0, sizeof (start)); | ||
152 | start.cb = sizeof (start); | ||
153 | |||
154 | if (!CreateProcessW (wpath, wcmd, NULL, NULL, TRUE, CREATE_SUSPENDED, | ||
155 | NULL, NULL, &start, &proc)) | ||
156 | { | ||
157 | wprintf (L"Failed to get spawn process `%S' with arguments `%S': %lu\n", wpath, wcmd, GetLastError ()); | ||
158 | exit (6); | ||
159 | } | ||
160 | |||
161 | AssignProcessToJobObject (job, proc.hProcess); | ||
162 | |||
163 | ResumeThread (proc.hThread); | ||
164 | CloseHandle (proc.hThread); | ||
165 | |||
166 | free (wcmd); | ||
167 | |||
168 | wait_result = WaitForSingleObject (proc.hProcess, timeout * 1000); | ||
169 | if (wait_result == WAIT_OBJECT_0) | ||
170 | { | ||
171 | DWORD status; | ||
172 | wait_result = GetExitCodeProcess (proc.hProcess, &status); | ||
173 | CloseHandle (proc.hProcess); | ||
174 | if (wait_result != 0) | ||
175 | { | ||
176 | printf ("Test process exited with result %lu\n", status); | ||
177 | TerminateJobObject (job, status); | ||
178 | exit (status); | ||
179 | } | ||
180 | printf ("Test process exited (failed to obtain exit status)\n"); | ||
181 | TerminateJobObject (job, 0); | ||
182 | exit (0); | ||
183 | } | ||
184 | printf ("Child processes were killed after timeout of %u seconds\n", | ||
185 | timeout); | ||
186 | TerminateJobObject (job, 1); | ||
187 | CloseHandle (proc.hProcess); | ||
188 | exit (1); | ||
189 | } | ||
190 | |||
191 | /* end of timeout_watchdog_w32.c */ | ||
diff --git a/src/util/gnunet-timeout.c b/src/util/gnunet-timeout.c new file mode 100644 index 000000000..8dfb6ad17 --- /dev/null +++ b/src/util/gnunet-timeout.c | |||
@@ -0,0 +1,128 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | Copyright (C) 2010 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, or | ||
8 | (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | */ | ||
18 | |||
19 | /** | ||
20 | * @file src/util/gnunet-timeout.c | ||
21 | * @brief small tool starting a child process, waiting that it terminates or killing it after a given timeout period | ||
22 | * @author Matthias Wachs | ||
23 | */ | ||
24 | |||
25 | #include <sys/types.h> | ||
26 | #include <sys/wait.h> | ||
27 | #include <signal.h> | ||
28 | #include <stdio.h> | ||
29 | #include <stdlib.h> | ||
30 | #include <unistd.h> | ||
31 | |||
32 | static pid_t child; | ||
33 | |||
34 | |||
35 | static void | ||
36 | sigchld_handler (int val) | ||
37 | { | ||
38 | int status = 0; | ||
39 | int ret = 0; | ||
40 | |||
41 | (void) val; | ||
42 | waitpid (child, | ||
43 | &status, | ||
44 | 0); | ||
45 | if (WIFEXITED (status) != 0) | ||
46 | { | ||
47 | ret = WEXITSTATUS (status); | ||
48 | fprintf (stderr, | ||
49 | "Process exited with result %u\n", | ||
50 | ret); | ||
51 | exit (ret); /* return same status code */ | ||
52 | } | ||
53 | if (WIFSIGNALED (status) != 0) | ||
54 | { | ||
55 | ret = WTERMSIG (status); | ||
56 | fprintf (stderr, | ||
57 | "Process received signal %u\n", | ||
58 | ret); | ||
59 | kill (getpid (), | ||
60 | ret); /* kill self with the same signal */ | ||
61 | } | ||
62 | exit (-1); | ||
63 | } | ||
64 | |||
65 | |||
66 | static void | ||
67 | sigint_handler (int val) | ||
68 | { | ||
69 | kill (0, | ||
70 | val); | ||
71 | exit (val); | ||
72 | } | ||
73 | |||
74 | |||
75 | int | ||
76 | main (int argc, | ||
77 | char *argv[]) | ||
78 | { | ||
79 | int timeout = 0; | ||
80 | pid_t gpid = 0; | ||
81 | |||
82 | if (argc < 3) | ||
83 | { | ||
84 | fprintf (stderr, | ||
85 | "arg 1: timeout in sec., arg 2: executable, arg<n> arguments\n"); | ||
86 | exit (-1); | ||
87 | } | ||
88 | |||
89 | timeout = atoi (argv[1]); | ||
90 | |||
91 | if (timeout == 0) | ||
92 | timeout = 600; | ||
93 | |||
94 | /* with getpgid() it does not compile, but getpgrp is the BSD version and working */ | ||
95 | gpid = getpgrp (); | ||
96 | |||
97 | signal (SIGCHLD, sigchld_handler); | ||
98 | signal (SIGABRT, sigint_handler); | ||
99 | signal (SIGFPE, sigint_handler); | ||
100 | signal (SIGILL, sigint_handler); | ||
101 | signal (SIGINT, sigint_handler); | ||
102 | signal (SIGSEGV, sigint_handler); | ||
103 | signal (SIGTERM, sigint_handler); | ||
104 | |||
105 | child = fork (); | ||
106 | if (child == 0) | ||
107 | { | ||
108 | /* int setpgrp(pid_t pid, pid_t pgid); is not working on this machine */ | ||
109 | //setpgrp (0, pid_t gpid); | ||
110 | if (-1 != gpid) | ||
111 | setpgid (0, gpid); | ||
112 | execvp (argv[2], | ||
113 | &argv[2]); | ||
114 | exit (-1); | ||
115 | } | ||
116 | if (child > 0) | ||
117 | { | ||
118 | sleep (timeout); | ||
119 | printf ("Child processes were killed after timeout of %u seconds\n", | ||
120 | timeout); | ||
121 | kill (0, | ||
122 | SIGTERM); | ||
123 | exit (3); | ||
124 | } | ||
125 | exit (-1); | ||
126 | } | ||
127 | |||
128 | /* end of timeout_watchdog.c */ | ||
diff --git a/src/util/os_priority.c b/src/util/os_priority.c index d13991334..a758f24f1 100644 --- a/src/util/os_priority.c +++ b/src/util/os_priority.c | |||
@@ -1588,7 +1588,7 @@ GNUNET_OS_start_process_s (int pipe_control, | |||
1588 | 1588 | ||
1589 | 1589 | ||
1590 | /** | 1590 | /** |
1591 | * Retrieve the status of a process, waiting on him if dead. | 1591 | * Retrieve the status of a process, waiting on it if dead. |
1592 | * Nonblocking version. | 1592 | * Nonblocking version. |
1593 | * | 1593 | * |
1594 | * @param proc process ID | 1594 | * @param proc process ID |
@@ -1705,7 +1705,7 @@ process_status (struct GNUNET_OS_Process *proc, | |||
1705 | 1705 | ||
1706 | 1706 | ||
1707 | /** | 1707 | /** |
1708 | * Retrieve the status of a process, waiting on him if dead. | 1708 | * Retrieve the status of a process, waiting on it if dead. |
1709 | * Nonblocking version. | 1709 | * Nonblocking version. |
1710 | * | 1710 | * |
1711 | * @param proc process ID | 1711 | * @param proc process ID |
@@ -1726,7 +1726,7 @@ GNUNET_OS_process_status (struct GNUNET_OS_Process *proc, | |||
1726 | 1726 | ||
1727 | 1727 | ||
1728 | /** | 1728 | /** |
1729 | * Retrieve the status of a process, waiting on him if dead. | 1729 | * Retrieve the status of a process, waiting on it if dead. |
1730 | * Blocking version. | 1730 | * Blocking version. |
1731 | * | 1731 | * |
1732 | * @param proc pointer to process structure | 1732 | * @param proc pointer to process structure |
diff --git a/src/tun/regex.c b/src/util/regex.c index 7565a9eac..7565a9eac 100644 --- a/src/tun/regex.c +++ b/src/util/regex.c | |||
diff --git a/src/util/resolver.h b/src/util/resolver.h index a0f105afa..07851d052 100644 --- a/src/util/resolver.h +++ b/src/util/resolver.h | |||
@@ -60,7 +60,7 @@ struct GNUNET_RESOLVER_GetMessage | |||
60 | * identifies the request and is contained in the response message. The | 60 | * identifies the request and is contained in the response message. The |
61 | * client has to match response to request by this identifier. | 61 | * client has to match response to request by this identifier. |
62 | */ | 62 | */ |
63 | uint32_t id GNUNET_PACKED; | 63 | uint16_t id GNUNET_PACKED; |
64 | 64 | ||
65 | /* followed by 0-terminated string for A/AAAA-lookup or | 65 | /* followed by 0-terminated string for A/AAAA-lookup or |
66 | by 'struct in_addr' / 'struct in6_addr' for reverse lookup */ | 66 | by 'struct in_addr' / 'struct in6_addr' for reverse lookup */ |
@@ -79,7 +79,7 @@ struct GNUNET_RESOLVER_ResponseMessage | |||
79 | * identifies the request this message responds to. The client | 79 | * identifies the request this message responds to. The client |
80 | * has to match response to request by this identifier. | 80 | * has to match response to request by this identifier. |
81 | */ | 81 | */ |
82 | uint32_t id GNUNET_PACKED; | 82 | uint16_t id GNUNET_PACKED; |
83 | 83 | ||
84 | /* followed by 0-terminated string for response to a reverse lookup | 84 | /* followed by 0-terminated string for response to a reverse lookup |
85 | * or by 'struct in_addr' / 'struct in6_addr' for response to | 85 | * or by 'struct in_addr' / 'struct in6_addr' for response to |
diff --git a/src/util/resolver_api.c b/src/util/resolver_api.c index b94819f06..8a054327b 100644 --- a/src/util/resolver_api.c +++ b/src/util/resolver_api.c | |||
@@ -68,10 +68,10 @@ static struct GNUNET_RESOLVER_RequestHandle *req_head; | |||
68 | */ | 68 | */ |
69 | static struct GNUNET_RESOLVER_RequestHandle *req_tail; | 69 | static struct GNUNET_RESOLVER_RequestHandle *req_tail; |
70 | 70 | ||
71 | /** | 71 | ///** |
72 | * ID of the last request we sent to the service | 72 | // * ID of the last request we sent to the service |
73 | */ | 73 | // */ |
74 | static uint32_t last_request_id; | 74 | //static uint16_t last_request_id; |
75 | 75 | ||
76 | /** | 76 | /** |
77 | * How long should we wait to reconnect? | 77 | * How long should we wait to reconnect? |
@@ -445,7 +445,7 @@ process_requests () | |||
445 | GNUNET_MESSAGE_TYPE_RESOLVER_REQUEST); | 445 | GNUNET_MESSAGE_TYPE_RESOLVER_REQUEST); |
446 | msg->direction = htonl (rh->direction); | 446 | msg->direction = htonl (rh->direction); |
447 | msg->af = htonl (rh->af); | 447 | msg->af = htonl (rh->af); |
448 | msg->id = htonl (rh->id); | 448 | msg->id = htons (rh->id); |
449 | GNUNET_memcpy (&msg[1], | 449 | GNUNET_memcpy (&msg[1], |
450 | &rh[1], | 450 | &rh[1], |
451 | rh->data_len); | 451 | rh->data_len); |
@@ -491,7 +491,7 @@ handle_response (void *cls, | |||
491 | struct GNUNET_RESOLVER_RequestHandle *rh = req_head; | 491 | struct GNUNET_RESOLVER_RequestHandle *rh = req_head; |
492 | uint16_t size; | 492 | uint16_t size; |
493 | char *nret; | 493 | char *nret; |
494 | uint32_t request_id = msg->id; | 494 | uint16_t request_id = msg->id; |
495 | 495 | ||
496 | for (; rh != NULL; rh = rh->next) | 496 | for (; rh != NULL; rh = rh->next) |
497 | { | 497 | { |
@@ -911,6 +911,14 @@ handle_lookup_timeout (void *cls) | |||
911 | } | 911 | } |
912 | 912 | ||
913 | 913 | ||
914 | static uint16_t | ||
915 | get_request_id () | ||
916 | { | ||
917 | return (uint16_t) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, | ||
918 | UINT16_MAX); | ||
919 | } | ||
920 | |||
921 | |||
914 | /** | 922 | /** |
915 | * Convert a string to one or more IP addresses. | 923 | * Convert a string to one or more IP addresses. |
916 | * | 924 | * |
@@ -945,7 +953,8 @@ GNUNET_RESOLVER_ip_get (const char *hostname, | |||
945 | hostname); | 953 | hostname); |
946 | rh = GNUNET_malloc (sizeof (struct GNUNET_RESOLVER_RequestHandle) + slen); | 954 | rh = GNUNET_malloc (sizeof (struct GNUNET_RESOLVER_RequestHandle) + slen); |
947 | rh->af = af; | 955 | rh->af = af; |
948 | rh->id = ++last_request_id; | 956 | //rh->id = ++last_request_id; |
957 | rh->id = get_request_id (); | ||
949 | rh->addr_callback = callback; | 958 | rh->addr_callback = callback; |
950 | rh->cls = callback_cls; | 959 | rh->cls = callback_cls; |
951 | GNUNET_memcpy (&rh[1], | 960 | GNUNET_memcpy (&rh[1], |
@@ -1092,7 +1101,8 @@ GNUNET_RESOLVER_hostname_get (const struct sockaddr *sa, | |||
1092 | rh->name_callback = callback; | 1101 | rh->name_callback = callback; |
1093 | rh->cls = cls; | 1102 | rh->cls = cls; |
1094 | rh->af = sa->sa_family; | 1103 | rh->af = sa->sa_family; |
1095 | rh->id = ++last_request_id; | 1104 | //rh->id = ++last_request_id; |
1105 | rh->id = get_request_id (); | ||
1096 | rh->timeout = GNUNET_TIME_relative_to_absolute (timeout); | 1106 | rh->timeout = GNUNET_TIME_relative_to_absolute (timeout); |
1097 | GNUNET_memcpy (&rh[1], | 1107 | GNUNET_memcpy (&rh[1], |
1098 | ip, | 1108 | ip, |
diff --git a/src/util/strings.c b/src/util/strings.c index 5ed195933..ea3c8cfb9 100644 --- a/src/util/strings.c +++ b/src/util/strings.c | |||
@@ -11,7 +11,7 @@ | |||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | */ | 17 | */ |
@@ -1947,27 +1947,27 @@ static char *cvt = | |||
1947 | /** | 1947 | /** |
1948 | * Encode into Base64. | 1948 | * Encode into Base64. |
1949 | * | 1949 | * |
1950 | * @param data the data to encode | 1950 | * @param in the data to encode |
1951 | * @param len the length of the input | 1951 | * @param len the length of the input |
1952 | * @param output where to write the output (*output should be NULL, | 1952 | * @param output where to write the output (*output should be NULL, |
1953 | * is allocated) | 1953 | * is allocated) |
1954 | * @return the size of the output | 1954 | * @return the size of the output |
1955 | */ | 1955 | */ |
1956 | size_t | 1956 | size_t |
1957 | GNUNET_STRINGS_base64_encode (const char *data, | 1957 | GNUNET_STRINGS_base64_encode (const void *in, |
1958 | size_t len, | 1958 | size_t len, |
1959 | char **output) | 1959 | char **output) |
1960 | { | 1960 | { |
1961 | size_t i; | 1961 | const char *data = in; |
1962 | char c; | ||
1963 | size_t ret; | 1962 | size_t ret; |
1964 | char *opt; | 1963 | char *opt; |
1965 | 1964 | ||
1966 | ret = 0; | 1965 | ret = 0; |
1967 | opt = GNUNET_malloc (2 + (len * 4 / 3) + 8); | 1966 | opt = GNUNET_malloc (2 + (len * 4 / 3) + 8); |
1968 | *output = opt; | 1967 | for (size_t i = 0; i < len; ++i) |
1969 | for (i = 0; i < len; ++i) | ||
1970 | { | 1968 | { |
1969 | char c; | ||
1970 | |||
1971 | c = (data[i] >> 2) & 0x3f; | 1971 | c = (data[i] >> 2) & 0x3f; |
1972 | opt[ret++] = cvt[(int) c]; | 1972 | opt[ret++] = cvt[(int) c]; |
1973 | c = (data[i] << 4) & 0x3f; | 1973 | c = (data[i] << 4) & 0x3f; |
@@ -1997,6 +1997,7 @@ GNUNET_STRINGS_base64_encode (const char *data, | |||
1997 | } | 1997 | } |
1998 | } | 1998 | } |
1999 | opt[ret++] = FILLCHAR; | 1999 | opt[ret++] = FILLCHAR; |
2000 | *output = opt; | ||
2000 | return ret; | 2001 | return ret; |
2001 | } | 2002 | } |
2002 | 2003 | ||
@@ -2018,11 +2019,10 @@ GNUNET_STRINGS_base64_encode (const char *data, | |||
2018 | */ | 2019 | */ |
2019 | size_t | 2020 | size_t |
2020 | GNUNET_STRINGS_base64_decode (const char *data, | 2021 | GNUNET_STRINGS_base64_decode (const char *data, |
2021 | size_t len, char **output) | 2022 | size_t len, |
2023 | void **out) | ||
2022 | { | 2024 | { |
2023 | size_t i; | 2025 | char *output; |
2024 | char c; | ||
2025 | char c1; | ||
2026 | size_t ret = 0; | 2026 | size_t ret = 0; |
2027 | 2027 | ||
2028 | #define CHECK_CRLF while (data[i] == '\r' || data[i] == '\n') {\ | 2028 | #define CHECK_CRLF while (data[i] == '\r' || data[i] == '\n') {\ |
@@ -2031,12 +2031,15 @@ GNUNET_STRINGS_base64_decode (const char *data, | |||
2031 | if (i >= len) goto END; \ | 2031 | if (i >= len) goto END; \ |
2032 | } | 2032 | } |
2033 | 2033 | ||
2034 | *output = GNUNET_malloc ((len * 3 / 4) + 8); | 2034 | output = GNUNET_malloc ((len * 3 / 4) + 8); |
2035 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2035 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2036 | "base64_decode decoding len=%d\n", | 2036 | "base64_decode decoding len=%d\n", |
2037 | (int) len); | 2037 | (int) len); |
2038 | for (i = 0; i < len; ++i) | 2038 | for (size_t i = 0; i < len; ++i) |
2039 | { | 2039 | { |
2040 | char c; | ||
2041 | char c1; | ||
2042 | |||
2040 | CHECK_CRLF; | 2043 | CHECK_CRLF; |
2041 | if (FILLCHAR == data[i]) | 2044 | if (FILLCHAR == data[i]) |
2042 | break; | 2045 | break; |
@@ -2045,7 +2048,7 @@ GNUNET_STRINGS_base64_decode (const char *data, | |||
2045 | CHECK_CRLF; | 2048 | CHECK_CRLF; |
2046 | c1 = (char) cvtfind (data[i]); | 2049 | c1 = (char) cvtfind (data[i]); |
2047 | c = (c << 2) | ((c1 >> 4) & 0x3); | 2050 | c = (c << 2) | ((c1 >> 4) & 0x3); |
2048 | (*output)[ret++] = c; | 2051 | output[ret++] = c; |
2049 | if (++i < len) | 2052 | if (++i < len) |
2050 | { | 2053 | { |
2051 | CHECK_CRLF; | 2054 | CHECK_CRLF; |
@@ -2054,7 +2057,7 @@ GNUNET_STRINGS_base64_decode (const char *data, | |||
2054 | break; | 2057 | break; |
2055 | c = (char) cvtfind (c); | 2058 | c = (char) cvtfind (c); |
2056 | c1 = ((c1 << 4) & 0xf0) | ((c >> 2) & 0xf); | 2059 | c1 = ((c1 << 4) & 0xf0) | ((c >> 2) & 0xf); |
2057 | (*output)[ret++] = c1; | 2060 | output[ret++] = c1; |
2058 | } | 2061 | } |
2059 | if (++i < len) | 2062 | if (++i < len) |
2060 | { | 2063 | { |
@@ -2065,15 +2068,13 @@ GNUNET_STRINGS_base64_decode (const char *data, | |||
2065 | 2068 | ||
2066 | c1 = (char) cvtfind (c1); | 2069 | c1 = (char) cvtfind (c1); |
2067 | c = ((c << 6) & 0xc0) | c1; | 2070 | c = ((c << 6) & 0xc0) | c1; |
2068 | (*output)[ret++] = c; | 2071 | output[ret++] = c; |
2069 | } | 2072 | } |
2070 | } | 2073 | } |
2071 | END: | 2074 | END: |
2075 | *out = output; | ||
2072 | return ret; | 2076 | return ret; |
2073 | } | 2077 | } |
2074 | 2078 | ||
2075 | 2079 | ||
2076 | |||
2077 | |||
2078 | |||
2079 | /* end of strings.c */ | 2080 | /* end of strings.c */ |
diff --git a/src/dns/test_hexcoder.c b/src/util/test_hexcoder.c index 441d7e200..441d7e200 100644 --- a/src/dns/test_hexcoder.c +++ b/src/util/test_hexcoder.c | |||
diff --git a/src/tun/test_regex.c b/src/util/test_regex.c index 2e7d52828..2e7d52828 100644 --- a/src/tun/test_regex.c +++ b/src/util/test_regex.c | |||
diff --git a/src/tun/test_tun.c b/src/util/test_tun.c index edbd4c05d..edbd4c05d 100644 --- a/src/tun/test_tun.c +++ b/src/util/test_tun.c | |||
diff --git a/src/tun/tun.c b/src/util/tun.c index f85f72209..25e729e58 100644 --- a/src/tun/tun.c +++ b/src/util/tun.c | |||
@@ -11,7 +11,7 @@ | |||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | */ | 17 | */ |
@@ -23,7 +23,7 @@ | |||
23 | * @author Christian Grothoff | 23 | * @author Christian Grothoff |
24 | */ | 24 | */ |
25 | #include "platform.h" | 25 | #include "platform.h" |
26 | #include "gnunet_tun_lib.h" | 26 | #include "gnunet_util_lib.h" |
27 | 27 | ||
28 | /** | 28 | /** |
29 | * IP TTL we use for packets that we assemble (8 bit unsigned integer) | 29 | * IP TTL we use for packets that we assemble (8 bit unsigned integer) |
diff --git a/src/vpn/Makefile.am b/src/vpn/Makefile.am index 5c16fa349..d1f74d35b 100644 --- a/src/vpn/Makefile.am +++ b/src/vpn/Makefile.am | |||
@@ -57,7 +57,6 @@ gnunet_service_vpn_SOURCES = \ | |||
57 | gnunet-service-vpn.c | 57 | gnunet-service-vpn.c |
58 | gnunet_service_vpn_LDADD = \ | 58 | gnunet_service_vpn_LDADD = \ |
59 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ | 59 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ |
60 | $(top_builddir)/src/tun/libgnunettun.la \ | ||
61 | $(top_builddir)/src/util/libgnunetutil.la \ | 60 | $(top_builddir)/src/util/libgnunetutil.la \ |
62 | $(top_builddir)/src/cadet/libgnunetcadet.la \ | 61 | $(top_builddir)/src/cadet/libgnunetcadet.la \ |
63 | $(top_builddir)/src/regex/libgnunetregex.la \ | 62 | $(top_builddir)/src/regex/libgnunetregex.la \ |
@@ -69,7 +68,6 @@ gnunet_vpn_SOURCES = \ | |||
69 | gnunet-vpn.c | 68 | gnunet-vpn.c |
70 | gnunet_vpn_LDADD = \ | 69 | gnunet_vpn_LDADD = \ |
71 | libgnunetvpn.la \ | 70 | libgnunetvpn.la \ |
72 | $(top_builddir)/src/tun/libgnunettun.la \ | ||
73 | $(top_builddir)/src/util/libgnunetutil.la \ | 71 | $(top_builddir)/src/util/libgnunetutil.la \ |
74 | $(GN_LIBINTL) | 72 | $(GN_LIBINTL) |
75 | 73 | ||