netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zhu Yanjun <zyjzyj2000@gmail.com>
To: netdev@vger.kernel.org, w@1wt.eu, zyjzyj2000@gmail.com,
	khandelwal.deepak.1987@gmail.com, vyasevich@gmail.com,
	tuexen@fh-muenster.de, dborkman@redhat.com
Cc: Zhu Yanjun <Yanjun.Zhu@windriver.com>,
	"David S. Miller" <davem@davemloft.net>
Subject: [PATCH 1/1] sctp: not send SCTP_PEER_ADDR_CHANGE notifications with failed probe
Date: Thu, 20 Nov 2014 14:04:40 +0800	[thread overview]
Message-ID: <1416463480-29036-1-git-send-email-Yanjun.Zhu@windriver.com> (raw)

2.6.x kernels require a similar logic change as commit 2c0d6ac894a
[sctp: not send SCTP_PEER_ADDR_CHANGE notifications with failed probe] 
introduces for newer kernels.

Since the transport has always been in state SCTP_UNCONFIRMED, it
therefore wasn't active before and hasn't been used before, and it
always has been, so it is unnecessary to bug the user with a
notification.

Reported-by: Deepak Khandelwal <khandelwal.deepak.1987@gmail.com>
Suggested-by: Vlad Yasevich <vyasevich@gmail.com>
Suggested-by: Michael Tuexen <tuexen@fh-muenster.de>
Suggested-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: Zhu Yanjun <Yanjun.Zhu@windriver.com>
Acked-by: Vlad Yasevich <vyasevich@gmail.com>
Acked-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

---
 net/sctp/associola.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/net/sctp/associola.c b/net/sctp/associola.c
index 7eed77a..0f63396 100644
--- a/net/sctp/associola.c
+++ b/net/sctp/associola.c
@@ -824,6 +824,7 @@ void sctp_assoc_control_transport(struct sctp_association *asoc,
 	struct sctp_ulpevent *event;
 	struct sockaddr_storage addr;
 	int spc_state = 0;
+	bool ulp_notify = true;
 
 	/* Record the transition on the transport.  */
 	switch (command) {
@@ -850,6 +851,7 @@ void sctp_assoc_control_transport(struct sctp_association *asoc,
 		else {
 			dst_release(transport->dst);
 			transport->dst = NULL;
+			ulp_notify = false;
 		}
 
 		spc_state = SCTP_ADDR_UNREACHABLE;
@@ -862,12 +864,14 @@ void sctp_assoc_control_transport(struct sctp_association *asoc,
 	/* Generate and send a SCTP_PEER_ADDR_CHANGE notification to the
 	 * user.
 	 */
-	memset(&addr, 0, sizeof(struct sockaddr_storage));
-	memcpy(&addr, &transport->ipaddr, transport->af_specific->sockaddr_len);
-	event = sctp_ulpevent_make_peer_addr_change(asoc, &addr,
+	if (ulp_notify) {
+		memset(&addr, 0, sizeof(struct sockaddr_storage));
+		memcpy(&addr, &transport->ipaddr, transport->af_specific->sockaddr_len);
+		event = sctp_ulpevent_make_peer_addr_change(asoc, &addr,
 				0, spc_state, error, GFP_ATOMIC);
-	if (event)
-		sctp_ulpq_tail_event(&asoc->ulpq, event);
+		if (event)
+			sctp_ulpq_tail_event(&asoc->ulpq, event);
+	}
 
 	/* Select new active and retran paths. */
 
-- 
1.9.1

             reply	other threads:[~2014-11-20  6:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-20  6:04 Zhu Yanjun [this message]
2014-11-20  6:14 ` [PATCH 1/1] sctp: not send SCTP_PEER_ADDR_CHANGE notifications with failed probe Willy Tarreau
  -- strict thread matches above, loose matches on Subject: below --
2014-08-20  9:31 [PATCH V2] " Zhu Yanjun
2014-08-20  9:31 ` [PATCH 1/1] " Zhu Yanjun
2014-08-21  2:06   ` Vlad Yasevich
2014-08-21  8:47   ` Daniel Borkmann
2014-08-22  4:35   ` David Miller
2014-08-15  9:26 Zhu Yanjun
2014-08-15  9:27 ` [PATCH 1/1] " Zhu Yanjun
2014-08-18 15:01   ` Daniel Borkmann

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=1416463480-29036-1-git-send-email-Yanjun.Zhu@windriver.com \
    --to=zyjzyj2000@gmail.com \
    --cc=Yanjun.Zhu@windriver.com \
    --cc=davem@davemloft.net \
    --cc=dborkman@redhat.com \
    --cc=khandelwal.deepak.1987@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=tuexen@fh-muenster.de \
    --cc=vyasevich@gmail.com \
    --cc=w@1wt.eu \
    /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).