aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp/associola.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sctp/associola.c')
-rw-r--r--net/sctp/associola.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/net/sctp/associola.c b/net/sctp/associola.c
index 7824aeaa3d60..5b8971be9775 100644
--- a/net/sctp/associola.c
+++ b/net/sctp/associola.c
@@ -533,19 +533,17 @@ struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc,
533 struct sctp_transport *peer; 533 struct sctp_transport *peer;
534 struct sctp_sock *sp; 534 struct sctp_sock *sp;
535 unsigned short port; 535 unsigned short port;
536 union sctp_addr tmp;
537 flip_to_n(&tmp, addr);
538 536
539 sp = sctp_sk(asoc->base.sk); 537 sp = sctp_sk(asoc->base.sk);
540 538
541 /* AF_INET and AF_INET6 share common port field. */ 539 /* AF_INET and AF_INET6 share common port field. */
542 port = addr->v4.sin_port; 540 port = ntohs(addr->v4.sin_port);
543 541
544 SCTP_DEBUG_PRINTK_IPADDR("sctp_assoc_add_peer:association %p addr: ", 542 SCTP_DEBUG_PRINTK_IPADDR("sctp_assoc_add_peer:association %p addr: ",
545 " port: %d state:%d\n", 543 " port: %d state:%d\n",
546 asoc, 544 asoc,
547 addr, 545 addr,
548 addr->v4.sin_port, 546 port,
549 peer_state); 547 peer_state);
550 548
551 /* Set the port if it has not been set yet. */ 549 /* Set the port if it has not been set yet. */
@@ -553,7 +551,7 @@ struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc,
553 asoc->peer.port = port; 551 asoc->peer.port = port;
554 552
555 /* Check to see if this is a duplicate. */ 553 /* Check to see if this is a duplicate. */
556 peer = sctp_assoc_lookup_paddr(asoc, &tmp); 554 peer = sctp_assoc_lookup_paddr(asoc, addr);
557 if (peer) { 555 if (peer) {
558 if (peer->state == SCTP_UNKNOWN) { 556 if (peer->state == SCTP_UNKNOWN) {
559 if (peer_state == SCTP_ACTIVE) 557 if (peer_state == SCTP_ACTIVE)
@@ -564,7 +562,7 @@ struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc,
564 return peer; 562 return peer;
565 } 563 }
566 564
567 peer = sctp_transport_new(&tmp, gfp); 565 peer = sctp_transport_new(addr, gfp);
568 if (!peer) 566 if (!peer)
569 return NULL; 567 return NULL;
570 568
@@ -1070,7 +1068,7 @@ void sctp_assoc_update(struct sctp_association *asoc,
1070 trans = list_entry(pos, struct sctp_transport, 1068 trans = list_entry(pos, struct sctp_transport,
1071 transports); 1069 transports);
1072 if (!sctp_assoc_lookup_paddr(asoc, &trans->ipaddr)) 1070 if (!sctp_assoc_lookup_paddr(asoc, &trans->ipaddr))
1073 sctp_assoc_add_peer(asoc, &trans->ipaddr_h, 1071 sctp_assoc_add_peer(asoc, &trans->ipaddr,
1074 GFP_ATOMIC, trans->state); 1072 GFP_ATOMIC, trans->state);
1075 } 1073 }
1076 1074