summaryrefslogtreecommitdiffstats
path: root/src/peer.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/peer.h
parent14a991a1ced945db09e53a1e6dd0a7b2a052cfba (diff)
downloadfastd-9ef4d441ad91ebcbc68bdae309122f128ed69f56.tar
fastd-9ef4d441ad91ebcbc68bdae309122f128ed69f56.zip
Add support for defining the MTU per peer
Diffstat (limited to 'src/peer.h')
-rw-r--r--src/peer.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/peer.h b/src/peer.h
index e77462c..948bbc6 100644
--- a/src/peer.h
+++ b/src/peer.h
@@ -73,6 +73,7 @@ struct fastd_peer {
fastd_protocol_peer_state_t *protocol_state; /**< Protocol-specific peer state */
char *ifname; /**< Peer-specific interface name */
+ uint16_t mtu; /**< Peer-specific interface MTU */
/* Starting here, more dynamic fields follow: */
@@ -283,6 +284,16 @@ static inline const fastd_string_stack_t * fastd_peer_get_methods(const fastd_pe
return NULL;
}
+static inline uint16_t fastd_peer_get_mtu(const fastd_peer_t *peer) {
+ if (conf.mode == MODE_TAP)
+ return conf.mtu;
+
+ if (peer && peer->mtu)
+ return peer->mtu;
+
+ return conf.mtu;
+}
+
/** Checks if a MAC address is a normal unicast address */
static inline bool fastd_eth_addr_is_unicast(fastd_eth_addr_t addr) {
return ((addr.data[0] & 1) == 0);