summaryrefslogtreecommitdiffstats
path: root/src/fastd.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-03-08 19:22:53 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-03-08 19:22:53 +0100
commit4e9b2a8819c7062ad052cd6c549db1d0fbed001d (patch)
tree987c871f99025a46a1b702b905f006d193913572 /src/fastd.c
parent5c859a2408506c53f1b3a17bdc867a649f5bf933 (diff)
downloadfastd-4e9b2a8819c7062ad052cd6c549db1d0fbed001d.tar
fastd-4e9b2a8819c7062ad052cd6c549db1d0fbed001d.zip
Disable peer configs by default, enable on peer creation
This allows to remove some duplicate code, and will simplify the detection and handling of duplicate keys.
Diffstat (limited to 'src/fastd.c')
-rw-r--r--src/fastd.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/fastd.c b/src/fastd.c
index 686df31..fec0838 100644
--- a/src/fastd.c
+++ b/src/fastd.c
@@ -616,6 +616,10 @@ static void delete_peer_groups(fastd_context_t *ctx) {
static void init_peers(fastd_context_t *ctx) {
fastd_peer_config_t *peer_conf;
for (peer_conf = ctx->conf->peers; peer_conf; peer_conf = peer_conf->next) {
+ if (peer_conf->enabled)
+ continue;
+
+ peer_conf->enabled = true;
ctx->conf->protocol->peer_configure(ctx, peer_conf);
if (peer_conf->enabled)
@@ -1138,8 +1142,8 @@ int main(int argc, char *argv[]) {
init_tuntap(&ctx);
init_peer_groups(&ctx);
- init_peers(&ctx);
fastd_config_load_peer_dirs(&ctx, &conf);
+ init_peers(&ctx);
if (conf.daemon) {
pid_t pid = fork();
@@ -1188,6 +1192,7 @@ int main(int argc, char *argv[]) {
init_log(&ctx);
fastd_config_load_peer_dirs(&ctx, &conf);
+ init_peers(&ctx);
}
if (dump) {