diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2006-11-20 20:11:13 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-03 00:26:48 -0500 |
commit | dd86d136f9feb72c52a5b07707affe80edbc8dda (patch) | |
tree | 3ca8c38af8d87d76d2ad3fa239a7d9984f327bec /net/sctp/sm_make_chunk.c | |
parent | 5ab7b859ab58e3479a5a66e383ecd6bc447f6c1d (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/sctp/sm_make_chunk.c')
-rw-r--r-- | net/sctp/sm_make_chunk.c | 29 |
1 files changed, 12 insertions, 17 deletions
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) { |