Commit dce116ae86cb224a9dad787e91fb552dae67b2e8

Authored by Al Viro
Committed by David S. Miller
1 parent 6fbfa9f951

[SCTP]: Get rid of the last remnants of sin_port flipping.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 1 changed file with 6 additions and 13 deletions Side-by-side Diff

... ... @@ -1000,7 +1000,6 @@
1000 1000 goto out_free;
1001 1001  
1002 1002 memcpy(&to, sa_addr, af->sockaddr_len);
1003   - to.v4.sin_port = ntohs(to.v4.sin_port);
1004 1003  
1005 1004 /* Check if there already is a matching association on the
1006 1005 * endpoint (other than the one created here).
... ... @@ -1049,7 +1048,7 @@
1049 1048 }
1050 1049 }
1051 1050  
1052   - scope = sctp_scope(&to);
  1051 + scope = sctp_scope(sa_addr);
1053 1052 asoc = sctp_association_new(ep, sk, scope, GFP_KERNEL);
1054 1053 if (!asoc) {
1055 1054 err = -ENOMEM;
... ... @@ -1357,7 +1356,7 @@
1357 1356 struct sctp_association *new_asoc=NULL, *asoc=NULL;
1358 1357 struct sctp_transport *transport, *chunk_tp;
1359 1358 struct sctp_chunk *chunk;
1360   - union sctp_addr to, tmp;
  1359 + union sctp_addr to;
1361 1360 struct sockaddr *msg_name = NULL;
1362 1361 struct sctp_sndrcvinfo default_sinfo = { 0 };
1363 1362 struct sctp_sndrcvinfo *sinfo;
... ... @@ -1411,12 +1410,6 @@
1411 1410 if (msg_namelen > sizeof(to))
1412 1411 msg_namelen = sizeof(to);
1413 1412 memcpy(&to, msg->msg_name, msg_namelen);
1414   - memcpy(&tmp, msg->msg_name, msg_namelen);
1415   - SCTP_DEBUG_PRINTK("Just memcpy'd. msg_name is "
1416   - "0x%x:%u.\n",
1417   - to.v4.sin_addr.s_addr, to.v4.sin_port);
1418   -
1419   - to.v4.sin_port = ntohs(to.v4.sin_port);
1420 1413 msg_name = msg->msg_name;
1421 1414 }
1422 1415  
... ... @@ -1466,7 +1459,7 @@
1466 1459 /* If a msg_name has been specified, assume this is to be used. */
1467 1460 if (msg_name) {
1468 1461 /* Look for a matching association on the endpoint. */
1469   - asoc = sctp_endpoint_lookup_assoc(ep, &tmp, &transport);
  1462 + asoc = sctp_endpoint_lookup_assoc(ep, &to, &transport);
1470 1463 if (!asoc) {
1471 1464 /* If we could not find a matching association on the
1472 1465 * endpoint, make sure that it is not a TCP-style
... ... @@ -1475,7 +1468,7 @@
1475 1468 */
1476 1469 if ((sctp_style(sk, TCP) &&
1477 1470 sctp_sstate(sk, ESTABLISHED)) ||
1478   - sctp_endpoint_is_peeled_off(ep, &tmp)) {
  1471 + sctp_endpoint_is_peeled_off(ep, &to)) {
1479 1472 err = -EADDRNOTAVAIL;
1480 1473 goto out_unlock;
1481 1474 }
... ... @@ -1612,7 +1605,7 @@
1612 1605 }
1613 1606  
1614 1607 /* Prime the peer's transport structures. */
1615   - transport = sctp_assoc_add_peer(asoc, &tmp, GFP_KERNEL, SCTP_UNKNOWN);
  1608 + transport = sctp_assoc_add_peer(asoc, &to, GFP_KERNEL, SCTP_UNKNOWN);
1616 1609 if (!transport) {
1617 1610 err = -ENOMEM;
1618 1611 goto out_free;
... ... @@ -1679,7 +1672,7 @@
1679 1672 */
1680 1673 if ((sctp_style(sk, TCP) && msg_name) ||
1681 1674 (sinfo_flags & SCTP_ADDR_OVER)) {
1682   - chunk_tp = sctp_assoc_lookup_paddr(asoc, &tmp);
  1675 + chunk_tp = sctp_assoc_lookup_paddr(asoc, &to);
1683 1676 if (!chunk_tp) {
1684 1677 err = -EINVAL;
1685 1678 goto out_free;