summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2015-03-23 03:05:57 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2015-03-23 03:05:57 +0100
commitbaf23ebb6333deee1f7b67f83e7a125c21f2d535 (patch)
tree4c3f92f8d4d4aa13d484358298a97d1973f14b3c /src
parent1236a7ccc31635eb2ea2be036e776abaeb18553a (diff)
downloadfastd-baf23ebb6333deee1f7b67f83e7a125c21f2d535.tar
fastd-baf23ebb6333deee1f7b67f83e7a125c21f2d535.zip
Don't reset peers twice on start in TUN mode
Diffstat (limited to 'src')
-rw-r--r--src/config.c17
-rw-r--r--src/config.h2
-rw-r--r--src/fastd.c4
3 files changed, 15 insertions, 8 deletions
diff --git a/src/config.c b/src/config.c
index 2deacd6..1fff240 100644
--- a/src/config.c
+++ b/src/config.c
@@ -592,7 +592,7 @@ static void peer_dirs_read_peer_group(fastd_peer_group_t *group) {
}
/** Initializes the configured peers */
-void fastd_configure_peers(void) {
+static void configure_peers(bool dirs_only) {
ctx.has_floating = false;
ssize_t i;
@@ -621,13 +621,20 @@ void fastd_configure_peers(void) {
peer->config_state = CONFIG_STATIC;
- if (!fastd_peer_is_established(peer))
- fastd_peer_reset(peer);
+ if (!fastd_peer_is_established(peer)) {
+ if (peer->config_source_dir || !dirs_only)
+ fastd_peer_reset(peer);
+ }
}
}
+/** Initialized the peers not configured through peer directories */
+void fastd_configure_peers(void) {
+ configure_peers(false);
+}
+
/** Refreshes the peer configurations from the configured peer dirs */
-void fastd_config_load_peer_dirs(void) {
+void fastd_config_load_peer_dirs(bool dirs_only) {
size_t i;
for (i = 0; i < VECTOR_LEN(ctx.peers); i++) {
fastd_peer_t *peer = VECTOR_INDEX(ctx.peers, i);
@@ -643,7 +650,7 @@ void fastd_config_load_peer_dirs(void) {
}
peer_dirs_read_peer_group(conf.peer_group);
- fastd_configure_peers();
+ configure_peers(dirs_only);
}
/** Frees all resources used by the global configuration */
diff --git a/src/config.h b/src/config.h
index 8c87e5a..60be363 100644
--- a/src/config.h
+++ b/src/config.h
@@ -62,5 +62,5 @@ void fastd_config_add_peer_dir(fastd_peer_group_t *group, const char *dir);
void fastd_configure(int argc, char *const argv[]);
void fastd_configure_peers(void);
void fastd_config_check(void);
-void fastd_config_load_peer_dirs(void);
+void fastd_config_load_peer_dirs(bool dirs_only);
diff --git a/src/fastd.c b/src/fastd.c
index ecef0fb..8ce10c8 100644
--- a/src/fastd.c
+++ b/src/fastd.c
@@ -535,7 +535,7 @@ static inline void init(int argc, char *argv[]) {
else if (conf.drop_caps == DROP_CAPS_OFF)
set_user();
- fastd_config_load_peer_dirs();
+ fastd_config_load_peer_dirs(true);
}
@@ -582,7 +582,7 @@ static inline void handle_signals(void) {
pr_info("reconfigure triggered");
- fastd_config_load_peer_dirs();
+ fastd_config_load_peer_dirs(false);
}
if (sig_reset) {