summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-05-27 22:44:56 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-05-27 22:44:56 +0200
commit64c79271c75987d94975cc3855617898b332b5a0 (patch)
treeccb23470412c87e6995145d5d71d54ecbd0b871d /src
parentadb7453fae67c777974e1d4c1a5f80f2378c61c3 (diff)
downloadfastd-64c79271c75987d94975cc3855617898b332b5a0.tar
fastd-64c79271c75987d94975cc3855617898b332b5a0.zip
A bit more fastd.h cleanup
Diffstat (limited to 'src')
-rw-r--r--src/fastd.h10
-rw-r--r--src/receive.c2
-rw-r--r--src/tuntap.c2
3 files changed, 3 insertions, 11 deletions
diff --git a/src/fastd.h b/src/fastd.h
index 8e57338..68a9f5b 100644
--- a/src/fastd.h
+++ b/src/fastd.h
@@ -43,14 +43,11 @@
#include <fcntl.h>
#include <poll.h>
#include <stdarg.h>
-#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
-#include <sys/uio.h>
-
/** An ethernet address */
struct __attribute__((__packed__)) fastd_eth_addr {
@@ -378,7 +375,7 @@ static inline size_t alignto(size_t l, size_t a) {
}
/** Returns the maximum payload size \em fastd is configured to transport */
-static inline size_t fastd_max_inner_packet(void) {
+static inline size_t fastd_max_payload(void) {
switch (conf.mode) {
case MODE_TAP:
return conf.mtu+ETH_HLEN;
@@ -389,11 +386,6 @@ static inline size_t fastd_max_inner_packet(void) {
}
}
-/** Returns the packet size (payload + overhead) \em fastd is configured to transport */
-static inline size_t fastd_max_outer_packet(void) {
- return 1 + fastd_max_inner_packet() + conf.max_overhead;
-}
-
/** Checks if a fastd_peer_address_t is an IPv6 link-local address */
static inline bool fastd_peer_address_is_v6_ll(const fastd_peer_address_t *addr) {
return (addr->sa.sa_family == AF_INET6 && IN6_IS_ADDR_LINKLOCAL(&addr->in6.sin6_addr));
diff --git a/src/receive.c b/src/receive.c
index 6009030..3813d7f 100644
--- a/src/receive.c
+++ b/src/receive.c
@@ -181,7 +181,7 @@ static inline void handle_socket_receive(fastd_socket_t *sock, const fastd_peer_
/** Reads a packet from a socket */
void fastd_receive(fastd_socket_t *sock) {
- size_t max_len = fastd_max_outer_packet();
+ size_t max_len = 1 + fastd_max_payload() + conf.max_overhead;
fastd_buffer_t buffer = fastd_buffer_alloc(max_len, conf.min_decrypt_head_space, conf.min_decrypt_tail_space);
fastd_peer_address_t local_addr;
fastd_peer_address_t recvaddr;
diff --git a/src/tuntap.c b/src/tuntap.c
index 9cf5f15..7bd5f82 100644
--- a/src/tuntap.c
+++ b/src/tuntap.c
@@ -297,7 +297,7 @@ void fastd_tuntap_open(void) {
/** Reads a packet from the TUN/TAP device */
void fastd_tuntap_handle(void) {
- size_t max_len = fastd_max_inner_packet();
+ size_t max_len = fastd_max_payload();
fastd_buffer_t buffer;
if (multiaf_tun && conf.mode == MODE_TUN)