From 2352e1a79e6f77cb894f5b65b1632e27cd0695a9 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 18 Aug 2014 21:34:53 +0200 Subject: Rename "temporary peers" to "dynamic peers" --- src/async.c | 2 +- src/fastd.c | 2 +- src/fastd.h | 4 ++-- src/peer.c | 10 +++++----- src/peer.h | 2 +- src/protocols/ec25519_fhmqvc/ec25519_fhmqvc.c | 2 +- src/protocols/ec25519_fhmqvc/ec25519_fhmqvc.h | 2 +- src/protocols/ec25519_fhmqvc/handshake.c | 24 ++++++++++++------------ src/protocols/ec25519_fhmqvc/util.c | 2 +- src/resolve.c | 2 +- src/verify.c | 2 +- src/verify.h | 2 +- 12 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/async.c b/src/async.c index d445f0a..7ab78ce 100644 --- a/src/async.c +++ b/src/async.c @@ -67,7 +67,7 @@ static void handle_resolve_return(const fastd_async_resolve_return_t *resolve_re return; if (!peer->config) - exit_bug("resolve return for temporary peer"); + exit_bug("resolve return for dynamic peer"); fastd_remote_t *remote = &VECTOR_INDEX(peer->remotes, resolve_return->remote); fastd_peer_handle_resolve(peer, remote, resolve_return->n_addr, resolve_return->addr); diff --git a/src/fastd.c b/src/fastd.c index 5d24b9b..c67c875 100644 --- a/src/fastd.c +++ b/src/fastd.c @@ -230,7 +230,7 @@ static void init_peers(void) { } } else { - if (!conf.protocol->peer_check_temporary(peer)) { + if (!conf.protocol->peer_check_dynamic(peer)) { fastd_peer_delete(peer); continue; } diff --git a/src/fastd.h b/src/fastd.h index 554a982..fcd8676 100644 --- a/src/fastd.h +++ b/src/fastd.h @@ -79,8 +79,8 @@ struct fastd_protocol { /** Checks if a peer configuration is valid and a connection may be established */ bool (*peer_check)(fastd_peer_config_t *peer_conf); - /** Checks if a temporary peer is valid and a connection may be established */ - bool (*peer_check_temporary)(fastd_peer_t *peer); + /** Checks if a dynamic peer is valid and a connection may be established */ + bool (*peer_check_dynamic)(fastd_peer_t *peer); /** Sends a handshake to the given peer */ diff --git a/src/peer.c b/src/peer.c index b1ae9b3..176b39c 100644 --- a/src/peer.c +++ b/src/peer.c @@ -740,14 +740,14 @@ fastd_peer_t* fastd_peer_add(fastd_peer_config_t *peer_conf) { else { #ifdef WITH_VERIFY if (!fastd_shell_command_isset(&conf.on_verify)) - exit_bug("tried to add temporary peer without on-verify command"); + exit_bug("tried to add dynamic peer without on-verify command"); peer->verify_timeout = ctx.now; peer->verify_valid_timeout = ctx.now; - pr_debug("adding temporary peer"); + pr_debug("adding dynamic peer"); #else - exit_bug("temporary peers not supported"); + exit_bug("dynamic peers not supported"); #endif } @@ -908,11 +908,11 @@ fastd_peer_t* fastd_peer_find_by_eth_addr(const fastd_eth_addr_t addr) { \li If no data was sent to the peer for some time, a keepalive is sent. */ static bool maintain_peer(fastd_peer_t *peer) { - if (fastd_peer_is_temporary(peer) || fastd_peer_is_established(peer)) { + if (fastd_peer_is_dynamic(peer) || fastd_peer_is_established(peer)) { /* check for peer timeout */ if (fastd_timed_out(&peer->timeout)) { #ifdef WITH_VERIFY - if (fastd_peer_is_temporary(peer) && + if (fastd_peer_is_dynamic(peer) && fastd_timed_out(&peer->verify_timeout) && fastd_timed_out(&peer->verify_valid_timeout)) { fastd_peer_delete(peer); diff --git a/src/peer.h b/src/peer.h index c1f5be1..99d84f9 100644 --- a/src/peer.h +++ b/src/peer.h @@ -228,7 +228,7 @@ static inline bool fastd_peer_is_floating(const fastd_peer_t *peer) { } /** Checks if a peer is not statically configured, but added after a on-verify run */ -static inline bool fastd_peer_is_temporary(const fastd_peer_t *peer) { +static inline bool fastd_peer_is_dynamic(const fastd_peer_t *peer) { return (!peer->config); } diff --git a/src/protocols/ec25519_fhmqvc/ec25519_fhmqvc.c b/src/protocols/ec25519_fhmqvc/ec25519_fhmqvc.c index f9bf1f7..67dfac6 100644 --- a/src/protocols/ec25519_fhmqvc/ec25519_fhmqvc.c +++ b/src/protocols/ec25519_fhmqvc/ec25519_fhmqvc.c @@ -219,7 +219,7 @@ const fastd_protocol_t fastd_protocol_ec25519_fhmqvc = { .peer_configure = protocol_peer_configure, .peer_check = fastd_protocol_ec25519_fhmqvc_peer_check, - .peer_check_temporary = fastd_protocol_ec25519_fhmqvc_peer_check_temporary, + .peer_check_dynamic = fastd_protocol_ec25519_fhmqvc_peer_check_dynamic, .handshake_init = fastd_protocol_ec25519_fhmqvc_handshake_init, .handshake_handle = fastd_protocol_ec25519_fhmqvc_handshake_handle, diff --git a/src/protocols/ec25519_fhmqvc/ec25519_fhmqvc.h b/src/protocols/ec25519_fhmqvc/ec25519_fhmqvc.h index fb07d19..b0101ac 100644 --- a/src/protocols/ec25519_fhmqvc/ec25519_fhmqvc.h +++ b/src/protocols/ec25519_fhmqvc/ec25519_fhmqvc.h @@ -102,7 +102,7 @@ struct fastd_protocol_peer_state { bool fastd_protocol_ec25519_fhmqvc_peer_check(fastd_peer_config_t *peer_conf); -bool fastd_protocol_ec25519_fhmqvc_peer_check_temporary(fastd_peer_t *peer); +bool fastd_protocol_ec25519_fhmqvc_peer_check_dynamic(fastd_peer_t *peer); void fastd_protocol_ec25519_fhmqvc_maintenance(void); void fastd_protocol_ec25519_fhmqvc_init_peer_state(fastd_peer_t *peer); diff --git a/src/protocols/ec25519_fhmqvc/handshake.c b/src/protocols/ec25519_fhmqvc/handshake.c index 68c37d2..7fcc40c 100644 --- a/src/protocols/ec25519_fhmqvc/handshake.c +++ b/src/protocols/ec25519_fhmqvc/handshake.c @@ -540,12 +540,12 @@ void fastd_protocol_ec25519_fhmqvc_handshake_init(fastd_socket_t *sock, const fa fastd_send_handshake(sock, local_addr, remote_addr, peer, buffer); } -/** Checks if a temporary peer (added after an on-verify command) can stay after new peers have been configured */ -bool fastd_protocol_ec25519_fhmqvc_peer_check_temporary(fastd_peer_t *peer) { +/** Checks if a dynamic peer (added after an on-verify command) can stay after new peers have been configured */ +bool fastd_protocol_ec25519_fhmqvc_peer_check_dynamic(fastd_peer_t *peer) { if (key_count(peer->protocol_config->public_key.u8)) { char buf[65]; hexdump(buf, peer->protocol_config->public_key.u8); - pr_info("key %s is configured now, deleting temporary peer.", buf); + pr_info("key %s is configured now, deleting dynamic peer.", buf); return false; } @@ -560,8 +560,8 @@ typedef struct verify_data { aligned_int256_t peer_handshake_key; /**< The public key of the peer being verified */ } verify_data_t; -/** Adds a temporary peer for an unknown key */ -static fastd_peer_t * add_temporary(fastd_socket_t *sock, const fastd_peer_address_t *addr, const unsigned char key[PUBLICKEYBYTES]) { +/** Adds a dynamic peer for an unknown key */ +static fastd_peer_t * add_dynamic(fastd_socket_t *sock, const fastd_peer_address_t *addr, const unsigned char key[PUBLICKEYBYTES]) { if (!fastd_allow_verify()) { pr_debug("ignoring handshake from %I (unknown key)", addr); return NULL; @@ -589,8 +589,8 @@ static fastd_peer_t * add_temporary(fastd_socket_t *sock, const fastd_peer_addre return peer; } -/** Is called when a handshake from a temporary peer is received */ -static bool handle_temporary(fastd_socket_t *sock, const fastd_peer_address_t *local_addr, const fastd_peer_address_t *remote_addr, +/** Is called when a handshake from a dynamic peer is received */ +static bool handle_dynamic(fastd_socket_t *sock, const fastd_peer_address_t *local_addr, const fastd_peer_address_t *remote_addr, fastd_peer_t *peer, const fastd_handshake_t *handshake, const fastd_method_info_t *method) { if (handshake->type > 2 || !fastd_timed_out(&peer->verify_timeout)) return !fastd_timed_out(&peer->verify_valid_timeout); @@ -629,8 +629,8 @@ void fastd_protocol_ec25519_fhmqvc_handle_verify_return(fastd_peer_t *peer, fast #else -/** Dummy add temporary function for fastd versions without on-verify support */ -static inline fastd_peer_t * add_temporary(fastd_socket_t *sock UNUSED, const fastd_peer_address_t *addr, const unsigned char key[PUBLICKEYBYTES] UNUSED) { +/** Dummy add dynamic function for fastd versions without on-verify support */ +static inline fastd_peer_t * add_dynamic(fastd_socket_t *sock UNUSED, const fastd_peer_address_t *addr, const unsigned char key[PUBLICKEYBYTES] UNUSED) { pr_debug("ignoring handshake from %I (unknown key)", addr); return NULL; } @@ -656,7 +656,7 @@ void fastd_protocol_ec25519_fhmqvc_handshake_handle(fastd_socket_t *sock, const return; case ENOENT: - peer = add_temporary(sock, remote_addr, handshake->records[RECORD_SENDER_KEY].data); + peer = add_dynamic(sock, remote_addr, handshake->records[RECORD_SENDER_KEY].data); if (peer) break; @@ -690,8 +690,8 @@ void fastd_protocol_ec25519_fhmqvc_handshake_handle(fastd_socket_t *sock, const } #ifdef WITH_VERIFY - if (fastd_peer_is_temporary(peer)) { - if (!handle_temporary(sock, local_addr, remote_addr, peer, handshake, method)) + if (fastd_peer_is_dynamic(peer)) { + if (!handle_dynamic(sock, local_addr, remote_addr, peer, handshake, method)) return; } #endif diff --git a/src/protocols/ec25519_fhmqvc/util.c b/src/protocols/ec25519_fhmqvc/util.c index e4a0c08..2aea52d 100644 --- a/src/protocols/ec25519_fhmqvc/util.c +++ b/src/protocols/ec25519_fhmqvc/util.c @@ -92,7 +92,7 @@ void fastd_protocol_ec25519_fhmqvc_set_shell_env(fastd_shell_env_t *env, const f /** Generates a protocol-specific string representation of a peer - This will only be used for peers without names (e.g. temporary peers) and + This will only be used for peers without names (e.g. dynamic peers) and creates a string containing the first 16 hexadecimal digits of the peer's public key. */ diff --git a/src/resolve.c b/src/resolve.c index 4ed2faf..b11ce9b 100644 --- a/src/resolve.c +++ b/src/resolve.c @@ -114,7 +114,7 @@ static void* resolve_peer(void *varg) { /** Starts to resolve a given dynamic remote of a peer to an IP address asynchronously */ void fastd_resolve_peer(fastd_peer_t *peer, fastd_remote_t *remote) { if (!peer->config) - exit_bug("trying to resolve temporary peer"); + exit_bug("trying to resolve dynamic peer"); if (!fastd_timed_out(&remote->last_resolve_timeout)) { /* last resolve was just a few seconds ago */ diff --git a/src/verify.c b/src/verify.c index 4f28faf..308104d 100644 --- a/src/verify.c +++ b/src/verify.c @@ -26,7 +26,7 @@ /** \file - Handling of on-verify commands to add peers not configured statically ("temporary peers") + Handling of on-verify commands to add peers not configured statically ("dynamic peers") */ diff --git a/src/verify.h b/src/verify.h index 5203339..c2b1ee3 100644 --- a/src/verify.h +++ b/src/verify.h @@ -26,7 +26,7 @@ /** \file - Handling of on-verify commands to add peers not configured statically ("temporary peers") + Handling of on-verify commands to add peers not configured statically ("dynamic peers") */ -- cgit v1.2.3