diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2015-03-24 03:36:49 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2015-03-24 03:36:49 +0100 |
commit | 9ef4d441ad91ebcbc68bdae309122f128ed69f56 (patch) | |
tree | a3162fd43e77ce9c83eadf8ef4cfb92918df4615 /src/peer.h | |
parent | 14a991a1ced945db09e53a1e6dd0a7b2a052cfba (diff) | |
download | fastd-9ef4d441ad91ebcbc68bdae309122f128ed69f56.tar fastd-9ef4d441ad91ebcbc68bdae309122f128ed69f56.zip |
Add support for defining the MTU per peer
Diffstat (limited to 'src/peer.h')
-rw-r--r-- | src/peer.h | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -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); |