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.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,USER_AGENT_MUTT 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 C47BEC169C4 for ; Tue, 29 Jan 2019 21:17:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 875AA20881 for ; Tue, 29 Jan 2019 21:17:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729513AbfA2VRo (ORCPT ); Tue, 29 Jan 2019 16:17:44 -0500 Received: from charlotte.tuxdriver.com ([70.61.120.58]:56013 "EHLO smtp.tuxdriver.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727488AbfA2VRo (ORCPT ); Tue, 29 Jan 2019 16:17:44 -0500 Received: from [62.209.224.147] (helo=localhost) by smtp.tuxdriver.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1goal5-0000DU-R9; Tue, 29 Jan 2019 16:17:30 -0500 Date: Tue, 29 Jan 2019 16:17:23 -0500 From: Neil Horman To: Xin Long Cc: network dev , linux-sctp@vger.kernel.org, Marcelo Ricardo Leitner , davem@davemloft.net Subject: Re: [PATCH net-next 02/24] sctp: use SCTP_FUTURE_ASSOC for SCTP_PEER_ADDR_PARAMS sockopt Message-ID: <20190129211723.GA2592@neilslaptop.think-freely.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Mon, Jan 28, 2019 at 03:08:24PM +0800, Xin Long wrote: > Check with SCTP_FUTURE_ASSOC instead in > sctp_/setgetsockopt_peer_addr_params, it's compatible with 0. > > Signed-off-by: Xin Long > --- > net/sctp/socket.c | 18 ++++++++++-------- > 1 file changed, 10 insertions(+), 8 deletions(-) > > diff --git a/net/sctp/socket.c b/net/sctp/socket.c > index a52d132..4c43b95 100644 > --- a/net/sctp/socket.c > +++ b/net/sctp/socket.c > @@ -2750,12 +2750,13 @@ static int sctp_setsockopt_peer_addr_params(struct sock *sk, > return -EINVAL; > } > > - /* Get association, if assoc_id != 0 and the socket is a one > - * to many style socket, and an association was not found, then > - * the id was invalid. > + /* Get association, if assoc_id != SCTP_FUTURE_ASSOC and the > + * socket is a one to many style socket, and an association > + * was not found, then the id was invalid. > */ > asoc = sctp_id2assoc(sk, params.spp_assoc_id); > - if (!asoc && params.spp_assoc_id && sctp_style(sk, UDP)) > + if (!asoc && params.spp_assoc_id != SCTP_FUTURE_ASSOC && If we are disallowing SCTP_FUTURE_ASSOC here, why would we allow SCTP_ALL_ASSOC (which, as noted by patch 0, includes future associations)? > + sctp_style(sk, UDP)) > return -EINVAL; > > /* Heartbeat demand can only be sent on a transport or > @@ -5676,12 +5677,13 @@ static int sctp_getsockopt_peer_addr_params(struct sock *sk, int len, > } > } > > - /* Get association, if assoc_id != 0 and the socket is a one > - * to many style socket, and an association was not found, then > - * the id was invalid. > + /* Get association, if assoc_id != SCTP_FUTURE_ASSOC and the > + * socket is a one to many style socket, and an association > + * was not found, then the id was invalid. > */ > asoc = sctp_id2assoc(sk, params.spp_assoc_id); > - if (!asoc && params.spp_assoc_id && sctp_style(sk, UDP)) { > + if (!asoc && params.spp_assoc_id != SCTP_FUTURE_ASSOC && Same question as above, shouldn't both of these be restricted to specific associations or to CURRENT associations? > + sctp_style(sk, UDP)) { > pr_debug("%s: failed no association\n", __func__); > return -EINVAL; > } > -- > 2.1.0 > >