diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-03-30 04:36:50 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-03-30 04:36:50 +0200 |
commit | 6f1f926bb82b7a4bb1fd3cfc981c7596843a9a6e (patch) | |
tree | 19d3345932e1328981eea1d5c25d041fc0f5e0e0 /src/protocol_null.c | |
parent | ca127fccb899627e9e9a69d139bd27d79b30cd54 (diff) | |
download | fastd-6f1f926bb82b7a4bb1fd3cfc981c7596843a9a6e.tar fastd-6f1f926bb82b7a4bb1fd3cfc981c7596843a9a6e.zip |
Make ecfxp protocol work with new handshake
Diffstat (limited to 'src/protocol_null.c')
-rw-r--r-- | src/protocol_null.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/protocol_null.c b/src/protocol_null.c index 3a85e6c..d9588b3 100644 --- a/src/protocol_null.c +++ b/src/protocol_null.c @@ -34,9 +34,6 @@ #include <arpa/inet.h> -#define AS_UINT8(ptr) (*(uint8_t*)(ptr).data) - - static void protocol_init(fastd_context *ctx, fastd_config *conf) { if (conf->n_floating > 1) exit_error(ctx, "with protocol `null' use can't define more than one floating peer"); @@ -56,6 +53,8 @@ static void protocol_handshake_init(fastd_context *ctx, fastd_peer *peer) { } static void establish(fastd_context *ctx, fastd_peer *peer) { + peer->seen = ctx->now; + if (fastd_peer_is_temporary(peer)) { fastd_peer *perm_peer; for (perm_peer = ctx->peers; perm_peer; perm_peer = perm_peer->next) { @@ -77,27 +76,24 @@ static void establish(fastd_context *ctx, fastd_peer *peer) { static void protocol_handshake_handle(fastd_context *ctx, fastd_peer *peer, const fastd_handshake *handshake) { fastd_buffer buffer; - switch(AS_UINT8(handshake->records[RECORD_HANDSHAKE_TYPE])) { + switch(handshake->type) { case 1: buffer = fastd_handshake_new_reply(ctx, peer, handshake, 0); fastd_task_put_send_handshake(ctx, peer, buffer); break; case 2: - peer->seen = ctx->now; establish(ctx, peer); buffer = fastd_handshake_new_reply(ctx, peer, handshake, 0); fastd_task_put_send_handshake(ctx, peer, buffer); break; case 3: - peer->seen = ctx->now; establish(ctx, peer); break; default: - pr_debug(ctx, "received handshake reply with unknown type %u", AS_UINT8(handshake->records[RECORD_HANDSHAKE_TYPE])); - break; + pr_debug(ctx, "received handshake reply with unknown type %u", handshake->type); } } |