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>
This commit is contained in:

committed by
David S. Miller

parent
c4b2893dae
commit
feddd6c1af
@@ -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)
|
||||
|
Reference in New Issue
Block a user