summaryrefslogtreecommitdiffstats
path: root/src/peer.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2015-03-23 04:51:40 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2015-03-23 04:51:40 +0100
commitefc2019a31cd5039b0738cd0291e36e8deb590ed (patch)
tree5c53f6f299ee9be41368e09424896ddb8fad11ef /src/peer.c
parent7eab938b436a16925ad719c873c634ce93c9756b (diff)
downloadfastd-efc2019a31cd5039b0738cd0291e36e8deb590ed.tar
fastd-efc2019a31cd5039b0738cd0291e36e8deb590ed.zip
peer: don't create interfaces for disabled peers
Diffstat (limited to 'src/peer.c')
-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;