浏览代码

[SCTP] Allow SCTP_MAXSEG to revert to default frag point with a '0' value.

Signed-off-by: Ivan Skytte Jorgensen <isj-sctp@i1.dk>
Signed-off-by: Sridhar Samudrala <sri@us.ibm.com>
Ivan Skytte Jorgensen 19 年之前
父节点
当前提交
96a339985d
共有 1 个文件被更改,包括 5 次插入7 次删除
  1. 5 7
      net/sctp/socket.c

+ 5 - 7
net/sctp/socket.c

@@ -2306,16 +2306,14 @@ static int sctp_setsockopt_maxseg(struct sock *sk, char __user *optval, int optl
 		return -EINVAL;
 		return -EINVAL;
 	if (get_user(val, (int __user *)optval))
 	if (get_user(val, (int __user *)optval))
 		return -EFAULT;
 		return -EFAULT;
-	if ((val < 8) || (val > SCTP_MAX_CHUNK_LEN))
+	if ((val != 0) && ((val < 8) || (val > SCTP_MAX_CHUNK_LEN)))
 		return -EINVAL;
 		return -EINVAL;
 	sp->user_frag = val;
 	sp->user_frag = val;
 
 
-	if (val) {
-		/* Update the frag_point of the existing associations. */
-		list_for_each(pos, &(sp->ep->asocs)) {
-			asoc = list_entry(pos, struct sctp_association, asocs);
-			asoc->frag_point = sctp_frag_point(sp, asoc->pmtu); 
-		}
+	/* Update the frag_point of the existing associations. */
+	list_for_each(pos, &(sp->ep->asocs)) {
+		asoc = list_entry(pos, struct sctp_association, asocs);
+		asoc->frag_point = sctp_frag_point(sp, asoc->pmtu); 
 	}
 	}
 
 
 	return 0;
 	return 0;