From: Neil Horman <nhorman@tuxdriver.com>
To: Xin Long <lucien.xin@gmail.com>
Cc: network dev <netdev@vger.kernel.org>,
linux-sctp@vger.kernel.org,
Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>,
davem@davemloft.net
Subject: Re: [PATCH net-next 02/24] sctp: use SCTP_FUTURE_ASSOC for SCTP_PEER_ADDR_PARAMS sockopt
Date: Tue, 29 Jan 2019 16:25:08 -0500 [thread overview]
Message-ID: <20190129212508.GB2592@neilslaptop.think-freely.org> (raw)
In-Reply-To: <bf66a45aa6763646c07e1b8be102466f07fc1648.1548659198.git.lucien.xin@gmail.com>
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 <lucien.xin@gmail.com>
> ---
> 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 &&
Sorry to follow up, but I misspoke in my previous email, I should have said, why
do we only allow future associations as the only special case association id
here? Since the function is meant to set a specific association id, it seems to
me that you would want to:
a) allow setting of a specific id
b) allow setting of all association ids on the socket
(SCTP_CURRENT_ASSOC)
c) allow recording of a set of params to apply to all current and future
associations (FUTURE/ALL).
(a) is already handled clearly, but (b) and (c) require more work on this
function than just checking association id on entry.
I think this comment may apply to all the socket option functions
> + 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 &&
> + sctp_style(sk, UDP)) {
> pr_debug("%s: failed no association\n", __func__);
> return -EINVAL;
> }
> --
> 2.1.0
>
>
next prev parent reply other threads:[~2019-01-29 21:25 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-28 7:08 [PATCH net-next 00/24] sctp: support SCTP_FUTURE/CURRENT/ALL_ASSOC Xin Long
2019-01-28 7:08 ` [PATCH net-next 01/24] sctp: introduce SCTP_FUTURE/CURRENT/ALL_ASSOC Xin Long
2019-01-28 7:08 ` [PATCH net-next 02/24] sctp: use SCTP_FUTURE_ASSOC for SCTP_PEER_ADDR_PARAMS sockopt Xin Long
2019-01-28 7:08 ` [PATCH net-next 03/24] sctp: use SCTP_FUTURE_ASSOC for SCTP_RTOINFO sockopt Xin Long
2019-01-28 7:08 ` [PATCH net-next 04/24] sctp: use SCTP_FUTURE_ASSOC for SCTP_ASSOCINFO sockopt Xin Long
2019-01-28 7:08 ` [PATCH net-next 05/24] sctp: use SCTP_FUTURE_ASSOC for SCTP_MAXSEG sockopt Xin Long
2019-01-28 7:08 ` [PATCH net-next 06/24] sctp: use SCTP_FUTURE_ASSOC for SCTP_LOCAL_AUTH_CHUNKS sockopt Xin Long
2019-01-28 7:08 ` [PATCH net-next 07/24] sctp: add SCTP_FUTURE_ASSOC for SCTP_PEER_ADDR_THLDS sockopt Xin Long
2019-01-28 7:08 ` [PATCH net-next 08/24] sctp: use SCTP_FUTURE_ASSOC for SCTP_PR_SUPPORTED sockopt Xin Long
2019-01-28 7:08 ` [PATCH net-next 09/24] sctp: use SCTP_FUTURE_ASSOC for SCTP_RECONFIG_SUPPORTED sockopt Xin Long
2019-01-28 7:08 ` [PATCH net-next 10/24] sctp: use SCTP_FUTURE_ASSOC for SCTP_INTERLEAVING_SUPPORTED sockopt Xin Long
2019-01-28 7:08 ` [PATCH net-next 11/24] sctp: add SCTP_CURRENT_ASSOC for SCTP_STREAM_SCHEDULER_VALUE sockopt Xin Long
2019-01-28 7:08 ` [PATCH net-next 12/24] sctp: use SCTP_FUTURE_ASSOC and add SCTP_CURRENT_ASSOC for SCTP_DELAYED_SACK sockopt Xin Long
2019-01-28 7:08 ` [PATCH net-next 13/24] sctp: use SCTP_FUTURE_ASSOC and add SCTP_CURRENT_ASSOC for SCTP_DEFAULT_SEND_PARAM sockopt Xin Long
2019-01-28 7:08 ` [PATCH net-next 14/24] sctp: use SCTP_FUTURE_ASSOC and add SCTP_CURRENT_ASSOC for SCTP_DEFAULT_SNDINFO sockopt Xin Long
2019-01-28 7:08 ` [PATCH net-next 15/24] sctp: use SCTP_FUTURE_ASSOC and add SCTP_CURRENT_ASSOC for SCTP_CONTEXT sockopt Xin Long
2019-01-28 7:08 ` [PATCH net-next 16/24] sctp: use SCTP_FUTURE_ASSOC and add SCTP_CURRENT_ASSOC for SCTP_MAX_BURST sockopt Xin Long
2019-01-28 7:08 ` [PATCH net-next 17/24] sctp: use SCTP_FUTURE_ASSOC and add SCTP_CURRENT_ASSOC for SCTP_AUTH_KEY sockopt Xin Long
2019-01-28 7:08 ` [PATCH net-next 18/24] sctp: use SCTP_FUTURE_ASSOC and add SCTP_CURRENT_ASSOC for SCTP_AUTH_ACTIVE_KEY sockopt Xin Long
2019-01-28 7:08 ` [PATCH net-next 19/24] sctp: use SCTP_FUTURE_ASSOC and add SCTP_CURRENT_ASSOC for SCTP_AUTH_DELETE_KEY sockopt Xin Long
2019-01-28 7:08 ` [PATCH net-next 20/24] sctp: use SCTP_FUTURE_ASSOC and add SCTP_CURRENT_ASSOC for SCTP_AUTH_DEACTIVATE_KEY sockopt Xin Long
2019-01-28 7:08 ` [PATCH net-next 21/24] sctp: use SCTP_FUTURE_ASSOC and add SCTP_CURRENT_ASSOC for SCTP_DEFAULT_PRINFO sockopt Xin Long
2019-01-28 7:08 ` [PATCH net-next 22/24] sctp: use SCTP_FUTURE_ASSOC and add SCTP_CURRENT_ASSOC for SCTP_ENABLE_STREAM_RESET sockopt Xin Long
2019-01-28 7:08 ` [PATCH net-next 23/24] sctp: use SCTP_FUTURE_ASSOC and add SCTP_CURRENT_ASSOC for SCTP_EVENT sockopt Xin Long
2019-01-28 7:08 ` [PATCH net-next 24/24] sctp: add SCTP_FUTURE_ASOC and SCTP_CURRENT_ASSOC for SCTP_STREAM_SCHEDULER sockopt Xin Long
2019-01-29 21:17 ` [PATCH net-next 02/24] sctp: use SCTP_FUTURE_ASSOC for SCTP_PEER_ADDR_PARAMS sockopt Neil Horman
2019-01-29 21:25 ` Neil Horman [this message]
2019-01-30 7:03 ` Xin Long
2019-01-30 7:37 ` Neil Horman
2019-01-28 9:44 ` [PATCH net-next 00/24] sctp: support SCTP_FUTURE/CURRENT/ALL_ASSOC Neil Horman
2019-01-28 18:41 ` David Miller
2019-01-29 8:03 ` Neil Horman
2019-01-30 7:46 ` Neil Horman
2019-01-30 8:44 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190129212508.GB2592@neilslaptop.think-freely.org \
--to=nhorman@tuxdriver.com \
--cc=davem@davemloft.net \
--cc=linux-sctp@vger.kernel.org \
--cc=lucien.xin@gmail.com \
--cc=marcelo.leitner@gmail.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).