Skip to content

Commit

Permalink
sctp: allow unsetting sockopt MAXSEG
Browse files Browse the repository at this point in the history
RFC 6458 Section 8.1.16 says that setting MAXSEG as 0 means that the user
is not limiting it, and not that it should set to the *current* maximum,
as we are doing.

This patch thus allow setting it as 0, effectively removing the user
limit.

Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Marcelo Ricardo Leitner authored and David S. Miller committed Apr 27, 2018
1 parent 439ef03 commit 38687b5
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions net/sctp/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -3211,7 +3211,6 @@ static int sctp_setsockopt_mappedv4(struct sock *sk, char __user *optval, unsign
static int sctp_setsockopt_maxseg(struct sock *sk, char __user *optval, unsigned int optlen)
{
struct sctp_sock *sp = sctp_sk(sk);
struct sctp_af *af = sp->pf->af;
struct sctp_assoc_value params;
struct sctp_association *asoc;
int val;
Expand Down Expand Up @@ -3249,12 +3248,6 @@ static int sctp_setsockopt_maxseg(struct sock *sk, char __user *optval, unsigned
}

if (asoc) {
if (val == 0) {
val = asoc->pathmtu - af->net_header_len;
val -= af->ip_options_len(sk);
val -= sizeof(struct sctphdr) +
sctp_datachk_len(&asoc->stream);
}
asoc->user_frag = val;
sctp_assoc_update_frag_point(asoc);
} else {
Expand Down

0 comments on commit 38687b5

Please sign in to comment.