summaryrefslogtreecommitdiffstats
path: root/src/protocol_ec25519_fhmqvc.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2012-06-04 17:21:32 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2012-06-04 17:21:32 +0200
commitf2bb9fd6d433440f49dcea9d47f519d23388847f (patch)
tree26148eb5787b30bca41bafc6c1ded2ca96bb259b /src/protocol_ec25519_fhmqvc.c
parenta157804e7b19e94ca9d7f3ae9efd516bcc0ece85 (diff)
downloadfastd-f2bb9fd6d433440f49dcea9d47f519d23388847f.tar
fastd-f2bb9fd6d433440f49dcea9d47f519d23388847f.zip
Add version string to handshake
Diffstat (limited to 'src/protocol_ec25519_fhmqvc.c')
-rw-r--r--src/protocol_ec25519_fhmqvc.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/protocol_ec25519_fhmqvc.c b/src/protocol_ec25519_fhmqvc.c
index c889d23..29fe280 100644
--- a/src/protocol_ec25519_fhmqvc.c
+++ b/src/protocol_ec25519_fhmqvc.c
@@ -519,6 +519,7 @@ static inline bool has_field(const fastd_handshake *handshake, uint8_t type, siz
static void protocol_handshake_handle(fastd_context *ctx, const fastd_peer_address *address, const fastd_peer_config *peer_conf, const fastd_handshake *handshake) {
handshake_key *handshake_key;
+ char *peer_version_name = NULL;
maintenance(ctx);
@@ -568,6 +569,12 @@ static void protocol_handshake_handle(fastd_context *ctx, const fastd_peer_addre
switch(handshake->type) {
case 1:
+ if (handshake->records[RECORD_VERSION_NAME].data)
+ peer_version_name = strndup(handshake->records[RECORD_VERSION_NAME].data, handshake->records[RECORD_VERSION_NAME].length);
+
+ pr_debug(ctx, "received handshake from %P[%I] using fastd %s", peer, address, peer_version_name);
+ free(peer_version_name);
+
respond_handshake(ctx, address, peer, &ctx->protocol_state->handshake_key, handshake->records[RECORD_SENDER_HANDSHAKE_KEY].data, handshake);
break;
@@ -583,7 +590,11 @@ static void protocol_handshake_handle(fastd_context *ctx, const fastd_peer_addre
return;
}
- pr_debug(ctx, "received handshake response from %P[%I]", peer, address);
+ if (handshake->records[RECORD_VERSION_NAME].data)
+ peer_version_name = strndup(handshake->records[RECORD_VERSION_NAME].data, handshake->records[RECORD_VERSION_NAME].length);
+
+ pr_debug(ctx, "received handshake response from %P[%I] using fastd %s", peer, address, peer_version_name);
+ free(peer_version_name);
finish_handshake(ctx, address, peer, handshake_key, handshake->records[RECORD_SENDER_HANDSHAKE_KEY].data, handshake);
break;