[SCTP]: sctp_endpoint_lookup_assoc() switched to net-endian.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
@@ -257,16 +257,14 @@ static struct sctp_association *__sctp_endpoint_lookup_assoc(
|
|||||||
int rport;
|
int rport;
|
||||||
struct sctp_association *asoc;
|
struct sctp_association *asoc;
|
||||||
struct list_head *pos;
|
struct list_head *pos;
|
||||||
union sctp_addr tmp;
|
|
||||||
flip_to_n(&tmp, paddr);
|
|
||||||
|
|
||||||
rport = paddr->v4.sin_port;
|
rport = ntohs(paddr->v4.sin_port);
|
||||||
|
|
||||||
list_for_each(pos, &ep->asocs) {
|
list_for_each(pos, &ep->asocs) {
|
||||||
asoc = list_entry(pos, struct sctp_association, asocs);
|
asoc = list_entry(pos, struct sctp_association, asocs);
|
||||||
if (rport == asoc->peer.port) {
|
if (rport == asoc->peer.port) {
|
||||||
sctp_read_lock(&asoc->base.addr_lock);
|
sctp_read_lock(&asoc->base.addr_lock);
|
||||||
*transport = sctp_assoc_lookup_paddr(asoc, &tmp);
|
*transport = sctp_assoc_lookup_paddr(asoc, paddr);
|
||||||
sctp_read_unlock(&asoc->base.addr_lock);
|
sctp_read_unlock(&asoc->base.addr_lock);
|
||||||
|
|
||||||
if (*transport)
|
if (*transport)
|
||||||
@@ -348,8 +346,10 @@ static void sctp_endpoint_bh_rcv(struct sctp_endpoint *ep)
|
|||||||
* COOKIE-ECHO chunk.
|
* COOKIE-ECHO chunk.
|
||||||
*/
|
*/
|
||||||
if (NULL == chunk->asoc) {
|
if (NULL == chunk->asoc) {
|
||||||
|
union sctp_addr tmp;
|
||||||
|
flip_to_n(&tmp, sctp_source(chunk));
|
||||||
asoc = sctp_endpoint_lookup_assoc(ep,
|
asoc = sctp_endpoint_lookup_assoc(ep,
|
||||||
sctp_source(chunk),
|
&tmp,
|
||||||
&transport);
|
&transport);
|
||||||
chunk->asoc = asoc;
|
chunk->asoc = asoc;
|
||||||
chunk->transport = transport;
|
chunk->transport = transport;
|
||||||
|
@@ -228,11 +228,9 @@ static struct sctp_transport *sctp_addr_id2transport(struct sock *sk,
|
|||||||
struct sctp_association *addr_asoc = NULL, *id_asoc = NULL;
|
struct sctp_association *addr_asoc = NULL, *id_asoc = NULL;
|
||||||
struct sctp_transport *transport;
|
struct sctp_transport *transport;
|
||||||
union sctp_addr *laddr = (union sctp_addr *)addr;
|
union sctp_addr *laddr = (union sctp_addr *)addr;
|
||||||
union sctp_addr tmp;
|
|
||||||
|
|
||||||
flip_to_h(&tmp, laddr);
|
|
||||||
addr_asoc = sctp_endpoint_lookup_assoc(sctp_sk(sk)->ep,
|
addr_asoc = sctp_endpoint_lookup_assoc(sctp_sk(sk)->ep,
|
||||||
&tmp,
|
laddr,
|
||||||
&transport);
|
&transport);
|
||||||
|
|
||||||
if (!addr_asoc)
|
if (!addr_asoc)
|
||||||
@@ -1007,7 +1005,7 @@ static int __sctp_connect(struct sock* sk,
|
|||||||
/* Check if there already is a matching association on the
|
/* Check if there already is a matching association on the
|
||||||
* endpoint (other than the one created here).
|
* endpoint (other than the one created here).
|
||||||
*/
|
*/
|
||||||
asoc2 = sctp_endpoint_lookup_assoc(ep, &to, &transport);
|
asoc2 = sctp_endpoint_lookup_assoc(ep, sa_addr, &transport);
|
||||||
if (asoc2 && asoc2 != asoc) {
|
if (asoc2 && asoc2 != asoc) {
|
||||||
if (asoc2->state >= SCTP_STATE_ESTABLISHED)
|
if (asoc2->state >= SCTP_STATE_ESTABLISHED)
|
||||||
err = -EISCONN;
|
err = -EISCONN;
|
||||||
@@ -1468,7 +1466,7 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
|
|||||||
/* If a msg_name has been specified, assume this is to be used. */
|
/* If a msg_name has been specified, assume this is to be used. */
|
||||||
if (msg_name) {
|
if (msg_name) {
|
||||||
/* Look for a matching association on the endpoint. */
|
/* Look for a matching association on the endpoint. */
|
||||||
asoc = sctp_endpoint_lookup_assoc(ep, &to, &transport);
|
asoc = sctp_endpoint_lookup_assoc(ep, &tmp, &transport);
|
||||||
if (!asoc) {
|
if (!asoc) {
|
||||||
/* If we could not find a matching association on the
|
/* If we could not find a matching association on the
|
||||||
* endpoint, make sure that it is not a TCP-style
|
* endpoint, make sure that it is not a TCP-style
|
||||||
|
Reference in New Issue
Block a user