summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2015-03-23 00:38:14 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2015-03-23 01:04:53 +0100
commit08e782b27d47c4b5e74d505aecfee661ff9df4e0 (patch)
tree8b0559e734ffad045db6ab11141e2ae9a8a97b8a
parent9a4b384053edf673f97dc60d82e1d897a70bd293 (diff)
downloadfastd-08e782b27d47c4b5e74d505aecfee661ff9df4e0.tar
fastd-08e782b27d47c4b5e74d505aecfee661ff9df4e0.zip
Set the default interface for all peers
-rw-r--r--src/peer.c4
-rw-r--r--src/protocols/ec25519_fhmqvc/handshake.c1
-rw-r--r--src/receive.c2
3 files changed, 5 insertions, 2 deletions
diff --git a/src/peer.c b/src/peer.c
index 417e213..35eae28 100644
--- a/src/peer.c
+++ b/src/peer.c
@@ -44,7 +44,7 @@ void fastd_peer_set_shell_env(fastd_shell_env_t *env, const fastd_peer_t *peer,
fastd_shell_env_set(env, "PEER_NAME", peer ? peer->name : NULL);
- fastd_shell_env_set_iface(env, peer->iface ?: ctx.iface);
+ fastd_shell_env_set_iface(env, peer->iface);
switch(local_addr ? local_addr->sa.sa_family : AF_UNSPEC) {
case AF_INET:
@@ -378,6 +378,8 @@ static void setup_peer(fastd_peer_t *peer) {
peer->verify_valid_timeout = ctx.now;
#endif
+ peer->iface = ctx.iface;
+
if (!fastd_peer_is_enabled(peer))
/* Keep the peer in STATE_INACTIVE */
return;
diff --git a/src/protocols/ec25519_fhmqvc/handshake.c b/src/protocols/ec25519_fhmqvc/handshake.c
index 27e4894..246336b 100644
--- a/src/protocols/ec25519_fhmqvc/handshake.c
+++ b/src/protocols/ec25519_fhmqvc/handshake.c
@@ -562,6 +562,7 @@ static fastd_peer_t * add_dynamic(fastd_socket_t *sock, const fastd_peer_address
fastd_peer_t *peer = fastd_new0(fastd_peer_t);
peer->group = conf.peer_group;
+ peer->iface = ctx.iface;
peer->config_state = CONFIG_DYNAMIC;
peer->key = fastd_new(fastd_protocol_key_t);
diff --git a/src/receive.c b/src/receive.c
index c1f962c..df25364 100644
--- a/src/receive.c
+++ b/src/receive.c
@@ -306,7 +306,7 @@ void fastd_handle_receive(fastd_peer_t *peer, fastd_buffer_t buffer, bool reorde
if (reordered)
fastd_stats_add(peer, STAT_RX_REORDERED, buffer.len);
- fastd_iface_write(peer->iface ?: ctx.iface, buffer);
+ fastd_iface_write(peer->iface, buffer);
if (conf.mode == MODE_TAP && conf.forward) {
fastd_send_data(buffer, peer, NULL);