aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/sctp/ipv6.c4
-rw-r--r--net/sctp/protocol.c2
-rw-r--r--net/sctp/transport.c10
3 files changed, 9 insertions, 7 deletions
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index 566cdc9977c4..7f4c5bafea14 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -292,9 +292,9 @@ static void sctp_v6_get_saddr(struct sctp_association *asoc,
292 if ((laddr->use_as_src) && 292 if ((laddr->use_as_src) &&
293 (laddr->a_h.sa.sa_family == AF_INET6) && 293 (laddr->a_h.sa.sa_family == AF_INET6) &&
294 (scope <= sctp_scope(&laddr->a_h))) { 294 (scope <= sctp_scope(&laddr->a_h))) {
295 bmatchlen = sctp_v6_addr_match_len(daddr, &laddr->a_h); 295 bmatchlen = sctp_v6_addr_match_len(daddr, &laddr->a);
296 if (!baddr || (matchlen < bmatchlen)) { 296 if (!baddr || (matchlen < bmatchlen)) {
297 baddr = &laddr->a_h; 297 baddr = &laddr->a;
298 matchlen = bmatchlen; 298 matchlen = bmatchlen;
299 } 299 }
300 } 300 }
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index 87d36f440d1d..5b8b7f3598e0 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -539,7 +539,7 @@ static void sctp_v4_get_saddr(struct sctp_association *asoc,
539 539
540 if (rt) { 540 if (rt) {
541 saddr->v4.sin_family = AF_INET; 541 saddr->v4.sin_family = AF_INET;
542 saddr->v4.sin_port = asoc->base.bind_addr.port; 542 saddr->v4.sin_port = htons(asoc->base.bind_addr.port);
543 saddr->v4.sin_addr.s_addr = rt->rt_src; 543 saddr->v4.sin_addr.s_addr = rt->rt_src;
544 } 544 }
545} 545}
diff --git a/net/sctp/transport.c b/net/sctp/transport.c
index e1448addcd93..74faa1b6dbfe 100644
--- a/net/sctp/transport.c
+++ b/net/sctp/transport.c
@@ -256,11 +256,13 @@ void sctp_transport_route(struct sctp_transport *transport,
256 256
257 dst = af->get_dst(asoc, daddr, saddr); 257 dst = af->get_dst(asoc, daddr, saddr);
258 258
259 if (saddr) 259 if (saddr) {
260 memcpy(&transport->saddr_h, saddr, sizeof(union sctp_addr)); 260 memcpy(&transport->saddr_h, saddr, sizeof(union sctp_addr));
261 else 261 flip_to_n(&transport->saddr, &transport->saddr_h);
262 af->get_saddr(asoc, dst, daddr, &transport->saddr_h); 262 } else {
263 flip_to_n(&transport->saddr, &transport->saddr_h); 263 af->get_saddr(asoc, dst, &transport->ipaddr, &transport->saddr);
264 flip_to_h(&transport->saddr_h, &transport->saddr);
265 }
264 266
265 transport->dst = dst; 267 transport->dst = dst;
266 if ((transport->param_flags & SPP_PMTUD_DISABLE) && transport->pathmtu) { 268 if ((transport->param_flags & SPP_PMTUD_DISABLE) && transport->pathmtu) {