summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2006-11-20 17:07:06 -0800
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-02 21:26:37 -0800
commitbe29681edfbad72167df735e243e8621840dca4f (patch)
treeefc92cc3520bfc222200d82f561ccb84c9f7c5d0 /net
parent38a03145efcdbbcc60465fdffc0546208a52daf8 (diff)
[SCTP]: Switch sctp_assoc_lookup_paddr() to net-endian.
Callers updated. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/sctp/associola.c17
-rw-r--r--net/sctp/endpointola.c4
-rw-r--r--net/sctp/sm_make_chunk.c2
-rw-r--r--net/sctp/sm_statefuns.c4
-rw-r--r--net/sctp/socket.c5
5 files changed, 19 insertions, 13 deletions
diff --git a/net/sctp/associola.c b/net/sctp/associola.c
index ab3141f05921..3be8b6081a15 100644
--- a/net/sctp/associola.c
+++ b/net/sctp/associola.c
@@ -533,6 +533,8 @@ struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc,
struct sctp_transport *peer;
struct sctp_sock *sp;
unsigned short port;
+ union sctp_addr tmp;
+ flip_to_n(&tmp, addr);
sp = sctp_sk(asoc->base.sk);
@@ -551,7 +553,7 @@ struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc,
asoc->peer.port = port;
/* Check to see if this is a duplicate. */
- peer = sctp_assoc_lookup_paddr(asoc, addr);
+ peer = sctp_assoc_lookup_paddr(asoc, &tmp);
if (peer) {
if (peer->state == SCTP_UNKNOWN) {
if (peer_state == SCTP_ACTIVE)
@@ -684,14 +686,12 @@ struct sctp_transport *sctp_assoc_lookup_paddr(
{
struct sctp_transport *t;
struct list_head *pos;
- union sctp_addr tmp;
- flip_to_n(&tmp, address);
/* Cycle through all transports searching for a peer address. */
list_for_each(pos, &asoc->peer.transport_addr_list) {
t = list_entry(pos, struct sctp_transport, transports);
- if (sctp_cmp_addr_exact(&tmp, &t->ipaddr))
+ if (sctp_cmp_addr_exact(address, &t->ipaddr))
return t;
}
@@ -927,14 +927,15 @@ struct sctp_transport *sctp_assoc_is_match(struct sctp_association *asoc,
const union sctp_addr *paddr)
{
struct sctp_transport *transport;
- union sctp_addr tmp;
+ union sctp_addr tmp, tmp2;
flip_to_n(&tmp, laddr);
+ flip_to_n(&tmp2, paddr);
sctp_read_lock(&asoc->base.addr_lock);
if ((asoc->base.bind_addr.port == laddr->v4.sin_port) &&
(asoc->peer.port == paddr->v4.sin_port)) {
- transport = sctp_assoc_lookup_paddr(asoc, paddr);
+ transport = sctp_assoc_lookup_paddr(asoc, &tmp2);
if (!transport)
goto out;
@@ -1047,7 +1048,7 @@ void sctp_assoc_update(struct sctp_association *asoc,
/* Remove any peer addresses not present in the new association. */
list_for_each_safe(pos, temp, &asoc->peer.transport_addr_list) {
trans = list_entry(pos, struct sctp_transport, transports);
- if (!sctp_assoc_lookup_paddr(new, &trans->ipaddr_h))
+ if (!sctp_assoc_lookup_paddr(new, &trans->ipaddr))
sctp_assoc_del_peer(asoc, &trans->ipaddr);
}
@@ -1071,7 +1072,7 @@ void sctp_assoc_update(struct sctp_association *asoc,
list_for_each(pos, &new->peer.transport_addr_list) {
trans = list_entry(pos, struct sctp_transport,
transports);
- if (!sctp_assoc_lookup_paddr(asoc, &trans->ipaddr_h))
+ if (!sctp_assoc_lookup_paddr(asoc, &trans->ipaddr))
sctp_assoc_add_peer(asoc, &trans->ipaddr_h,
GFP_ATOMIC, trans->state);
}
diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c
index d77fe9232dd1..7c781d663603 100644
--- a/net/sctp/endpointola.c
+++ b/net/sctp/endpointola.c
@@ -259,6 +259,8 @@ static struct sctp_association *__sctp_endpoint_lookup_assoc(
int rport;
struct sctp_association *asoc;
struct list_head *pos;
+ union sctp_addr tmp;
+ flip_to_n(&tmp, paddr);
rport = paddr->v4.sin_port;
@@ -266,7 +268,7 @@ static struct sctp_association *__sctp_endpoint_lookup_assoc(
asoc = list_entry(pos, struct sctp_association, asocs);
if (rport == asoc->peer.port) {
sctp_read_lock(&asoc->base.addr_lock);
- *transport = sctp_assoc_lookup_paddr(asoc, paddr);
+ *transport = sctp_assoc_lookup_paddr(asoc, &tmp);
sctp_read_unlock(&asoc->base.addr_lock);
if (*transport)
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 303830b40ab3..cc1b01152c34 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -2466,7 +2466,7 @@ static __be16 sctp_process_asconf_param(struct sctp_association *asoc,
sctp_assoc_del_peer(asoc, &tmp_addr);
break;
case SCTP_PARAM_SET_PRIMARY:
- peer = sctp_assoc_lookup_paddr(asoc, &addr);
+ peer = sctp_assoc_lookup_paddr(asoc, &tmp_addr);
if (!peer)
return SCTP_ERROR_INV_PARAM;
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index ac776fd20667..7d722f5a31d7 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -1018,6 +1018,7 @@ sctp_disposition_t sctp_sf_backbeat_8_3(const struct sctp_endpoint *ep,
struct sctp_transport *link;
sctp_sender_hb_info_t *hbinfo;
unsigned long max_interval;
+ union sctp_addr tmp;
if (!sctp_vtag_verify(chunk, asoc))
return sctp_sf_pdiscard(ep, asoc, type, arg, commands);
@@ -1035,7 +1036,8 @@ sctp_disposition_t sctp_sf_backbeat_8_3(const struct sctp_endpoint *ep,
}
from_addr = hbinfo->daddr;
- link = sctp_assoc_lookup_paddr(asoc, &from_addr);
+ flip_to_n(&tmp, &from_addr);
+ link = sctp_assoc_lookup_paddr(asoc, &tmp);
/* This should never happen, but lets log it if so. */
if (unlikely(!link)) {
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index d42953efa355..ffdad8e842ac 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -1370,7 +1370,7 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
struct sctp_association *new_asoc=NULL, *asoc=NULL;
struct sctp_transport *transport, *chunk_tp;
struct sctp_chunk *chunk;
- union sctp_addr to;
+ union sctp_addr to, tmp;
struct sockaddr *msg_name = NULL;
struct sctp_sndrcvinfo default_sinfo = { 0 };
struct sctp_sndrcvinfo *sinfo;
@@ -1424,6 +1424,7 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
if (msg_namelen > sizeof(to))
msg_namelen = sizeof(to);
memcpy(&to, msg->msg_name, msg_namelen);
+ memcpy(&tmp, msg->msg_name, msg_namelen);
SCTP_DEBUG_PRINTK("Just memcpy'd. msg_name is "
"0x%x:%u.\n",
to.v4.sin_addr.s_addr, to.v4.sin_port);
@@ -1691,7 +1692,7 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
*/
if ((sctp_style(sk, TCP) && msg_name) ||
(sinfo_flags & SCTP_ADDR_OVER)) {
- chunk_tp = sctp_assoc_lookup_paddr(asoc, &to);
+ chunk_tp = sctp_assoc_lookup_paddr(asoc, &tmp);
if (!chunk_tp) {
err = -EINVAL;
goto out_free;