diff options
author | Guillaume Nault <g.nault@alphalink.fr> | 2018-08-03 13:38:34 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-08-03 20:03:57 +0300 |
commit | 1f5cd2a0107d4ed95cbd9118e6a5f7ccd3d4d12a (patch) | |
tree | 1ee06be60cafbb3e7c7df779677842c976d5716d /net/l2tp/l2tp_core.h | |
parent | f3184645cb0409d4ab0e63d65a0adcb565f55df4 (diff) | |
download | linux-1f5cd2a0107d4ed95cbd9118e6a5f7ccd3d4d12a.tar.xz |
l2tp: define l2tp_tunnel_dst_mtu()
Consolidate retrieval of tunnel's socket mtu in order to simplify
l2tp_eth and l2tp_ppp a bit.
Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/l2tp/l2tp_core.h')
-rw-r--r-- | net/l2tp/l2tp_core.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/net/l2tp/l2tp_core.h b/net/l2tp/l2tp_core.h index fa5ae9432d38..1ca39629031b 100644 --- a/net/l2tp/l2tp_core.h +++ b/net/l2tp/l2tp_core.h @@ -12,6 +12,9 @@ #ifndef _L2TP_CORE_H_ #define _L2TP_CORE_H_ +#include <net/dst.h> +#include <net/sock.h> + /* Just some random numbers */ #define L2TP_TUNNEL_MAGIC 0x42114DDA #define L2TP_SESSION_MAGIC 0x0C04EB7D @@ -268,6 +271,21 @@ static inline int l2tp_get_l2specific_len(struct l2tp_session *session) } } +static inline u32 l2tp_tunnel_dst_mtu(const struct l2tp_tunnel *tunnel) +{ + struct dst_entry *dst; + u32 mtu; + + dst = sk_dst_get(tunnel->sock); + if (!dst) + return 0; + + mtu = dst_mtu(dst); + dst_release(dst); + + return mtu; +} + #define l2tp_printk(ptr, type, func, fmt, ...) \ do { \ if (((ptr)->debug) & (type)) \ |