summaryrefslogtreecommitdiffstats
path: root/net/sctp/socket.c
diff options
context:
space:
mode:
authorMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>2018-04-26 16:58:54 -0300
committerDavid S. Miller <davem@davemloft.net>2018-04-27 14:35:23 -0400
commitfeddd6c1af30ab11d73ce0e4e76b40dfc899dbda (patch)
tree5103795b3aed0972f3be763097c9b9c11efda77f /net/sctp/socket.c
parentc4b2893dae6427ce1e528033383c94cbf81e80d8 (diff)
downloadlinux-feddd6c1af30ab11d73ce0e4e76b40dfc899dbda.tar.bz2
sctp: introduce sctp_mtu_payload
When given a MTU, this function calculates how much payload we can carry on it. Without a MTU, it calculates the amount of header overhead we have. So that when we have extra overhead, like the one added for IP options on SELinux patches, it is easier to handle it. Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp/socket.c')
-rw-r--r--net/sctp/socket.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index eeec81d5c485..b9d14f57146b 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -3234,11 +3234,8 @@ static int sctp_setsockopt_maxseg(struct sock *sk, char __user *optval, unsigned
if (val) {
int min_len, max_len;
- min_len = SCTP_DEFAULT_MINSEGMENT - af->net_header_len;
- min_len -= af->ip_options_len(sk);
- min_len -= sizeof(struct sctphdr) +
- sizeof(struct sctp_data_chunk);
-
+ min_len = sctp_mtu_payload(sp, SCTP_DEFAULT_MINSEGMENT,
+ sizeof(struct sctp_data_chunk));
max_len = SCTP_MAX_CHUNK_LEN - sizeof(struct sctp_data_chunk);
if (val < min_len || val > max_len)