aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2006-11-20 20:11:13 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-03 00:26:48 -0500
commitdd86d136f9feb72c52a5b07707affe80edbc8dda (patch)
tree3ca8c38af8d87d76d2ad3fa239a7d9984f327bec /net
parent5ab7b859ab58e3479a5a66e383ecd6bc447f6c1d (diff)
[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>
Diffstat (limited to 'net')
-rw-r--r--net/sctp/bind_addr.c6
-rw-r--r--net/sctp/input.c6
-rw-r--r--net/sctp/ipv6.c2
-rw-r--r--net/sctp/protocol.c2
-rw-r--r--net/sctp/sm_make_chunk.c29
5 files changed, 18 insertions, 27 deletions
diff --git a/net/sctp/bind_addr.c b/net/sctp/bind_addr.c
index eb3a5e25777d..fd0f812f8a46 100644
--- a/net/sctp/bind_addr.c
+++ b/net/sctp/bind_addr.c
@@ -264,7 +264,6 @@ int sctp_raw_to_bind_addrs(struct sctp_bind_addr *bp, __u8 *raw_addr_list,
264 int retval = 0; 264 int retval = 0;
265 int len; 265 int len;
266 struct sctp_af *af; 266 struct sctp_af *af;
267 union sctp_addr tmp;
268 267
269 /* Convert the raw address to standard address format */ 268 /* Convert the raw address to standard address format */
270 while (addrs_len) { 269 while (addrs_len) {
@@ -278,9 +277,8 @@ int sctp_raw_to_bind_addrs(struct sctp_bind_addr *bp, __u8 *raw_addr_list,
278 break; 277 break;
279 } 278 }
280 279
281 af->from_addr_param(&addr, rawaddr, port, 0); 280 af->from_addr_param(&addr, rawaddr, htons(port), 0);
282 flip_to_n(&tmp, &addr); 281 retval = sctp_add_bind_addr(bp, &addr, 1, gfp);
283 retval = sctp_add_bind_addr(bp, &tmp, 1, gfp);
284 if (retval) { 282 if (retval) {
285 /* Can't finish building the list, clean up. */ 283 /* Can't finish building the list, clean up. */
286 sctp_bind_addr_clean(bp); 284 sctp_bind_addr_clean(bp);
diff --git a/net/sctp/input.c b/net/sctp/input.c
index 3b4a552c9f18..2d660f8d94fd 100644
--- a/net/sctp/input.c
+++ b/net/sctp/input.c
@@ -914,7 +914,6 @@ static struct sctp_association *__sctp_rcv_init_lookup(struct sk_buff *skb,
914 sctp_init_chunk_t *init; 914 sctp_init_chunk_t *init;
915 struct sctp_transport *transport; 915 struct sctp_transport *transport;
916 struct sctp_af *af; 916 struct sctp_af *af;
917 union sctp_addr tmp2;
918 917
919 ch = (sctp_chunkhdr_t *) skb->data; 918 ch = (sctp_chunkhdr_t *) skb->data;
920 919
@@ -961,10 +960,9 @@ static struct sctp_association *__sctp_rcv_init_lookup(struct sk_buff *skb,
961 if (!af) 960 if (!af)
962 continue; 961 continue;
963 962
964 af->from_addr_param(paddr, params.addr, ntohs(sh->source), 0); 963 af->from_addr_param(paddr, params.addr, sh->source, 0);
965 flip_to_n(&tmp2, paddr);
966 964
967 asoc = __sctp_lookup_association(laddr, &tmp2, &transport); 965 asoc = __sctp_lookup_association(laddr, paddr, &transport);
968 if (asoc) 966 if (asoc)
969 return asoc; 967 return asoc;
970 } 968 }
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index d6b585b85cbb..566cdc9977c4 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -408,7 +408,7 @@ static void sctp_v6_to_sk_daddr(union sctp_addr *addr, struct sock *sk)
408/* Initialize a sctp_addr from an address parameter. */ 408/* Initialize a sctp_addr from an address parameter. */
409static void sctp_v6_from_addr_param(union sctp_addr *addr, 409static void sctp_v6_from_addr_param(union sctp_addr *addr,
410 union sctp_addr_param *param, 410 union sctp_addr_param *param,
411 __u16 port, int iif) 411 __be16 port, int iif)
412{ 412{
413 addr->v6.sin6_family = AF_INET6; 413 addr->v6.sin6_family = AF_INET6;
414 addr->v6.sin6_port = port; 414 addr->v6.sin6_port = port;
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index a6bcbf560e36..87d36f440d1d 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -292,7 +292,7 @@ static void sctp_v4_to_sk_daddr(union sctp_addr *addr, struct sock *sk)
292/* Initialize a sctp_addr from an address parameter. */ 292/* Initialize a sctp_addr from an address parameter. */
293static void sctp_v4_from_addr_param(union sctp_addr *addr, 293static void sctp_v4_from_addr_param(union sctp_addr *addr,
294 union sctp_addr_param *param, 294 union sctp_addr_param *param,
295 __u16 port, int iif) 295 __be16 port, int iif)
296{ 296{
297 addr->v4.sin_family = AF_INET; 297 addr->v4.sin_family = AF_INET;
298 addr->v4.sin_port = port; 298 addr->v4.sin_port = port;
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 46cfcca5e41b..b367ad59ed4a 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -2021,7 +2021,6 @@ static int sctp_process_param(struct sctp_association *asoc,
2021 sctp_scope_t scope; 2021 sctp_scope_t scope;
2022 time_t stale; 2022 time_t stale;
2023 struct sctp_af *af; 2023 struct sctp_af *af;
2024 union sctp_addr tmp;
2025 2024
2026 /* We maintain all INIT parameters in network byte order all the 2025 /* We maintain all INIT parameters in network byte order all the
2027 * time. This allows us to not worry about whether the parameters 2026 * time. This allows us to not worry about whether the parameters
@@ -2034,11 +2033,10 @@ static int sctp_process_param(struct sctp_association *asoc,
2034 /* Fall through. */ 2033 /* Fall through. */
2035 case SCTP_PARAM_IPV4_ADDRESS: 2034 case SCTP_PARAM_IPV4_ADDRESS:
2036 af = sctp_get_af_specific(param_type2af(param.p->type)); 2035 af = sctp_get_af_specific(param_type2af(param.p->type));
2037 af->from_addr_param(&addr, param.addr, asoc->peer.port, 0); 2036 af->from_addr_param(&addr, param.addr, htons(asoc->peer.port), 0);
2038 flip_to_n(&tmp, &addr);
2039 scope = sctp_scope(peer_addr); 2037 scope = sctp_scope(peer_addr);
2040 if (sctp_in_scope(&tmp, scope)) 2038 if (sctp_in_scope(&addr, scope))
2041 if (!sctp_assoc_add_peer(asoc, &tmp, gfp, SCTP_UNCONFIRMED)) 2039 if (!sctp_assoc_add_peer(asoc, &addr, gfp, SCTP_UNCONFIRMED))
2042 return 0; 2040 return 0;
2043 break; 2041 break;
2044 2042
@@ -2421,7 +2419,7 @@ static __be16 sctp_process_asconf_param(struct sctp_association *asoc,
2421 union sctp_addr addr; 2419 union sctp_addr addr;
2422 struct list_head *pos; 2420 struct list_head *pos;
2423 union sctp_addr_param *addr_param; 2421 union sctp_addr_param *addr_param;
2424 union sctp_addr tmp, tmp_addr; 2422 union sctp_addr tmp;
2425 2423
2426 addr_param = (union sctp_addr_param *) 2424 addr_param = (union sctp_addr_param *)
2427 ((void *)asconf_param + sizeof(sctp_addip_param_t)); 2425 ((void *)asconf_param + sizeof(sctp_addip_param_t));
@@ -2430,8 +2428,7 @@ static __be16 sctp_process_asconf_param(struct sctp_association *asoc,
2430 if (unlikely(!af)) 2428 if (unlikely(!af))
2431 return SCTP_ERROR_INV_PARAM; 2429 return SCTP_ERROR_INV_PARAM;
2432 2430
2433 af->from_addr_param(&addr, addr_param, asoc->peer.port, 0); 2431 af->from_addr_param(&addr, addr_param, htons(asoc->peer.port), 0);
2434 flip_to_n(&tmp_addr, &addr);
2435 switch (asconf_param->param_hdr.type) { 2432 switch (asconf_param->param_hdr.type) {
2436 case SCTP_PARAM_ADD_IP: 2433 case SCTP_PARAM_ADD_IP:
2437 /* ADDIP 4.3 D9) If an endpoint receives an ADD IP address 2434 /* ADDIP 4.3 D9) If an endpoint receives an ADD IP address
@@ -2441,7 +2438,7 @@ static __be16 sctp_process_asconf_param(struct sctp_association *asoc,
2441 * Due to Resource Shortage'. 2438 * Due to Resource Shortage'.
2442 */ 2439 */
2443 2440
2444 peer = sctp_assoc_add_peer(asoc, &tmp_addr, GFP_ATOMIC, SCTP_UNCONFIRMED); 2441 peer = sctp_assoc_add_peer(asoc, &addr, GFP_ATOMIC, SCTP_UNCONFIRMED);
2445 if (!peer) 2442 if (!peer)
2446 return SCTP_ERROR_RSRC_LOW; 2443 return SCTP_ERROR_RSRC_LOW;
2447 2444
@@ -2467,13 +2464,13 @@ static __be16 sctp_process_asconf_param(struct sctp_association *asoc,
2467 * Delete Source IP Address' 2464 * Delete Source IP Address'
2468 */ 2465 */
2469 flip_to_n(&tmp, sctp_source(asconf)); 2466 flip_to_n(&tmp, sctp_source(asconf));
2470 if (sctp_cmp_addr_exact(&tmp, &tmp_addr)) 2467 if (sctp_cmp_addr_exact(&tmp, &addr))
2471 return SCTP_ERROR_DEL_SRC_IP; 2468 return SCTP_ERROR_DEL_SRC_IP;
2472 2469
2473 sctp_assoc_del_peer(asoc, &tmp_addr); 2470 sctp_assoc_del_peer(asoc, &addr);
2474 break; 2471 break;
2475 case SCTP_PARAM_SET_PRIMARY: 2472 case SCTP_PARAM_SET_PRIMARY:
2476 peer = sctp_assoc_lookup_paddr(asoc, &tmp_addr); 2473 peer = sctp_assoc_lookup_paddr(asoc, &addr);
2477 if (!peer) 2474 if (!peer)
2478 return SCTP_ERROR_INV_PARAM; 2475 return SCTP_ERROR_INV_PARAM;
2479 2476
@@ -2591,15 +2588,13 @@ static int sctp_asconf_param_success(struct sctp_association *asoc,
2591 struct sctp_transport *transport; 2588 struct sctp_transport *transport;
2592 struct sctp_sockaddr_entry *saddr; 2589 struct sctp_sockaddr_entry *saddr;
2593 int retval = 0; 2590 int retval = 0;
2594 union sctp_addr tmp;
2595 2591
2596 addr_param = (union sctp_addr_param *) 2592 addr_param = (union sctp_addr_param *)
2597 ((void *)asconf_param + sizeof(sctp_addip_param_t)); 2593 ((void *)asconf_param + sizeof(sctp_addip_param_t));
2598 2594
2599 /* We have checked the packet before, so we do not check again. */ 2595 /* We have checked the packet before, so we do not check again. */
2600 af = sctp_get_af_specific(param_type2af(addr_param->v4.param_hdr.type)); 2596 af = sctp_get_af_specific(param_type2af(addr_param->v4.param_hdr.type));
2601 af->from_addr_param(&addr, addr_param, bp->port, 0); 2597 af->from_addr_param(&addr, addr_param, htons(bp->port), 0);
2602 flip_to_n(&tmp, &addr);
2603 2598
2604 switch (asconf_param->param_hdr.type) { 2599 switch (asconf_param->param_hdr.type) {
2605 case SCTP_PARAM_ADD_IP: 2600 case SCTP_PARAM_ADD_IP:
@@ -2607,7 +2602,7 @@ static int sctp_asconf_param_success(struct sctp_association *asoc,
2607 sctp_write_lock(&asoc->base.addr_lock); 2602 sctp_write_lock(&asoc->base.addr_lock);
2608 list_for_each(pos, &bp->address_list) { 2603 list_for_each(pos, &bp->address_list) {
2609 saddr = list_entry(pos, struct sctp_sockaddr_entry, list); 2604 saddr = list_entry(pos, struct sctp_sockaddr_entry, list);
2610 if (sctp_cmp_addr_exact(&saddr->a, &tmp)) 2605 if (sctp_cmp_addr_exact(&saddr->a, &addr))
2611 saddr->use_as_src = 1; 2606 saddr->use_as_src = 1;
2612 } 2607 }
2613 sctp_write_unlock(&asoc->base.addr_lock); 2608 sctp_write_unlock(&asoc->base.addr_lock);
@@ -2616,7 +2611,7 @@ static int sctp_asconf_param_success(struct sctp_association *asoc,
2616 case SCTP_PARAM_DEL_IP: 2611 case SCTP_PARAM_DEL_IP:
2617 sctp_local_bh_disable(); 2612 sctp_local_bh_disable();
2618 sctp_write_lock(&asoc->base.addr_lock); 2613 sctp_write_lock(&asoc->base.addr_lock);
2619 retval = sctp_del_bind_addr(bp, &tmp); 2614 retval = sctp_del_bind_addr(bp, &addr);
2620 sctp_write_unlock(&asoc->base.addr_lock); 2615 sctp_write_unlock(&asoc->base.addr_lock);
2621 sctp_local_bh_enable(); 2616 sctp_local_bh_enable();
2622 list_for_each(pos, &asoc->peer.transport_addr_list) { 2617 list_for_each(pos, &asoc->peer.transport_addr_list) {