summaryrefslogtreecommitdiff
path: root/net/sctp
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2006-11-20 17:05:23 -0800
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-02 21:26:32 -0800
commit5f242a13e8505e0f3efd3113da6e029f6e7dfa32 (patch)
tree5c9a7de99887bde11fd16e1bfaf2543b358f8727 /net/sctp
parentc604e368a477ed1f7dd532605a8f1990d2b128ee (diff)
[SCTP]: Switch ->cmp_addr() and sctp_cmp_addr_exact() to net-endian.
instances of ->cmp_addr() are fine with switching both arguments to net-endian; callers other than in sctp_cmp_addr_exact() (both as ->cmp_addr(...) and direct calls of instances) adjusted; sctp_cmp_addr_exact() switched to net-endian itself and adjustment is done in its callers Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp')
-rw-r--r--net/sctp/associola.c9
-rw-r--r--net/sctp/bind_addr.c13
-rw-r--r--net/sctp/proc.c14
-rw-r--r--net/sctp/protocol.c4
-rw-r--r--net/sctp/sm_make_chunk.c11
-rw-r--r--net/sctp/sm_sideeffect.c6
-rw-r--r--net/sctp/sm_statefuns.c4
-rw-r--r--net/sctp/socket.c5
8 files changed, 41 insertions, 25 deletions
diff --git a/net/sctp/associola.c b/net/sctp/associola.c
index 83318e727905..72199d149573 100644
--- a/net/sctp/associola.c
+++ b/net/sctp/associola.c
@@ -666,10 +666,13 @@ void sctp_assoc_del_peer(struct sctp_association *asoc,
struct list_head *pos;
struct list_head *temp;
struct sctp_transport *transport;
+ union sctp_addr tmp;
+
+ flip_to_n(&tmp, addr);
list_for_each_safe(pos, temp, &asoc->peer.transport_addr_list) {
transport = list_entry(pos, struct sctp_transport, transports);
- if (sctp_cmp_addr_exact(addr, &transport->ipaddr_h)) {
+ if (sctp_cmp_addr_exact(&tmp, &transport->ipaddr)) {
/* Do book keeping for removing the peer and free it. */
sctp_assoc_rm_peer(asoc, transport);
break;
@@ -684,12 +687,14 @@ 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(address, &t->ipaddr_h))
+ if (sctp_cmp_addr_exact(&tmp, &t->ipaddr))
return t;
}
diff --git a/net/sctp/bind_addr.c b/net/sctp/bind_addr.c
index 2b36e4238170..9085e531d575 100644
--- a/net/sctp/bind_addr.c
+++ b/net/sctp/bind_addr.c
@@ -181,10 +181,13 @@ int sctp_del_bind_addr(struct sctp_bind_addr *bp, union sctp_addr *del_addr)
{
struct list_head *pos, *temp;
struct sctp_sockaddr_entry *addr;
+ union sctp_addr tmp;
+
+ flip_to_n(&tmp, del_addr);
list_for_each_safe(pos, temp, &bp->address_list) {
addr = list_entry(pos, struct sctp_sockaddr_entry, list);
- if (sctp_cmp_addr_exact(&addr->a_h, del_addr)) {
+ if (sctp_cmp_addr_exact(&addr->a, &tmp)) {
/* Found the exact match. */
list_del(pos);
kfree(addr);
@@ -304,10 +307,12 @@ int sctp_bind_addr_match(struct sctp_bind_addr *bp,
{
struct sctp_sockaddr_entry *laddr;
struct list_head *pos;
+ union sctp_addr tmp;
+ flip_to_n(&tmp, addr);
list_for_each(pos, &bp->address_list) {
laddr = list_entry(pos, struct sctp_sockaddr_entry, list);
- if (opt->pf->cmp_addr(&laddr->a_h, addr, opt))
+ if (opt->pf->cmp_addr(&laddr->a, &tmp, opt))
return 1;
}
@@ -334,14 +339,12 @@ union sctp_addr *sctp_find_unmatch_addr(struct sctp_bind_addr *bp,
addr_buf = (union sctp_addr *)addrs;
for (i = 0; i < addrcnt; i++) {
- union sctp_addr tmp;
addr = (union sctp_addr *)addr_buf;
af = sctp_get_af_specific(addr->v4.sin_family);
if (!af)
return NULL;
- flip_to_h(&tmp, addr);
- if (opt->pf->cmp_addr(&laddr->a_h, &tmp, opt))
+ if (opt->pf->cmp_addr(&laddr->a, addr, opt))
break;
addr_buf += af->sockaddr_len;
diff --git a/net/sctp/proc.c b/net/sctp/proc.c
index bf0144ed3e3a..04faa4a706d4 100644
--- a/net/sctp/proc.c
+++ b/net/sctp/proc.c
@@ -155,17 +155,17 @@ static void sctp_seq_dump_local_addrs(struct seq_file *seq, struct sctp_ep_commo
if (epb->type == SCTP_EP_TYPE_ASSOCIATION) {
asoc = sctp_assoc(epb);
peer = asoc->peer.primary_path;
- primary = &peer->saddr_h;
+ primary = &peer->saddr;
}
list_for_each(pos, &epb->bind_addr.address_list) {
laddr = list_entry(pos, struct sctp_sockaddr_entry, list);
- addr = (union sctp_addr *)&laddr->a_h;
+ addr = &laddr->a;
af = sctp_get_af_specific(addr->sa.sa_family);
if (primary && af->cmp_addr(addr, primary)) {
seq_printf(seq, "*");
}
- af->seq_dump_addr(seq, &laddr->a);
+ af->seq_dump_addr(seq, addr);
}
}
@@ -175,17 +175,19 @@ static void sctp_seq_dump_remote_addrs(struct seq_file *seq, struct sctp_associa
struct list_head *pos;
struct sctp_transport *transport;
union sctp_addr *addr, *primary;
+ union sctp_addr tmp;
struct sctp_af *af;
primary = &(assoc->peer.primary_addr);
+ flip_to_n(&tmp, primary);
list_for_each(pos, &assoc->peer.transport_addr_list) {
transport = list_entry(pos, struct sctp_transport, transports);
- addr = (union sctp_addr *)&transport->ipaddr_h;
+ addr = &transport->ipaddr;
af = sctp_get_af_specific(addr->sa.sa_family);
- if (af->cmp_addr(addr, primary)) {
+ if (af->cmp_addr(addr, &tmp)) {
seq_printf(seq, "*");
}
- af->seq_dump_addr(seq, &transport->ipaddr);
+ af->seq_dump_addr(seq, addr);
}
}
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index 363274045032..2db140e901d0 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -478,12 +478,14 @@ static struct dst_entry *sctp_v4_get_dst(struct sctp_association *asoc,
*/
sctp_read_lock(addr_lock);
list_for_each(pos, &bp->address_list) {
+ union sctp_addr tmp;
laddr = list_entry(pos, struct sctp_sockaddr_entry,
list);
if (!laddr->use_as_src)
continue;
sctp_v4_dst_saddr(&dst_saddr, dst, bp->port);
- if (sctp_v4_cmp_addr(&dst_saddr, &laddr->a_h))
+ flip_to_n(&tmp, &dst_saddr);
+ if (sctp_v4_cmp_addr(&tmp, &laddr->a))
goto out_unlock;
}
sctp_read_unlock(addr_lock);
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index b8e0f72b319f..ee907ea7eed1 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -2414,7 +2414,8 @@ static __be16 sctp_process_asconf_param(struct sctp_association *asoc,
union sctp_addr addr;
struct list_head *pos;
union sctp_addr_param *addr_param;
-
+ union sctp_addr tmp, tmp_addr;
+
addr_param = (union sctp_addr_param *)
((void *)asconf_param + sizeof(sctp_addip_param_t));
@@ -2423,6 +2424,7 @@ static __be16 sctp_process_asconf_param(struct sctp_association *asoc,
return SCTP_ERROR_INV_PARAM;
af->from_addr_param(&addr, addr_param, asoc->peer.port, 0);
+ flip_to_n(&tmp_addr, &addr);
switch (asconf_param->param_hdr.type) {
case SCTP_PARAM_ADD_IP:
/* ADDIP 4.3 D9) If an endpoint receives an ADD IP address
@@ -2457,7 +2459,8 @@ static __be16 sctp_process_asconf_param(struct sctp_association *asoc,
* an Error Cause TLV set to the new error code 'Request to
* Delete Source IP Address'
*/
- if (sctp_cmp_addr_exact(sctp_source(asconf), &addr))
+ flip_to_n(&tmp, sctp_source(asconf));
+ if (sctp_cmp_addr_exact(&tmp, &tmp_addr))
return SCTP_ERROR_DEL_SRC_IP;
sctp_assoc_del_peer(asoc, &addr);
@@ -2581,6 +2584,7 @@ static int sctp_asconf_param_success(struct sctp_association *asoc,
struct sctp_transport *transport;
struct sctp_sockaddr_entry *saddr;
int retval = 0;
+ union sctp_addr tmp;
addr_param = (union sctp_addr_param *)
((void *)asconf_param + sizeof(sctp_addip_param_t));
@@ -2588,6 +2592,7 @@ static int sctp_asconf_param_success(struct sctp_association *asoc,
/* We have checked the packet before, so we do not check again. */
af = sctp_get_af_specific(param_type2af(addr_param->v4.param_hdr.type));
af->from_addr_param(&addr, addr_param, bp->port, 0);
+ flip_to_n(&tmp, &addr);
switch (asconf_param->param_hdr.type) {
case SCTP_PARAM_ADD_IP:
@@ -2595,7 +2600,7 @@ static int sctp_asconf_param_success(struct sctp_association *asoc,
sctp_write_lock(&asoc->base.addr_lock);
list_for_each(pos, &bp->address_list) {
saddr = list_entry(pos, struct sctp_sockaddr_entry, list);
- if (sctp_cmp_addr_exact(&saddr->a_h, &addr))
+ if (sctp_cmp_addr_exact(&saddr->a, &tmp))
saddr->use_as_src = 1;
}
sctp_write_unlock(&asoc->base.addr_lock);
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
index e1c5cddf32da..3d9213dfaa10 100644
--- a/net/sctp/sm_sideeffect.c
+++ b/net/sctp/sm_sideeffect.c
@@ -830,11 +830,13 @@ static void sctp_cmd_del_non_primary(struct sctp_association *asoc)
struct sctp_transport *t;
struct list_head *pos;
struct list_head *temp;
+ union sctp_addr tmp;
+ flip_to_n(&tmp, &asoc->peer.primary_addr);
list_for_each_safe(pos, temp, &asoc->peer.transport_addr_list) {
t = list_entry(pos, struct sctp_transport, transports);
- if (!sctp_cmp_addr_exact(&t->ipaddr_h,
- &asoc->peer.primary_addr)) {
+ if (!sctp_cmp_addr_exact(&t->ipaddr,
+ &tmp)) {
sctp_assoc_del_peer(asoc, &t->ipaddr_h);
}
}
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index f46072767549..ac776fd20667 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -1167,8 +1167,8 @@ static int sctp_sf_check_restart_addrs(const struct sctp_association *new_asoc,
list_for_each(pos2, &asoc->peer.transport_addr_list) {
addr = list_entry(pos2, struct sctp_transport,
transports);
- if (sctp_cmp_addr_exact(&new_addr->ipaddr_h,
- &addr->ipaddr_h)) {
+ if (sctp_cmp_addr_exact(&new_addr->ipaddr,
+ &addr->ipaddr)) {
found = 1;
break;
}
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 459f32c5c3ae..e03ba9055eb1 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -693,7 +693,6 @@ static int sctp_send_asconf_del_ip(struct sock *sk,
struct sctp_bind_addr *bp;
struct sctp_chunk *chunk;
union sctp_addr *laddr;
- union sctp_addr saveaddr;
void *addr_buf;
struct sctp_af *af;
struct list_head *pos, *pos1;
@@ -773,13 +772,11 @@ static int sctp_send_asconf_del_ip(struct sock *sk,
for (i = 0; i < addrcnt; i++) {
laddr = (union sctp_addr *)addr_buf;
af = sctp_get_af_specific(laddr->v4.sin_family);
- memcpy(&saveaddr, laddr, af->sockaddr_len);
- saveaddr.v4.sin_port = ntohs(saveaddr.v4.sin_port);
list_for_each(pos1, &bp->address_list) {
saddr = list_entry(pos1,
struct sctp_sockaddr_entry,
list);
- if (sctp_cmp_addr_exact(&saddr->a_h, &saveaddr))
+ if (sctp_cmp_addr_exact(&saddr->a, laddr))
saddr->use_as_src = 0;
}
addr_buf += af->sockaddr_len;