From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
To: Jonas Falkevik <jonas.falkevik@gmail.com>
Cc: Vlad Yasevich <vyasevich@gmail.com>,
Neil Horman <nhorman@tuxdriver.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
linux-sctp@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, Xin Long <lucien.xin@gmail.com>
Subject: Re: [PATCH] sctp: check assoc before SCTP_ADDR_{MADE_PRIM,ADDED} event
Date: Wed, 13 May 2020 13:01:16 -0300 [thread overview]
Message-ID: <20200513160116.GA2491@localhost.localdomain> (raw)
In-Reply-To: <CABUN9aCXZBTdYHSK5oSVX-HAA1wTWmyBW_ked_ydsCjsV-Ckaw@mail.gmail.com>
On Wed, May 13, 2020 at 04:52:16PM +0200, Jonas Falkevik wrote:
> Do not generate SCTP_ADDR_{MADE_PRIM,ADDED} events for SCTP_FUTURE_ASSOC assocs.
How did you get them?
I'm thinking you're fixing a side-effect of another issue here. For
example, in sctp_assoc_update(), it first calls sctp_assoc_add_peer()
to only then call sctp_assoc_set_id(), which would generate the event
you might have seen. In this case, it should be allocating IDR before,
so that the event can be sent with the right assoc_id already.
>
> These events are described in rfc6458#section-6.1
> SCTP_PEER_ADDR_CHANGE:
> This tag indicates that an address that is
> part of an existing association has experienced a change of
> state (e.g., a failure or return to service of the reachability
> of an endpoint via a specific transport address).
>
> Signed-off-by: Jonas Falkevik <jonas.falkevik@gmail.com>
> ---
> net/sctp/associola.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/net/sctp/associola.c b/net/sctp/associola.c
> index 437079a4883d..0c5dd295f9b8 100644
> --- a/net/sctp/associola.c
> +++ b/net/sctp/associola.c
> @@ -432,8 +432,10 @@ void sctp_assoc_set_primary(struct sctp_association *asoc,
> changeover = 1 ;
>
> asoc->peer.primary_path = transport;
> - sctp_ulpevent_nofity_peer_addr_change(transport,
> - SCTP_ADDR_MADE_PRIM, 0);
> + if (sctp_assoc2id(asoc) != SCTP_FUTURE_ASSOC)
> + sctp_ulpevent_nofity_peer_addr_change(transport,
> + SCTP_ADDR_MADE_PRIM,
> + 0);
>
> /* Set a default msg_name for events. */
> memcpy(&asoc->peer.primary_addr, &transport->ipaddr,
> @@ -714,7 +716,10 @@ struct sctp_transport *sctp_assoc_add_peer(struct
> sctp_association *asoc,
> list_add_tail_rcu(&peer->transports, &asoc->peer.transport_addr_list);
> asoc->peer.transport_count++;
>
> - sctp_ulpevent_nofity_peer_addr_change(peer, SCTP_ADDR_ADDED, 0);
> + if (sctp_assoc2id(asoc) != SCTP_FUTURE_ASSOC)
> + sctp_ulpevent_nofity_peer_addr_change(peer,
> + SCTP_ADDR_ADDED,
> + 0);
>
> /* If we do not yet have a primary path, set one. */
> if (!asoc->peer.primary_path) {
> --
> 2.25.3
next prev parent reply other threads:[~2020-05-13 16:01 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-13 14:52 [PATCH] sctp: check assoc before SCTP_ADDR_{MADE_PRIM,ADDED} event Jonas Falkevik
2020-05-13 16:01 ` Marcelo Ricardo Leitner [this message]
2020-05-13 20:11 ` Jonas Falkevik
2020-05-13 21:32 ` Marcelo Ricardo Leitner
2020-05-15 8:30 ` Jonas Falkevik
2020-05-19 20:42 ` Marcelo Ricardo Leitner
2020-05-23 12:04 ` Jonas Falkevik
2020-05-25 8:42 ` Xin Long
2020-05-25 13:10 ` Marcelo Ricardo Leitner
2020-05-25 16:17 ` Xin Long
2020-05-25 20:49 ` Jonas Falkevik
2020-05-25 20:52 ` Marcelo Ricardo Leitner
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=20200513160116.GA2491@localhost.localdomain \
--to=marcelo.leitner@gmail.com \
--cc=davem@davemloft.net \
--cc=jonas.falkevik@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sctp@vger.kernel.org \
--cc=lucien.xin@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=nhorman@tuxdriver.com \
--cc=vyasevich@gmail.com \
/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).