netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Gortmaker <paul.gortmaker@windriver.com>
To: netdev@vger.kernel.org
Cc: vladislav.yasevich@hp.com
Subject: [PATCH] Fix SCTP failure with ipv6 source address routing
Date: Tue, 13 Apr 2010 18:37:36 -0400	[thread overview]
Message-ID: <1271198256-20477-1-git-send-email-paul.gortmaker@windriver.com> (raw)

From: Weixing Shi <Weixing.Shi@windriver.com>

Given the below test case, using source address routing, SCTP
does not work.

Node-A:
  1)ifconfig eth0 inet6 add 2001:1::1/64
  2)ip -6 rule add from 2001:1::1 table 100 pref 100
  3)ip -6 route add 2001:2::1 dev eth0 table 100
  4)sctp_darn -H 2001:1::1 -P 250 -l &

Node-B:
  1)ifconfig eth0 inet6 add 2001:2::1/64
  2)ip -6 rule add from 2001:2::1 table 100 pref 100
  3)ip -6 route add 2001:1::1 dev eth0 table 100
  4)sctp_darn -H 2001:2::1 -P 250 -h 2001:1::1 -p 250 -s

Root cause:
  Node-A and Node-B use source address routing, and in the
  begining, the source address will be NULL.  So SCTP will search
  the routing table by the destination address (because it is using
  the source address routing table), and hence the resulting dst_entry
  will be NULL.

Solution:
  After SCTP gets the correct source address, then we search for
  dst_entry again, and then we will get the correct value.

Signed-off-by: Weixing Shi <Weixing.Shi@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 net/sctp/transport.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/net/sctp/transport.c b/net/sctp/transport.c
index be4d63d..b5ae18c 100644
--- a/net/sctp/transport.c
+++ b/net/sctp/transport.c
@@ -295,9 +295,16 @@ void sctp_transport_route(struct sctp_transport *transport,
 
 	if (saddr)
 		memcpy(&transport->saddr, saddr, sizeof(union sctp_addr));
-	else
+	else {
 		af->get_saddr(opt, asoc, dst, daddr, &transport->saddr);
-
+		/* When using source address routing, since dst was
+		 * looked up prior to filling in the source address, dst
+		 * needs to be looked up again to get the correct dst
+		 */
+		if (dst)
+			dst_release(dst);
+		dst = af->get_dst(asoc, daddr, &transport->saddr);
+	}
 	transport->dst = dst;
 	if ((transport->param_flags & SPP_PMTUD_DISABLE) && transport->pathmtu) {
 		return;
-- 
1.6.5.2


             reply	other threads:[~2010-04-13 22:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-13 22:37 Paul Gortmaker [this message]
2010-04-14  0:47 ` [PATCH] Fix SCTP failure with ipv6 source address routing Vlad Yasevich
2010-04-18  0:17   ` Paul Gortmaker

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=1271198256-20477-1-git-send-email-paul.gortmaker@windriver.com \
    --to=paul.gortmaker@windriver.com \
    --cc=netdev@vger.kernel.org \
    --cc=vladislav.yasevich@hp.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).