diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-10-23 17:20:21 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-10-23 17:20:21 +0000 |
commit | 2665611db7c4267bd765b3f9f4478629390ecc31 (patch) | |
tree | 1a57e3758b2aa4421013a08f4427cef850fc26fd | |
parent | 9817670b9465d68dd7ca7f27a40df273f0cbb16b (diff) | |
download | gnunet-2665611db7c4267bd765b3f9f4478629390ecc31.tar.gz gnunet-2665611db7c4267bd765b3f9f4478629390ecc31.zip |
also generate PONG if PING contains an empty address:
-rw-r--r-- | src/transport/gnunet-service-transport_neighbours.c | 9 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport_validation.c | 40 |
2 files changed, 30 insertions, 19 deletions
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index bd86fcdbd..802a2cf32 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c | |||
@@ -973,8 +973,13 @@ GST_neighbours_calculate_receive_delay (const struct GNUNET_PeerIdentity | |||
973 | gettext_noop | 973 | gettext_noop |
974 | ("# messages discarded due to lack of neighbour record"), | 974 | ("# messages discarded due to lack of neighbour record"), |
975 | 1, GNUNET_NO); | 975 | 1, GNUNET_NO); |
976 | *do_forward = GNUNET_NO; | 976 | GST_neighbours_try_connect (sender); |
977 | return GNUNET_TIME_UNIT_ZERO; | 977 | n = lookup_neighbour (sender); |
978 | if (NULL == n) | ||
979 | { | ||
980 | *do_forward = GNUNET_NO; | ||
981 | return GNUNET_TIME_UNIT_ZERO; | ||
982 | } | ||
978 | } | 983 | } |
979 | if (GNUNET_YES != n->is_connected) | 984 | if (GNUNET_YES != n->is_connected) |
980 | { | 985 | { |
diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c index 6b6b01768..fd9ded10e 100644 --- a/src/transport/gnunet-service-transport_validation.c +++ b/src/transport/gnunet-service-transport_validation.c | |||
@@ -604,25 +604,31 @@ GST_validation_handle_ping (const struct GNUNET_PeerIdentity *sender, | |||
604 | alen = ntohs (hdr->size) - sizeof (struct TransportPingMessage); | 604 | alen = ntohs (hdr->size) - sizeof (struct TransportPingMessage); |
605 | /* peer wants to confirm that this is one of our addresses, this is what is | 605 | /* peer wants to confirm that this is one of our addresses, this is what is |
606 | * used for address validation */ | 606 | * used for address validation */ |
607 | 607 | if (0 < alen) | |
608 | addrend = memchr (addr, '\0', alen); | ||
609 | if (NULL == addrend) | ||
610 | { | 608 | { |
611 | GNUNET_break_op (0); | 609 | addrend = memchr (addr, '\0', alen); |
612 | return; | 610 | if (NULL == addrend) |
613 | } | 611 | { |
614 | addrend++; | 612 | GNUNET_break_op (0); |
615 | slen = strlen (addr) + 1; | 613 | return; |
616 | alen -= slen; | 614 | } |
617 | 615 | addrend++; | |
618 | if (GNUNET_YES != | 616 | slen = strlen (addr) + 1; |
619 | GST_hello_test_address (addr, addrend, alen, &sig_cache, &sig_cache_exp)) | 617 | alen -= slen; |
618 | |||
619 | if (GNUNET_YES != | ||
620 | GST_hello_test_address (addr, addrend, alen, &sig_cache, &sig_cache_exp)) | ||
621 | { | ||
622 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
623 | _ | ||
624 | ("Not confirming PING with address `%s' since I cannot confirm having this address.\n"), | ||
625 | GST_plugins_a2s (addr, addrend, alen)); | ||
626 | return; | ||
627 | } | ||
628 | } | ||
629 | else | ||
620 | { | 630 | { |
621 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 631 | slen = 0; |
622 | _ | ||
623 | ("Not confirming PING with address `%s' since I cannot confirm having this address.\n"), | ||
624 | GST_plugins_a2s (addr, addrend, alen)); | ||
625 | return; | ||
626 | } | 632 | } |
627 | 633 | ||
628 | pong = GNUNET_malloc (sizeof (struct TransportPongMessage) + alen + slen); | 634 | pong = GNUNET_malloc (sizeof (struct TransportPongMessage) + alen + slen); |