summaryrefslogtreecommitdiffstats
path: root/src/fastd.h
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2015-03-24 03:36:49 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2015-03-24 03:36:49 +0100
commit9ef4d441ad91ebcbc68bdae309122f128ed69f56 (patch)
treea3162fd43e77ce9c83eadf8ef4cfb92918df4615 /src/fastd.h
parent14a991a1ced945db09e53a1e6dd0a7b2a052cfba (diff)
downloadfastd-9ef4d441ad91ebcbc68bdae309122f128ed69f56.tar
fastd-9ef4d441ad91ebcbc68bdae309122f128ed69f56.zip
Add support for defining the MTU per peer
Diffstat (limited to 'src/fastd.h')
-rw-r--r--src/fastd.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/fastd.h b/src/fastd.h
index fa29bf0..ee48a65 100644
--- a/src/fastd.h
+++ b/src/fastd.h
@@ -159,6 +159,7 @@ struct fastd_iface {
fastd_poll_fd_t fd; /**< The file descriptor of the tunnel interface */
char *name; /**< The interface name */
fastd_peer_t *peer; /**< The peer associated with the interface (if any) */
+ uint16_t mtu;
};
@@ -301,6 +302,7 @@ struct fastd_context {
#endif
bool has_floating; /**< Specifies if any of the configured peers have floating remotes */
+ uint16_t max_mtu; /**< The maximum MTU of all peer-specific interfaces */
uint32_t peer_addr_ht_seed; /**< The hash seed used for peer_addr_ht */
size_t peer_addr_ht_size; /**< The number of hash buckets in the peer address hashtable */
@@ -416,13 +418,13 @@ static inline void fastd_setnonblock(int fd) {
/** Returns the maximum payload size \em fastd is configured to transport */
-static inline size_t fastd_max_payload(void) {
+static inline size_t fastd_max_payload(uint16_t mtu) {
switch (conf.mode) {
case MODE_TAP:
case MODE_MULTITAP:
- return conf.mtu+ETH_HLEN;
+ return mtu+ETH_HLEN;
case MODE_TUN:
- return conf.mtu;
+ return mtu;
default:
exit_bug("invalid mode");
}