diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2015-03-23 04:51:40 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2015-03-23 04:51:40 +0100 |
commit | efc2019a31cd5039b0738cd0291e36e8deb590ed (patch) | |
tree | 5c53f6f299ee9be41368e09424896ddb8fad11ef | |
parent | 7eab938b436a16925ad719c873c634ce93c9756b (diff) | |
download | fastd-efc2019a31cd5039b0738cd0291e36e8deb590ed.tar fastd-efc2019a31cd5039b0738cd0291e36e8deb590ed.zip |
peer: don't create interfaces for disabled peers
-rw-r--r-- | src/peer.c | 17 |
1 files changed, 13 insertions, 4 deletions
@@ -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; |