diff options
Diffstat (limited to 'src/transport/gnunet-service-transport_validation.c')
-rw-r--r-- | src/transport/gnunet-service-transport_validation.c | 53 |
1 files changed, 28 insertions, 25 deletions
diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c index 5758ebfbb..d7b4929b2 100644 --- a/src/transport/gnunet-service-transport_validation.c +++ b/src/transport/gnunet-service-transport_validation.c | |||
@@ -405,8 +405,8 @@ add_valid_address (void *cls, const char *tname, | |||
405 | } | 405 | } |
406 | ve = find_validation_entry (&public_key, &pid, tname, addr, addrlen); | 406 | ve = find_validation_entry (&public_key, &pid, tname, addr, addrlen); |
407 | ve->valid_until = GNUNET_TIME_absolute_max (ve->valid_until, expiration); | 407 | ve->valid_until = GNUNET_TIME_absolute_max (ve->valid_until, expiration); |
408 | GNUNET_ATS_address_update (GST_ats, &pid, tname, addr, | 408 | GNUNET_ATS_address_update (GST_ats, &pid, tname, addr, addrlen, NULL, NULL, |
409 | addrlen, NULL, NULL, 0); | 409 | 0); |
410 | return GNUNET_OK; | 410 | return GNUNET_OK; |
411 | } | 411 | } |
412 | 412 | ||
@@ -595,7 +595,8 @@ GST_validation_handle_ping (const struct GNUNET_PeerIdentity *sender, | |||
595 | sizeof (struct GNUNET_PeerIdentity))) | 595 | sizeof (struct GNUNET_PeerIdentity))) |
596 | { | 596 | { |
597 | GNUNET_STATISTICS_update (GST_stats, | 597 | GNUNET_STATISTICS_update (GST_stats, |
598 | gettext_noop ("# PING message for different peer received"), 1, | 598 | gettext_noop |
599 | ("# PING message for different peer received"), 1, | ||
599 | GNUNET_NO); | 600 | GNUNET_NO); |
600 | return; | 601 | return; |
601 | } | 602 | } |
@@ -614,27 +615,28 @@ GST_validation_handle_ping (const struct GNUNET_PeerIdentity *sender, | |||
614 | { | 615 | { |
615 | addrend = memchr (addr, '\0', alen); | 616 | addrend = memchr (addr, '\0', alen); |
616 | if (NULL == addrend) | 617 | if (NULL == addrend) |
617 | { | 618 | { |
618 | GNUNET_break_op (0); | 619 | GNUNET_break_op (0); |
619 | return; | 620 | return; |
620 | } | 621 | } |
621 | addrend++; | 622 | addrend++; |
622 | slen = strlen (addr) + 1; | 623 | slen = strlen (addr) + 1; |
623 | alen -= slen; | 624 | alen -= slen; |
624 | 625 | ||
625 | if (GNUNET_YES != | 626 | if (GNUNET_YES != |
626 | GST_hello_test_address (addr, addrend, alen, &sig_cache, &sig_cache_exp)) | 627 | GST_hello_test_address (addr, addrend, alen, &sig_cache, |
628 | &sig_cache_exp)) | ||
627 | { | 629 | { |
628 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 630 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
629 | _ | 631 | _ |
630 | ("Not confirming PING with address `%s' since I cannot confirm having this address.\n"), | 632 | ("Not confirming PING with address `%s' since I cannot confirm having this address.\n"), |
631 | GST_plugins_a2s (addr, addrend, alen)); | 633 | GST_plugins_a2s (addr, addrend, alen)); |
632 | return; | 634 | return; |
633 | } | 635 | } |
634 | } | 636 | } |
635 | else | 637 | else |
636 | { | 638 | { |
637 | addrend = NULL; /* make gcc happy */ | 639 | addrend = NULL; /* make gcc happy */ |
638 | slen = 0; | 640 | slen = 0; |
639 | static struct GNUNET_CRYPTO_RsaSignature no_address_signature; | 641 | static struct GNUNET_CRYPTO_RsaSignature no_address_signature; |
640 | static struct GNUNET_TIME_Absolute no_address_signature_expiration; | 642 | static struct GNUNET_TIME_Absolute no_address_signature_expiration; |
@@ -751,7 +753,8 @@ transmit_ping_if_allowed (void *cls, const struct GNUNET_PeerIdentity *pid, | |||
751 | 753 | ||
752 | ve->bc = NULL; | 754 | ve->bc = NULL; |
753 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Transmitting plain PING to `%s' %s\n", | 755 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Transmitting plain PING to `%s' %s\n", |
754 | GNUNET_i2s (pid), GST_plugins_a2s (ve->transport_name, ve->addr, ve->addrlen)); | 756 | GNUNET_i2s (pid), GST_plugins_a2s (ve->transport_name, ve->addr, |
757 | ve->addrlen)); | ||
755 | 758 | ||
756 | slen = strlen (ve->transport_name) + 1; | 759 | slen = strlen (ve->transport_name) + 1; |
757 | hello = GST_hello_get (); | 760 | hello = GST_hello_get (); |
@@ -996,12 +999,13 @@ GST_validation_handle_pong (const struct GNUNET_PeerIdentity *sender, | |||
996 | struct GNUNET_ATS_Information ats; | 999 | struct GNUNET_ATS_Information ats; |
997 | 1000 | ||
998 | ats.type = htonl (GNUNET_ATS_QUALITY_NET_DELAY); | 1001 | ats.type = htonl (GNUNET_ATS_QUALITY_NET_DELAY); |
999 | ats.value = htonl ((uint32_t) GNUNET_TIME_absolute_get_duration (ve->send_time).rel_value); | 1002 | ats.value = |
1000 | GNUNET_ATS_address_update (GST_ats, &ve->pid, | 1003 | htonl ((uint32_t) |
1001 | ve->transport_name,ve->addr, ve->addrlen, NULL, | 1004 | GNUNET_TIME_absolute_get_duration (ve->send_time).rel_value); |
1002 | &ats, 1); | 1005 | GNUNET_ATS_address_update (GST_ats, &ve->pid, ve->transport_name, ve->addr, |
1006 | ve->addrlen, NULL, &ats, 1); | ||
1003 | } | 1007 | } |
1004 | 1008 | ||
1005 | /* build HELLO to store in PEERINFO */ | 1009 | /* build HELLO to store in PEERINFO */ |
1006 | ve->copied = GNUNET_NO; | 1010 | ve->copied = GNUNET_NO; |
1007 | hello = GNUNET_HELLO_create (&ve->public_key, &add_valid_peer_address, ve); | 1011 | hello = GNUNET_HELLO_create (&ve->public_key, &add_valid_peer_address, ve); |
@@ -1043,17 +1047,16 @@ GST_validation_handle_hello (const struct GNUNET_MessageHeader *hello) | |||
1043 | GNUNET_break (0); | 1047 | GNUNET_break (0); |
1044 | return; | 1048 | return; |
1045 | } | 1049 | } |
1046 | if (0 == memcmp (&GST_my_identity, &vac.pid, sizeof (struct GNUNET_PeerIdentity))) | 1050 | if (0 == |
1051 | memcmp (&GST_my_identity, &vac.pid, sizeof (struct GNUNET_PeerIdentity))) | ||
1047 | return; | 1052 | return; |
1048 | /* Add peer identity without addresses to peerinfo service */ | 1053 | /* Add peer identity without addresses to peerinfo service */ |
1049 | h = GNUNET_HELLO_create (&vac.public_key, NULL, NULL); | 1054 | h = GNUNET_HELLO_create (&vac.public_key, NULL, NULL); |
1050 | GNUNET_PEERINFO_add_peer (GST_peerinfo, h); | 1055 | GNUNET_PEERINFO_add_peer (GST_peerinfo, h); |
1051 | #if VERBOSE_VALIDATION | 1056 | #if VERBOSE_VALIDATION |
1052 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1057 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1053 | _ | 1058 | _("Adding `%s' without addresses for peer `%s'\n"), "HELLO", |
1054 | ("Adding `%s' without addresses for peer `%s'\n"), | 1059 | GNUNET_i2s (&vac.pid)); |
1055 | "HELLO", | ||
1056 | GNUNET_i2s(&vac.pid)); | ||
1057 | #endif | 1060 | #endif |
1058 | GNUNET_free (h); | 1061 | GNUNET_free (h); |
1059 | 1062 | ||