mirror of
https://github.com/neocturne/fastd.git
synced 2025-05-14 20:25:08 +02:00
Don't initialize monotone timestamps with zero
The monotone timestamp is near zero on linux systems, confusing fastd.
This commit is contained in:
parent
620f1cd45f
commit
7f33ccb920
4 changed files with 14 additions and 5 deletions
|
@ -769,6 +769,9 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
update_time(&ctx);
|
||||
|
||||
conf.long_ago = ctx.now;
|
||||
conf.long_ago.tv_sec -= 86400; /* 24h in the past */
|
||||
|
||||
ctx.next_keepalives = ctx.now;
|
||||
ctx.next_keepalives.tv_sec += conf.keepalive_interval;
|
||||
|
||||
|
|
|
@ -162,6 +162,8 @@ struct fastd_peer_group {
|
|||
};
|
||||
|
||||
struct fastd_config {
|
||||
struct timespec long_ago;
|
||||
|
||||
fastd_loglevel_t log_stderr_level;
|
||||
fastd_loglevel_t log_syslog_level;
|
||||
char *log_syslog_ident;
|
||||
|
|
|
@ -201,16 +201,16 @@ static void setup_peer(fastd_context_t *ctx, fastd_peer_t *peer) {
|
|||
|
||||
fastd_remote_t *remote;
|
||||
for (remote = peer->remotes; remote; remote = remote->next) {
|
||||
remote->last_resolve = (struct timespec){0, 0};
|
||||
remote->last_resolve_return = (struct timespec){0, 0};
|
||||
remote->last_resolve = ctx->conf->long_ago;
|
||||
remote->last_resolve_return = ctx->conf->long_ago;
|
||||
}
|
||||
|
||||
peer->next_remote = peer->remotes;
|
||||
|
||||
peer->last_handshake = (struct timespec){0, 0};
|
||||
peer->last_handshake = ctx->conf->long_ago;
|
||||
peer->last_handshake_address.sa.sa_family = AF_UNSPEC;
|
||||
|
||||
peer->last_handshake_response = (struct timespec){0, 0};
|
||||
peer->last_handshake_response = ctx->conf->long_ago;
|
||||
peer->last_handshake_response_address.sa.sa_family = AF_UNSPEC;
|
||||
|
||||
if (!peer->protocol_state)
|
||||
|
|
|
@ -240,8 +240,12 @@ static bool protocol_peer_check_temporary(fastd_context_t *ctx, fastd_peer_t *pe
|
|||
}
|
||||
|
||||
static void init_protocol_state(fastd_context_t *ctx) {
|
||||
if (!ctx->protocol_state)
|
||||
if (!ctx->protocol_state) {
|
||||
ctx->protocol_state = calloc(1, sizeof(fastd_protocol_state_t));
|
||||
|
||||
ctx->protocol_state->prev_handshake_key.preferred_till = ctx->conf->long_ago;
|
||||
ctx->protocol_state->handshake_key.preferred_till = ctx->conf->long_ago;
|
||||
}
|
||||
}
|
||||
|
||||
static void new_handshake_key(fastd_context_t *ctx, keypair_t *key) {
|
||||
|
|
Loading…
Add table
Reference in a new issue