mirror of
https://github.com/torvalds/linux.git
synced 2024-11-11 06:31:49 +00:00
[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>
This commit is contained in:
parent
38a03145ef
commit
be29681edf
@ -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);
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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)) {
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user