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

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
diff --git a/net/sctp/bind_addr.c b/net/sctp/bind_addr.c
index eb3a5e2..fd0f812 100644
--- a/net/sctp/bind_addr.c
+++ b/net/sctp/bind_addr.c
@@ -264,7 +264,6 @@
 	int retval = 0;
 	int len;
 	struct sctp_af *af;
-	union sctp_addr tmp;
 
 	/* Convert the raw address to standard address format */
 	while (addrs_len) {
@@ -278,9 +277,8 @@
 			break;
 		}
 
-		af->from_addr_param(&addr, rawaddr, port, 0);
-		flip_to_n(&tmp, &addr);
-		retval = sctp_add_bind_addr(bp, &tmp, 1, gfp);
+		af->from_addr_param(&addr, rawaddr, htons(port), 0);
+		retval = sctp_add_bind_addr(bp, &addr, 1, gfp);
 		if (retval) {
 			/* Can't finish building the list, clean up. */
 			sctp_bind_addr_clean(bp);
diff --git a/net/sctp/input.c b/net/sctp/input.c
index 3b4a552..2d660f8 100644
--- a/net/sctp/input.c
+++ b/net/sctp/input.c
@@ -914,7 +914,6 @@
 	sctp_init_chunk_t *init;
 	struct sctp_transport *transport;
 	struct sctp_af *af;
-	union sctp_addr tmp2;
 
 	ch = (sctp_chunkhdr_t *) skb->data;
 
@@ -961,10 +960,9 @@
 		if (!af)
 			continue;
 
-		af->from_addr_param(paddr, params.addr, ntohs(sh->source), 0);
-		flip_to_n(&tmp2, paddr);
+		af->from_addr_param(paddr, params.addr, sh->source, 0);
 
-		asoc = __sctp_lookup_association(laddr, &tmp2, &transport);
+		asoc = __sctp_lookup_association(laddr, paddr, &transport);
 		if (asoc)
 			return asoc;
 	}
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index d6b585b..566cdc9 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -408,7 +408,7 @@
 /* Initialize a sctp_addr from an address parameter. */
 static void sctp_v6_from_addr_param(union sctp_addr *addr,
 				    union sctp_addr_param *param,
-				    __u16 port, int iif)
+				    __be16 port, int iif)
 {
 	addr->v6.sin6_family = AF_INET6;
 	addr->v6.sin6_port = port;
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index a6bcbf5..87d36f4 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -292,7 +292,7 @@
 /* Initialize a sctp_addr from an address parameter. */
 static void sctp_v4_from_addr_param(union sctp_addr *addr,
 				    union sctp_addr_param *param,
-				    __u16 port, int iif)
+				    __be16 port, int iif)
 {
 	addr->v4.sin_family = AF_INET;
 	addr->v4.sin_port = port;
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 46cfcca..b367ad5 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -2021,7 +2021,6 @@
 	sctp_scope_t scope;
 	time_t stale;
 	struct sctp_af *af;
-	union sctp_addr tmp;
 
 	/* We maintain all INIT parameters in network byte order all the
 	 * time.  This allows us to not worry about whether the parameters
@@ -2034,11 +2033,10 @@
 		/* Fall through. */
 	case SCTP_PARAM_IPV4_ADDRESS:
 		af = sctp_get_af_specific(param_type2af(param.p->type));
-		af->from_addr_param(&addr, param.addr, asoc->peer.port, 0);
-		flip_to_n(&tmp, &addr);
+		af->from_addr_param(&addr, param.addr, htons(asoc->peer.port), 0);
 		scope = sctp_scope(peer_addr);
-		if (sctp_in_scope(&tmp, scope))
-			if (!sctp_assoc_add_peer(asoc, &tmp, gfp, SCTP_UNCONFIRMED))
+		if (sctp_in_scope(&addr, scope))
+			if (!sctp_assoc_add_peer(asoc, &addr, gfp, SCTP_UNCONFIRMED))
 				return 0;
 		break;
 
@@ -2421,7 +2419,7 @@
 	union sctp_addr	addr;
 	struct list_head *pos;
 	union sctp_addr_param *addr_param;
-	union sctp_addr tmp, tmp_addr;
+	union sctp_addr tmp;
 
 	addr_param = (union sctp_addr_param *)
 			((void *)asconf_param + sizeof(sctp_addip_param_t));
@@ -2430,8 +2428,7 @@
 	if (unlikely(!af))
 		return SCTP_ERROR_INV_PARAM;
 
-	af->from_addr_param(&addr, addr_param, asoc->peer.port, 0);
-	flip_to_n(&tmp_addr, &addr);
+	af->from_addr_param(&addr, addr_param, htons(asoc->peer.port), 0);
 	switch (asconf_param->param_hdr.type) {
 	case SCTP_PARAM_ADD_IP:
 		/* ADDIP 4.3 D9) If an endpoint receives an ADD IP address
@@ -2441,7 +2438,7 @@
 	 	 * Due to Resource Shortage'.
 	 	 */
 
-		peer = sctp_assoc_add_peer(asoc, &tmp_addr, GFP_ATOMIC, SCTP_UNCONFIRMED);
+		peer = sctp_assoc_add_peer(asoc, &addr, GFP_ATOMIC, SCTP_UNCONFIRMED);
 		if (!peer)
 			return SCTP_ERROR_RSRC_LOW;
 
@@ -2467,13 +2464,13 @@
 		 * Delete Source IP Address'
 		 */
 		flip_to_n(&tmp, sctp_source(asconf));
-		if (sctp_cmp_addr_exact(&tmp, &tmp_addr))
+		if (sctp_cmp_addr_exact(&tmp, &addr))
 			return SCTP_ERROR_DEL_SRC_IP;
 
-		sctp_assoc_del_peer(asoc, &tmp_addr);
+		sctp_assoc_del_peer(asoc, &addr);
 		break;
 	case SCTP_PARAM_SET_PRIMARY:
-		peer = sctp_assoc_lookup_paddr(asoc, &tmp_addr);
+		peer = sctp_assoc_lookup_paddr(asoc, &addr);
 		if (!peer)
 			return SCTP_ERROR_INV_PARAM;
 
@@ -2591,15 +2588,13 @@
 	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));
 
 	/* 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);
+	af->from_addr_param(&addr, addr_param, htons(bp->port), 0);
 
 	switch (asconf_param->param_hdr.type) {
 	case SCTP_PARAM_ADD_IP:
@@ -2607,7 +2602,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, &tmp))
+			if (sctp_cmp_addr_exact(&saddr->a, &addr))
 				saddr->use_as_src = 1;
 		}
 		sctp_write_unlock(&asoc->base.addr_lock);
@@ -2616,7 +2611,7 @@
 	case SCTP_PARAM_DEL_IP:
 		sctp_local_bh_disable();
 		sctp_write_lock(&asoc->base.addr_lock);
-		retval = sctp_del_bind_addr(bp, &tmp);
+		retval = sctp_del_bind_addr(bp, &addr);
 		sctp_write_unlock(&asoc->base.addr_lock);
 		sctp_local_bh_enable();
 		list_for_each(pos, &asoc->peer.transport_addr_list) {