summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/peer.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/peer.c b/src/peer.c
index 9964559..9654c15 100644
--- a/src/peer.c
+++ b/src/peer.c
@@ -313,6 +313,15 @@ static void reset_peer(fastd_peer_t *peer) {
peer->address.sa.sa_family = AF_UNSPEC;
peer->local_address.sa.sa_family = AF_UNSPEC;
peer->state = STATE_INACTIVE;
+
+ if (!conf.iface_persist || peer->config_state == CONFIG_DISABLED) {
+ if (peer->iface && peer->iface->peer) {
+ fastd_on_down(peer->iface);
+ fastd_iface_close(peer->iface);
+ }
+
+ peer->iface = NULL;
+ }
}
/**
@@ -379,6 +388,10 @@ static void setup_peer(fastd_peer_t *peer) {
peer->verify_valid_timeout = ctx.now;
#endif
+ if (!fastd_peer_is_enabled(peer))
+ /* Keep the peer in STATE_INACTIVE */
+ return;
+
if (ctx.iface) {
peer->iface = ctx.iface;
}
@@ -397,10 +410,6 @@ static void setup_peer(fastd_peer_t *peer) {
exit(1);
}
- if (!fastd_peer_is_enabled(peer))
- /* Keep the peer in STATE_INACTIVE */
- return;
-
fastd_remote_t *next_remote = fastd_peer_get_next_remote(peer);
if (next_remote) {
next_remote->current_address = 0;