From 1d18f972554c8bad0f08b3ff6727c87586e97094 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 6 Mar 2012 21:29:34 +0100 Subject: Reorganized type definitions --- src/fastd.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/fastd.c') diff --git a/src/fastd.c b/src/fastd.c index fdd3f5c..e0a03ad 100644 --- a/src/fastd.c +++ b/src/fastd.c @@ -317,7 +317,8 @@ static void configure(fastd_context *ctx, fastd_config *conf, int argc, char *ar } } - if (conf->bind_addr_in.sin_family == AF_UNSPEC && conf->bind_addr_in6.sin6_family == AF_UNSPEC) { + if (conf->n_floating && conf->bind_addr_in.sin_family == AF_UNSPEC + && conf->bind_addr_in6.sin6_family == AF_UNSPEC) { conf->bind_addr_in.sin_family = AF_INET; conf->bind_addr_in6.sin6_family = AF_INET6; } @@ -347,6 +348,10 @@ static void init_peers(fastd_context *ctx) { fastd_peer_add(ctx, peer_conf); } +static void update_time(fastd_context *ctx) { + clock_gettime(CLOCK_MONOTONIC, &ctx->now); +} + static void handle_tasks(fastd_context *ctx) { fastd_task *task; while ((task = fastd_task_get(ctx)) != NULL) { @@ -565,6 +570,8 @@ static void handle_input(fastd_context *ctx) { if (ret < 0) exit_errno(ctx, "poll"); + update_time(ctx); + if (fds[0].revents & POLLIN) handle_tun(ctx); if (fds[1].revents & POLLIN) @@ -582,6 +589,8 @@ int main(int argc, char *argv[]) { configure(&ctx, &conf, argc, argv); ctx.conf = &conf; + update_time(&ctx); + init_peers(&ctx); init_tuntap(&ctx); -- cgit v1.2.3