summaryrefslogtreecommitdiff
path: root/include/net/sctp
diff options
context:
space:
mode:
authorMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>2018-04-26 22:58:57 +0300
committerDavid S. Miller <davem@davemloft.net>2018-04-27 21:35:23 +0300
commit6ff0f871c20ec1769a481edca86f23c76b2b06d3 (patch)
tree9fa281c225263df1e1b00e12adfeedfdb6e690f1 /include/net/sctp
parent2521680e1830c21033efe48322829044c6e6b32b (diff)
downloadlinux-6ff0f871c20ec1769a481edca86f23c76b2b06d3.tar.xz
sctp: introduce sctp_dst_mtu
Which makes sure that the MTU respects the minimum value of SCTP_DEFAULT_MINSEGMENT and that it is correctly aligned. Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/sctp')
-rw-r--r--include/net/sctp/sctp.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index e327acad8e7d..4965cbfa7d92 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -600,10 +600,15 @@ static inline __u32 sctp_mtu_payload(const struct sctp_sock *sp,
return mtu ? mtu - overhead : overhead;
}
+static inline __u32 sctp_dst_mtu(const struct dst_entry *dst)
+{
+ return SCTP_TRUNC4(max_t(__u32, dst_mtu(dst),
+ SCTP_DEFAULT_MINSEGMENT));
+}
+
static inline bool sctp_transport_pmtu_check(struct sctp_transport *t)
{
- __u32 pmtu = max_t(size_t, SCTP_TRUNC4(dst_mtu(t->dst)),
- SCTP_DEFAULT_MINSEGMENT);
+ __u32 pmtu = sctp_dst_mtu(t->dst);
if (t->pathmtu == pmtu)
return true;