summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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;