Commit 7e1e4a2b authored by Al Viro's avatar Al Viro Committed by David S. Miller

[SCTP]: Switch sctp_bind_addr_match() to net-endian.

Callers adjusted.
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5f242a13
...@@ -930,6 +930,8 @@ struct sctp_transport *sctp_assoc_is_match(struct sctp_association *asoc, ...@@ -930,6 +930,8 @@ struct sctp_transport *sctp_assoc_is_match(struct sctp_association *asoc,
const union sctp_addr *paddr) const union sctp_addr *paddr)
{ {
struct sctp_transport *transport; struct sctp_transport *transport;
union sctp_addr tmp;
flip_to_n(&tmp, laddr);
sctp_read_lock(&asoc->base.addr_lock); sctp_read_lock(&asoc->base.addr_lock);
...@@ -939,7 +941,7 @@ struct sctp_transport *sctp_assoc_is_match(struct sctp_association *asoc, ...@@ -939,7 +941,7 @@ struct sctp_transport *sctp_assoc_is_match(struct sctp_association *asoc,
if (!transport) if (!transport)
goto out; goto out;
if (sctp_bind_addr_match(&asoc->base.bind_addr, laddr, if (sctp_bind_addr_match(&asoc->base.bind_addr, &tmp,
sctp_sk(asoc->base.sk))) sctp_sk(asoc->base.sk)))
goto out; goto out;
} }
...@@ -1342,12 +1344,10 @@ int sctp_assoc_lookup_laddr(struct sctp_association *asoc, ...@@ -1342,12 +1344,10 @@ int sctp_assoc_lookup_laddr(struct sctp_association *asoc,
const union sctp_addr *laddr) const union sctp_addr *laddr)
{ {
int found; int found;
union sctp_addr tmp;
flip_to_h(&tmp, laddr);
sctp_read_lock(&asoc->base.addr_lock); sctp_read_lock(&asoc->base.addr_lock);
if ((asoc->base.bind_addr.port == ntohs(laddr->v4.sin_port)) && if ((asoc->base.bind_addr.port == ntohs(laddr->v4.sin_port)) &&
sctp_bind_addr_match(&asoc->base.bind_addr, &tmp, sctp_bind_addr_match(&asoc->base.bind_addr, laddr,
sctp_sk(asoc->base.sk))) { sctp_sk(asoc->base.sk))) {
found = 1; found = 1;
goto out; goto out;
......
...@@ -307,12 +307,10 @@ int sctp_bind_addr_match(struct sctp_bind_addr *bp, ...@@ -307,12 +307,10 @@ int sctp_bind_addr_match(struct sctp_bind_addr *bp,
{ {
struct sctp_sockaddr_entry *laddr; struct sctp_sockaddr_entry *laddr;
struct list_head *pos; struct list_head *pos;
union sctp_addr tmp;
flip_to_n(&tmp, addr);
list_for_each(pos, &bp->address_list) { list_for_each(pos, &bp->address_list) {
laddr = list_entry(pos, struct sctp_sockaddr_entry, list); laddr = list_entry(pos, struct sctp_sockaddr_entry, list);
if (opt->pf->cmp_addr(&laddr->a, &tmp, opt)) if (opt->pf->cmp_addr(&laddr->a, addr, opt))
return 1; return 1;
} }
......
...@@ -228,10 +228,12 @@ struct sctp_endpoint *sctp_endpoint_is_match(struct sctp_endpoint *ep, ...@@ -228,10 +228,12 @@ struct sctp_endpoint *sctp_endpoint_is_match(struct sctp_endpoint *ep,
const union sctp_addr *laddr) const union sctp_addr *laddr)
{ {
struct sctp_endpoint *retval; struct sctp_endpoint *retval;
union sctp_addr tmp;
flip_to_n(&tmp, laddr);
sctp_read_lock(&ep->base.addr_lock); sctp_read_lock(&ep->base.addr_lock);
if (ep->base.bind_addr.port == laddr->v4.sin_port) { if (ep->base.bind_addr.port == laddr->v4.sin_port) {
if (sctp_bind_addr_match(&ep->base.bind_addr, laddr, if (sctp_bind_addr_match(&ep->base.bind_addr, &tmp,
sctp_sk(ep->base.sk))) { sctp_sk(ep->base.sk))) {
retval = ep; retval = ep;
goto out; goto out;
......
...@@ -4635,11 +4635,9 @@ static long sctp_get_port_local(struct sock *sk, union sctp_addr *addr) ...@@ -4635,11 +4635,9 @@ static long sctp_get_port_local(struct sock *sk, union sctp_addr *addr)
{ {
struct sctp_bind_hashbucket *head; /* hash list */ struct sctp_bind_hashbucket *head; /* hash list */
struct sctp_bind_bucket *pp; /* hash list port iterator */ struct sctp_bind_bucket *pp; /* hash list port iterator */
union sctp_addr tmp;
unsigned short snum; unsigned short snum;
int ret; int ret;
flip_to_h(&tmp, addr);
snum = ntohs(addr->v4.sin_port); snum = ntohs(addr->v4.sin_port);
SCTP_DEBUG_PRINTK("sctp_get_port() begins, snum=%d\n", snum); SCTP_DEBUG_PRINTK("sctp_get_port() begins, snum=%d\n", snum);
...@@ -4737,7 +4735,7 @@ static long sctp_get_port_local(struct sock *sk, union sctp_addr *addr) ...@@ -4737,7 +4735,7 @@ static long sctp_get_port_local(struct sock *sk, union sctp_addr *addr)
if (reuse && sk2->sk_reuse) if (reuse && sk2->sk_reuse)
continue; continue;
if (sctp_bind_addr_match(&ep2->base.bind_addr, &tmp, if (sctp_bind_addr_match(&ep2->base.bind_addr, addr,
sctp_sk(sk))) { sctp_sk(sk))) {
ret = (long)sk2; ret = (long)sk2;
goto fail_unlock; goto fail_unlock;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment