[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>
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index b8e0f72..ee907ea 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -2414,7 +2414,8 @@
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 @@
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 @@
* 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 @@
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 @@
/* 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 @@
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);