summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/config.c5
-rw-r--r--src/config.y10
-rw-r--r--src/peer.c4
-rw-r--r--src/peer.h5
4 files changed, 17 insertions, 7 deletions
diff --git a/src/config.c b/src/config.c
index 23f23cf..95e22db 100644
--- a/src/config.c
+++ b/src/config.c
@@ -546,6 +546,9 @@ static void count_peers(fastd_context_t *ctx, fastd_config_t *conf) {
default:
exit_bug(ctx, "invalid peer address family");
}
+
+ if (peer->dynamic_float_deprecated)
+ pr_warn(ctx, "peer `%s' uses deprecated float syntax, please update your configuration", peer->name);
}
}
@@ -917,7 +920,7 @@ void fastd_configure(fastd_context_t *ctx, fastd_config_t *conf, int argc, char
func(ctx, conf); \
continue; \
}
-#define OPTION_ARG(func, options, arg, message) \
+#define OPTION_ARG(func, options, arg, message) \
if(config_match(argv[i], options, NULL)) { \
i+=2; \
if (i > argc) \
diff --git a/src/config.y b/src/config.y
index 500e18e..97d2f97 100644
--- a/src/config.y
+++ b/src/config.y
@@ -391,8 +391,9 @@ peer_conf: peer_conf peer_statement
;
peer_statement: TOK_REMOTE peer_remote ';'
+ | TOK_FLOAT peer_float ';'
| TOK_KEY peer_key ';'
- | TOK_INCLUDE peer_include ';'
+ | TOK_INCLUDE peer_include ';'
;
peer_remote: TOK_ADDR4 port {
@@ -419,7 +420,12 @@ peer_remote: TOK_ADDR4 port {
conf->peers->hostname = strdup($2->str);
conf->peers->address.sa.sa_family = $1;
conf->peers->address.in.sin_port = htons($3);
- conf->peers->dynamic_float = $4;
+ conf->peers->floating = conf->peers->dynamic_float_deprecated = $4;
+ }
+ ;
+
+peer_float: boolean {
+ conf->peers->floating = $1;
}
;
diff --git a/src/peer.c b/src/peer.c
index 528f560..ebcb867 100644
--- a/src/peer.c
+++ b/src/peer.c
@@ -174,7 +174,7 @@ static void setup_peer(fastd_context_t *ctx, fastd_peer_t *peer) {
if (!peer->protocol_state)
ctx->conf->protocol->init_peer_state(ctx, peer);
- if (!fastd_peer_is_floating(peer) || fastd_peer_is_dynamic(peer)) {
+ if (peer->address.sa.sa_family != AF_UNSPEC || fastd_peer_is_dynamic(peer)) {
unsigned delay = 0;
if (has_group_config_constraints(peer->group->conf))
delay = fastd_rand(ctx, 0, 3000);
@@ -340,7 +340,7 @@ bool fastd_peer_config_equal(const fastd_peer_config_t *peer1, const fastd_peer_
if (!strequal(peer1->hostname, peer2->hostname))
return false;
- if(peer1->dynamic_float != peer2->dynamic_float)
+ if(peer1->floating != peer2->floating)
return false;
if (!fastd_peer_address_equal(&peer1->address, &peer2->address))
diff --git a/src/peer.h b/src/peer.h
index 4b57197..217e5e4 100644
--- a/src/peer.h
+++ b/src/peer.h
@@ -66,7 +66,8 @@ struct fastd_peer_config {
char *hostname;
fastd_peer_address_t address;
- bool dynamic_float;
+ bool floating;
+ bool dynamic_float_deprecated;
char *key;
const fastd_peer_group_config_t *group;
@@ -121,7 +122,7 @@ static inline bool fastd_peer_allow_unknown(fastd_context_t *ctx) {
}
static inline bool fastd_peer_config_is_floating(const fastd_peer_config_t *config) {
- return ((config->hostname == NULL && config->address.sa.sa_family == AF_UNSPEC) || config->dynamic_float);
+ return ((config->hostname == NULL && config->address.sa.sa_family == AF_UNSPEC) || config->floating);
}
static inline bool fastd_peer_config_is_dynamic(const fastd_peer_config_t *config) {