diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-03-26 06:05:36 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-03-26 06:05:36 +0200 |
commit | e89cfb2f0b8159f602ecae6b53c0ee59b112601d (patch) | |
tree | 886aa6782bd795683c1ad214543e48b4af4a190b /src/fastd.c | |
parent | a02fb0711ba496877c111b118b78d404151a8b8d (diff) | |
download | fastd-e89cfb2f0b8159f602ecae6b53c0ee59b112601d.tar fastd-e89cfb2f0b8159f602ecae6b53c0ee59b112601d.zip |
Implement encrypted send/receive
Diffstat (limited to 'src/fastd.c')
-rw-r--r-- | src/fastd.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/fastd.c b/src/fastd.c index 40f0046..9194301 100644 --- a/src/fastd.c +++ b/src/fastd.c @@ -198,7 +198,7 @@ static void handle_tasks(fastd_context *ctx) { static void handle_tun(fastd_context *ctx) { size_t max_len = fastd_max_packet_size(ctx); - fastd_buffer buffer = fastd_buffer_alloc(max_len, 0, 0); + fastd_buffer buffer = fastd_buffer_alloc(max_len, ctx->conf->protocol->min_encrypt_head_space(ctx), 0); ssize_t len = read(ctx->tunfd, buffer.data, max_len); if (len < 0) @@ -229,7 +229,7 @@ static void handle_tun(fastd_context *ctx) { if (peer == NULL) { for (peer = ctx->peers; peer; peer = peer->next) { if (peer->state == STATE_ESTABLISHED) { - fastd_buffer send_buffer = fastd_buffer_alloc(len, 0, 0); + fastd_buffer send_buffer = fastd_buffer_alloc(len, ctx->conf->protocol->min_encrypt_head_space(ctx), 0); memcpy(send_buffer.data, buffer.data, len); ctx->conf->protocol->send(ctx, peer, send_buffer); } @@ -241,7 +241,7 @@ static void handle_tun(fastd_context *ctx) { static void handle_socket(fastd_context *ctx, int sockfd) { size_t max_len = ctx->conf->protocol->max_packet_size(ctx); - fastd_buffer buffer = fastd_buffer_alloc(max_len, 0, 0); + fastd_buffer buffer = fastd_buffer_alloc(max_len, ctx->conf->protocol->min_decrypt_head_space(ctx), 0); uint8_t packet_type; |