From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84C37C43381 for ; Mon, 18 Mar 2019 12:06:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5303E20857 for ; Mon, 18 Mar 2019 12:06:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="rpMY0DBp" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727357AbfCRMG3 (ORCPT ); Mon, 18 Mar 2019 08:06:29 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:43880 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726504AbfCRMG3 (ORCPT ); Mon, 18 Mar 2019 08:06:29 -0400 Received: by mail-pg1-f193.google.com with SMTP id l11so11213173pgq.10; Mon, 18 Mar 2019 05:06:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=QQrOKhaYPnYbxOaGRzAFa/l0XZczKAR2cIzsEvxvaaA=; b=rpMY0DBpMrqXbp6FXkE9/wr2mXkqM+8ra50qJypj3xqCwEd9KDzcCfJHHTpqYkeaMr 2nGsuGFRBP6dY5tUUYIi0hIIvxnLVDrM+CkxYro761uh9La6dPr46RCu6OA0rUwb8Lcg 8D4M+liCvL/lfTH29d0nQ8XByUG7OnlOQR8zbHVzUJ/+XHZII1RRExEYtK8B4d66NzWr nkR9R8v221xcg4tjaXoeEz3CtfMSgUGGPgB5vQ/obRuvO/o3o5W3wPhKk4Hbdo43uVUE kZBAy253aGcr+PMoU8OE2FC56W/evQ2EUd+drDiNcOPaQnlC1a5143XB1UOSZFxsUVcT QK4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=QQrOKhaYPnYbxOaGRzAFa/l0XZczKAR2cIzsEvxvaaA=; b=Ii+aX9agHh9kXGd5GtvFqZn/M9GAKx61Yer939TR7gcFWXAsPRLx7tAxd7WWdf+ScT cdvAAZib1CPGYMQRgHXtQJnro5uvQpPVnpHEbhz8sT2mlf/4HBv5yQFaAg3PfFHc2h1h R3tDrJ99bmyrRcDoVWk317OuJMgd8+XhZ4VGFV4iRrLV0JgC5+DkgLVAGNASiXHSedOy Q+5C7Qvs4Mnou70W30KWWj1q7wL9QQ6AO3Hdqpipths7r5+iPBs+vUWcWKpLpNzHolLk hR9w4fBURO+n/HQfIxlzFO4638oEKEo0gWc3kOkoUufXInhJUTQm7sswahQ1maRSnEbs pv7Q== X-Gm-Message-State: APjAAAVr05O31wpYW8dLFr3cMS5y6AQ3aGJCcYO9W41JxuGd0thJzrq/ EQFo3xa3r0ZVYJ/F7pliK4lntBS/RpU= X-Google-Smtp-Source: APXvYqzy3BtVAgdFHB14ZvokvqBWDpypEikNx9LndhIJ72r1cl4taKfEbXWmw6lrT6HFvindRJC/9Q== X-Received: by 2002:a63:214d:: with SMTP id s13mr901802pgm.349.1552910788114; Mon, 18 Mar 2019 05:06:28 -0700 (PDT) Received: from localhost ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id a66sm21314899pfj.153.2019.03.18.05.06.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Mar 2019 05:06:27 -0700 (PDT) From: Xin Long To: network dev , linux-sctp@vger.kernel.org Cc: davem@davemloft.net, Marcelo Ricardo Leitner , Neil Horman Subject: [PATCH net 01/13] sctp: fix ignoring asoc_id for tcp-style sockets on SCTP_DEFAULT_SEND_PARAM sockopt Date: Mon, 18 Mar 2019 20:05:59 +0800 Message-Id: X-Mailer: git-send-email 2.1.0 In-Reply-To: References: In-Reply-To: References: Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Marcelo Ricardo Leitner Currently if the user pass an invalid asoc_id to SCTP_DEFAULT_SEND_PARAM on a TCP-style socket, it will silently ignore the new parameters. That's because after not finding an asoc, it is checking asoc_id against the known values of CURRENT/FUTURE/ALL values and that fails to match. IOW, if the user supplies an invalid asoc id or not, it should either match the current asoc or the socket itself so that it will inherit these later. Fixes it by forcing asoc_id to SCTP_FUTURE_ASSOC in case it is a TCP-style socket without an asoc, so that the values get set on the socket. Fixes: 707e45b3dc5a ("sctp: use SCTP_FUTURE_ASSOC and add SCTP_CURRENT_ASSOC for SCTP_DEFAULT_SEND_PARAM sockopt") Signed-off-by: Marcelo Ricardo Leitner --- net/sctp/socket.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 65b5386..d0e5c62 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c @@ -3024,6 +3024,9 @@ static int sctp_setsockopt_default_send_param(struct sock *sk, return 0; } + if (sctp_style(sk, TCP)) + info.sinfo_assoc_id = SCTP_FUTURE_ASSOC; + if (info.sinfo_assoc_id == SCTP_FUTURE_ASSOC || info.sinfo_assoc_id == SCTP_ALL_ASSOC) { sp->default_stream = info.sinfo_stream; -- 2.1.0 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Xin Long Date: Mon, 18 Mar 2019 12:05:59 +0000 Subject: [PATCH net 01/13] sctp: fix ignoring asoc_id for tcp-style sockets on SCTP_DEFAULT_SEND_PARAM sockop Message-Id: List-Id: References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: network dev , linux-sctp@vger.kernel.org Cc: davem@davemloft.net, Marcelo Ricardo Leitner , Neil Horman From: Marcelo Ricardo Leitner Currently if the user pass an invalid asoc_id to SCTP_DEFAULT_SEND_PARAM on a TCP-style socket, it will silently ignore the new parameters. That's because after not finding an asoc, it is checking asoc_id against the known values of CURRENT/FUTURE/ALL values and that fails to match. IOW, if the user supplies an invalid asoc id or not, it should either match the current asoc or the socket itself so that it will inherit these later. Fixes it by forcing asoc_id to SCTP_FUTURE_ASSOC in case it is a TCP-style socket without an asoc, so that the values get set on the socket. Fixes: 707e45b3dc5a ("sctp: use SCTP_FUTURE_ASSOC and add SCTP_CURRENT_ASSOC for SCTP_DEFAULT_SEND_PARAM sockopt") Signed-off-by: Marcelo Ricardo Leitner --- net/sctp/socket.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 65b5386..d0e5c62 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c @@ -3024,6 +3024,9 @@ static int sctp_setsockopt_default_send_param(struct sock *sk, return 0; } + if (sctp_style(sk, TCP)) + info.sinfo_assoc_id = SCTP_FUTURE_ASSOC; + if (info.sinfo_assoc_id = SCTP_FUTURE_ASSOC || info.sinfo_assoc_id = SCTP_ALL_ASSOC) { sp->default_stream = info.sinfo_stream; -- 2.1.0