diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2014-08-29 11:31:38 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2014-08-29 11:31:38 +0000 |
commit | c123f267c0a83f69395e09a6034d5cc219ade838 (patch) | |
tree | 664e18764d877468682bc923fe6aaeb7e2e508f9 /src/transport/gnunet-service-transport_validation.c | |
parent | 6c20cb042f548dbd98a89ed457c82212090ea7b0 (diff) | |
download | gnunet-c123f267c0a83f69395e09a6034d5cc219ade838.tar.gz gnunet-c123f267c0a83f69395e09a6034d5cc219ade838.zip |
profiler
Diffstat (limited to 'src/transport/gnunet-service-transport_validation.c')
-rw-r--r-- | src/transport/gnunet-service-transport_validation.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c index ebfe963cb..3c7edd140 100644 --- a/src/transport/gnunet-service-transport_validation.c +++ b/src/transport/gnunet-service-transport_validation.c | |||
@@ -990,8 +990,8 @@ GST_validation_handle_ping (const struct GNUNET_PeerIdentity *sender, | |||
990 | const char *addrend; | 990 | const char *addrend; |
991 | char *plugin_name; | 991 | char *plugin_name; |
992 | char *pos; | 992 | char *pos; |
993 | size_t alen; | 993 | size_t len_address; |
994 | size_t slen; | 994 | size_t len_plugin; |
995 | ssize_t ret; | 995 | ssize_t ret; |
996 | int buggy = GNUNET_NO; | 996 | int buggy = GNUNET_NO; |
997 | struct GNUNET_HELLO_Address address; | 997 | struct GNUNET_HELLO_Address address; |
@@ -1016,27 +1016,27 @@ GST_validation_handle_ping (const struct GNUNET_PeerIdentity *sender, | |||
1016 | gettext_noop ("# PING messages received"), 1, | 1016 | gettext_noop ("# PING messages received"), 1, |
1017 | GNUNET_NO); | 1017 | GNUNET_NO); |
1018 | addr = (const char *) &ping[1]; | 1018 | addr = (const char *) &ping[1]; |
1019 | alen = ntohs (hdr->size) - sizeof (struct TransportPingMessage); | 1019 | len_address = ntohs (hdr->size) - sizeof (struct TransportPingMessage); |
1020 | /* peer wants to confirm that this is one of our addresses, this is what is | 1020 | /* peer wants to confirm that this is one of our addresses, this is what is |
1021 | * used for address validation */ | 1021 | * used for address validation */ |
1022 | 1022 | ||
1023 | sig_cache = NULL; | 1023 | sig_cache = NULL; |
1024 | sig_cache_exp = NULL; | 1024 | sig_cache_exp = NULL; |
1025 | papi = NULL; | 1025 | papi = NULL; |
1026 | if (alen > 0) | 1026 | if (len_address > 0) |
1027 | { | 1027 | { |
1028 | addrend = memchr (addr, '\0', alen); | 1028 | addrend = memchr (addr, '\0', len_address); |
1029 | if (NULL == addrend) | 1029 | if (NULL == addrend) |
1030 | { | 1030 | { |
1031 | GNUNET_break_op (0); | 1031 | GNUNET_break_op (0); |
1032 | return GNUNET_SYSERR; | 1032 | return GNUNET_SYSERR; |
1033 | } | 1033 | } |
1034 | addrend++; | 1034 | addrend++; |
1035 | slen = strlen (addr) + 1; | 1035 | len_plugin = strlen (addr) + 1; |
1036 | alen -= slen; | 1036 | len_address -= len_plugin; |
1037 | address.local_info = GNUNET_HELLO_ADDRESS_INFO_NONE; | 1037 | address.local_info = GNUNET_HELLO_ADDRESS_INFO_NONE; |
1038 | address.address = addrend; | 1038 | address.address = addrend; |
1039 | address.address_length = alen; | 1039 | address.address_length = len_address; |
1040 | address.transport_name = addr; | 1040 | address.transport_name = addr; |
1041 | address.peer = GST_my_identity; | 1041 | address.peer = GST_my_identity; |
1042 | 1042 | ||
@@ -1065,7 +1065,7 @@ GST_validation_handle_ping (const struct GNUNET_PeerIdentity *sender, | |||
1065 | return GNUNET_SYSERR; | 1065 | return GNUNET_SYSERR; |
1066 | } | 1066 | } |
1067 | GNUNET_free (plugin_name); | 1067 | GNUNET_free (plugin_name); |
1068 | if (GNUNET_OK != papi->check_address (papi->cls, addrend, alen)) | 1068 | if (GNUNET_OK != papi->check_address (papi->cls, addrend, len_address)) |
1069 | { | 1069 | { |
1070 | GNUNET_STATISTICS_update (GST_stats, | 1070 | GNUNET_STATISTICS_update (GST_stats, |
1071 | gettext_noop | 1071 | gettext_noop |
@@ -1108,7 +1108,7 @@ GST_validation_handle_ping (const struct GNUNET_PeerIdentity *sender, | |||
1108 | else | 1108 | else |
1109 | { | 1109 | { |
1110 | addrend = NULL; /* make gcc happy */ | 1110 | addrend = NULL; /* make gcc happy */ |
1111 | slen = 0; | 1111 | len_plugin = 0; |
1112 | static struct GNUNET_CRYPTO_EddsaSignature no_address_signature; | 1112 | static struct GNUNET_CRYPTO_EddsaSignature no_address_signature; |
1113 | static struct GNUNET_TIME_Absolute no_address_signature_expiration; | 1113 | static struct GNUNET_TIME_Absolute no_address_signature_expiration; |
1114 | 1114 | ||
@@ -1124,22 +1124,22 @@ GST_validation_handle_ping (const struct GNUNET_PeerIdentity *sender, | |||
1124 | /* message with structure: | 1124 | /* message with structure: |
1125 | * [TransportPongMessage][Transport name][Address] */ | 1125 | * [TransportPongMessage][Transport name][Address] */ |
1126 | 1126 | ||
1127 | pong = GNUNET_malloc (sizeof (struct TransportPongMessage) + alen + slen); | 1127 | pong = GNUNET_malloc (sizeof (struct TransportPongMessage) + len_address + len_plugin); |
1128 | pong->header.size = | 1128 | pong->header.size = |
1129 | htons (sizeof (struct TransportPongMessage) + alen + slen); | 1129 | htons (sizeof (struct TransportPongMessage) + len_address + len_plugin); |
1130 | pong->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_PONG); | 1130 | pong->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_PONG); |
1131 | pong->purpose.size = | 1131 | pong->purpose.size = |
1132 | htonl (sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + | 1132 | htonl (sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + |
1133 | sizeof (uint32_t) + sizeof (struct GNUNET_TIME_AbsoluteNBO) + | 1133 | sizeof (uint32_t) + sizeof (struct GNUNET_TIME_AbsoluteNBO) + |
1134 | alen + slen); | 1134 | len_address + len_plugin); |
1135 | pong->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_OWN); | 1135 | pong->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_OWN); |
1136 | memcpy (&pong->challenge, &ping->challenge, sizeof (ping->challenge)); | 1136 | memcpy (&pong->challenge, &ping->challenge, sizeof (ping->challenge)); |
1137 | pong->addrlen = htonl (alen + slen); | 1137 | pong->addrlen = htonl (len_address + len_plugin); |
1138 | memcpy (&pong[1], addr, slen); /* Copy transport plugin */ | 1138 | memcpy (&pong[1], addr, len_plugin); /* Copy transport plugin */ |
1139 | if (alen > 0) | 1139 | if (len_address > 0) |
1140 | { | 1140 | { |
1141 | GNUNET_assert (NULL != addrend); | 1141 | GNUNET_assert (NULL != addrend); |
1142 | memcpy (&((char *) &pong[1])[slen], addrend, alen); | 1142 | memcpy (&((char *) &pong[1])[len_plugin], addrend, len_address); |
1143 | } | 1143 | } |
1144 | if (GNUNET_TIME_absolute_get_remaining (*sig_cache_exp).rel_value_us < | 1144 | if (GNUNET_TIME_absolute_get_remaining (*sig_cache_exp).rel_value_us < |
1145 | PONG_SIGNATURE_LIFETIME.rel_value_us / 4) | 1145 | PONG_SIGNATURE_LIFETIME.rel_value_us / 4) |