aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/sctp/endpointola.c10
-rw-r--r--net/sctp/socket.c8
2 files changed, 8 insertions, 10 deletions
diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c
index c543f3250645..5ffb1af336c0 100644
--- a/net/sctp/endpointola.c
+++ b/net/sctp/endpointola.c
@@ -257,16 +257,14 @@ static struct sctp_association *__sctp_endpoint_lookup_assoc(
257 int rport; 257 int rport;
258 struct sctp_association *asoc; 258 struct sctp_association *asoc;
259 struct list_head *pos; 259 struct list_head *pos;
260 union sctp_addr tmp;
261 flip_to_n(&tmp, paddr);
262 260
263 rport = paddr->v4.sin_port; 261 rport = ntohs(paddr->v4.sin_port);
264 262
265 list_for_each(pos, &ep->asocs) { 263 list_for_each(pos, &ep->asocs) {
266 asoc = list_entry(pos, struct sctp_association, asocs); 264 asoc = list_entry(pos, struct sctp_association, asocs);
267 if (rport == asoc->peer.port) { 265 if (rport == asoc->peer.port) {
268 sctp_read_lock(&asoc->base.addr_lock); 266 sctp_read_lock(&asoc->base.addr_lock);
269 *transport = sctp_assoc_lookup_paddr(asoc, &tmp); 267 *transport = sctp_assoc_lookup_paddr(asoc, paddr);
270 sctp_read_unlock(&asoc->base.addr_lock); 268 sctp_read_unlock(&asoc->base.addr_lock);
271 269
272 if (*transport) 270 if (*transport)
@@ -348,8 +346,10 @@ static void sctp_endpoint_bh_rcv(struct sctp_endpoint *ep)
348 * COOKIE-ECHO chunk. 346 * COOKIE-ECHO chunk.
349 */ 347 */
350 if (NULL == chunk->asoc) { 348 if (NULL == chunk->asoc) {
349 union sctp_addr tmp;
350 flip_to_n(&tmp, sctp_source(chunk));
351 asoc = sctp_endpoint_lookup_assoc(ep, 351 asoc = sctp_endpoint_lookup_assoc(ep,
352 sctp_source(chunk), 352 &tmp,
353 &transport); 353 &transport);
354 chunk->asoc = asoc; 354 chunk->asoc = asoc;
355 chunk->transport = transport; 355 chunk->transport = transport;
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index d09589a51c44..6beaa7821ca6 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -228,11 +228,9 @@ static struct sctp_transport *sctp_addr_id2transport(struct sock *sk,
228 struct sctp_association *addr_asoc = NULL, *id_asoc = NULL; 228 struct sctp_association *addr_asoc = NULL, *id_asoc = NULL;
229 struct sctp_transport *transport; 229 struct sctp_transport *transport;
230 union sctp_addr *laddr = (union sctp_addr *)addr; 230 union sctp_addr *laddr = (union sctp_addr *)addr;
231 union sctp_addr tmp;
232 231
233 flip_to_h(&tmp, laddr);
234 addr_asoc = sctp_endpoint_lookup_assoc(sctp_sk(sk)->ep, 232 addr_asoc = sctp_endpoint_lookup_assoc(sctp_sk(sk)->ep,
235 &tmp, 233 laddr,
236 &transport); 234 &transport);
237 235
238 if (!addr_asoc) 236 if (!addr_asoc)
@@ -1007,7 +1005,7 @@ static int __sctp_connect(struct sock* sk,
1007 /* Check if there already is a matching association on the 1005 /* Check if there already is a matching association on the
1008 * endpoint (other than the one created here). 1006 * endpoint (other than the one created here).
1009 */ 1007 */
1010 asoc2 = sctp_endpoint_lookup_assoc(ep, &to, &transport); 1008 asoc2 = sctp_endpoint_lookup_assoc(ep, sa_addr, &transport);
1011 if (asoc2 && asoc2 != asoc) { 1009 if (asoc2 && asoc2 != asoc) {
1012 if (asoc2->state >= SCTP_STATE_ESTABLISHED) 1010 if (asoc2->state >= SCTP_STATE_ESTABLISHED)
1013 err = -EISCONN; 1011 err = -EISCONN;
@@ -1468,7 +1466,7 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
1468 /* If a msg_name has been specified, assume this is to be used. */ 1466 /* If a msg_name has been specified, assume this is to be used. */
1469 if (msg_name) { 1467 if (msg_name) {
1470 /* Look for a matching association on the endpoint. */ 1468 /* Look for a matching association on the endpoint. */
1471 asoc = sctp_endpoint_lookup_assoc(ep, &to, &transport); 1469 asoc = sctp_endpoint_lookup_assoc(ep, &tmp, &transport);
1472 if (!asoc) { 1470 if (!asoc) {
1473 /* If we could not find a matching association on the 1471 /* If we could not find a matching association on the
1474 * endpoint, make sure that it is not a TCP-style 1472 * endpoint, make sure that it is not a TCP-style