summaryrefslogtreecommitdiffstats
path: root/src/fastd.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/fastd.h')
-rw-r--r--src/fastd.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/fastd.h b/src/fastd.h
index 2536e71..66dd06f 100644
--- a/src/fastd.h
+++ b/src/fastd.h
@@ -81,7 +81,7 @@ struct fastd_protocol {
struct fastd_method {
bool (*provides)(const char *name);
- size_t (*max_packet_size)(fastd_context_t *ctx);
+ size_t max_overhead;
size_t min_encrypt_head_space;
size_t min_decrypt_head_space;
size_t min_encrypt_tail_space;
@@ -240,7 +240,7 @@ struct fastd_config {
const fastd_protocol_t *protocol;
fastd_string_stack_t *methods;
- size_t max_packet_size;
+ size_t max_overhead;
size_t min_encrypt_head_space;
size_t min_decrypt_head_space;
size_t min_encrypt_tail_space;
@@ -468,7 +468,7 @@ static inline void fastd_buffer_push_head(const fastd_context_t *ctx, fastd_buff
buffer->len -= len;
}
-static inline size_t fastd_max_packet_size(const fastd_context_t *ctx) {
+static inline size_t fastd_max_inner_packet(const fastd_context_t *ctx) {
switch (ctx->conf->mode) {
case MODE_TAP:
return ctx->conf->mtu+ETH_HLEN;
@@ -479,6 +479,10 @@ static inline size_t fastd_max_packet_size(const fastd_context_t *ctx) {
}
}
+static inline size_t fastd_max_outer_packet(const fastd_context_t *ctx) {
+ return PACKET_TYPE_LEN + fastd_max_inner_packet(ctx) + ctx->conf->max_overhead;
+}
+
static inline fastd_string_stack_t* fastd_string_stack_dup(const char *str) {
fastd_string_stack_t *ret = malloc(alignto(sizeof(fastd_string_stack_t) + strlen(str) + 1, 8));
ret->next = NULL;