summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2015-03-23 00:21:58 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2015-03-23 00:21:58 +0100
commitd2accfd480e58c67da672c92868724eb66cbce77 (patch)
tree62e7c8015ea033dd01477053e529a1a55c8c1b26
parentb96a7b180024f34bc67168a4a42d7e5b819d726a (diff)
downloadfastd-d2accfd480e58c67da672c92868724eb66cbce77.tar
fastd-d2accfd480e58c67da672c92868724eb66cbce77.zip
Fix sending data from peer-specific interfaces
-rw-r--r--src/fastd.h2
-rw-r--r--src/iface.c2
-rw-r--r--src/receive.c2
-rw-r--r--src/send.c7
4 files changed, 9 insertions, 4 deletions
diff --git a/src/fastd.h b/src/fastd.h
index 296f3b1..d901554 100644
--- a/src/fastd.h
+++ b/src/fastd.h
@@ -347,7 +347,7 @@ extern fastd_config_t conf;
void fastd_send(const fastd_socket_t *sock, const fastd_peer_address_t *local_addr, const fastd_peer_address_t *remote_addr, fastd_peer_t *peer, fastd_buffer_t buffer, size_t stat_size);
void fastd_send_handshake(const fastd_socket_t *sock, const fastd_peer_address_t *local_addr, const fastd_peer_address_t *remote_addr, fastd_peer_t *peer, fastd_buffer_t buffer);
-void fastd_send_data(fastd_buffer_t buffer, fastd_peer_t *source);
+void fastd_send_data(fastd_buffer_t buffer, fastd_peer_t *source, fastd_peer_t *dest);
void fastd_receive_unknown_init(void);
void fastd_receive_unknown_free(void);
diff --git a/src/iface.c b/src/iface.c
index be0af40..5d6fb27 100644
--- a/src/iface.c
+++ b/src/iface.c
@@ -407,7 +407,7 @@ void fastd_iface_handle(fastd_iface_t *iface) {
if (multiaf_tun && get_iface_type() == IFACE_TYPE_TUN)
fastd_buffer_push_head(&buffer, 4);
- fastd_send_data(buffer, iface->peer);
+ fastd_send_data(buffer, NULL, iface->peer);
}
/** Writes a packet to the TUN/TAP device */
diff --git a/src/receive.c b/src/receive.c
index 2f0c87c..c1f962c 100644
--- a/src/receive.c
+++ b/src/receive.c
@@ -309,7 +309,7 @@ void fastd_handle_receive(fastd_peer_t *peer, fastd_buffer_t buffer, bool reorde
fastd_iface_write(peer->iface ?: ctx.iface, buffer);
if (conf.mode == MODE_TAP && conf.forward) {
- fastd_send_data(buffer, peer);
+ fastd_send_data(buffer, peer, NULL);
return;
}
diff --git a/src/send.c b/src/send.c
index c340daf..f0ba2f7 100644
--- a/src/send.c
+++ b/src/send.c
@@ -242,7 +242,12 @@ static inline bool send_data_tap_single(fastd_buffer_t buffer, fastd_peer_t *sou
}
/** Sends a buffer of payload data to other peers */
-void fastd_send_data(fastd_buffer_t buffer, fastd_peer_t *source) {
+void fastd_send_data(fastd_buffer_t buffer, fastd_peer_t *source, fastd_peer_t *dest) {
+ if (dest) {
+ conf.protocol->send(dest, buffer);
+ return;
+ }
+
if (send_data_tap_single(buffer, source))
return;