From 9ef4d441ad91ebcbc68bdae309122f128ed69f56 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 24 Mar 2015 03:36:49 +0100 Subject: Add support for defining the MTU per peer --- src/peer.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/peer.h') 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); -- cgit v1.2.3