diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2006-11-20 20:12:25 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-03 00:26:51 -0500 |
commit | 6a1e5f335461567f593e88b218f1c06817cbd323 (patch) | |
tree | 4cba2ea0f04c53d3f695bee61f164570a88633c9 /net/sctp | |
parent | 02a8a4db3b38ad2dd8bcfcca41694e043e44d282 (diff) |
[SCTP]: sctp_process_init() and sctp_source() switched to net-endian.
both are done in one go since almost always we have result of
the latter immediately passed to the former. Possibly non-obvious
note: sctp_process_param() is endian-agnostic
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/endpointola.c | 4 | ||||
-rw-r--r-- | net/sctp/sm_make_chunk.c | 12 | ||||
-rw-r--r-- | net/sctp/sm_statefuns.c | 8 |
3 files changed, 7 insertions, 17 deletions
diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c index 4cca7792c961..33a42e90c32f 100644 --- a/net/sctp/endpointola.c +++ b/net/sctp/endpointola.c | |||
@@ -346,10 +346,8 @@ static void sctp_endpoint_bh_rcv(struct sctp_endpoint *ep) | |||
346 | * COOKIE-ECHO chunk. | 346 | * COOKIE-ECHO chunk. |
347 | */ | 347 | */ |
348 | if (NULL == chunk->asoc) { | 348 | if (NULL == chunk->asoc) { |
349 | union sctp_addr tmp; | ||
350 | flip_to_n(&tmp, sctp_source(chunk)); | ||
351 | asoc = sctp_endpoint_lookup_assoc(ep, | 349 | asoc = sctp_endpoint_lookup_assoc(ep, |
352 | &tmp, | 350 | sctp_source(chunk), |
353 | &transport); | 351 | &transport); |
354 | chunk->asoc = asoc; | 352 | chunk->asoc = asoc; |
355 | chunk->transport = transport; | 353 | chunk->transport = transport; |
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index b367ad59ed4a..44ddec90995e 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c | |||
@@ -1041,10 +1041,10 @@ const union sctp_addr *sctp_source(const struct sctp_chunk *chunk) | |||
1041 | { | 1041 | { |
1042 | /* If we have a known transport, use that. */ | 1042 | /* If we have a known transport, use that. */ |
1043 | if (chunk->transport) { | 1043 | if (chunk->transport) { |
1044 | return &chunk->transport->ipaddr_h; | 1044 | return &chunk->transport->ipaddr; |
1045 | } else { | 1045 | } else { |
1046 | /* Otherwise, extract it from the IP header. */ | 1046 | /* Otherwise, extract it from the IP header. */ |
1047 | return &chunk->source_h; | 1047 | return &chunk->source; |
1048 | } | 1048 | } |
1049 | } | 1049 | } |
1050 | 1050 | ||
@@ -1844,7 +1844,6 @@ int sctp_process_init(struct sctp_association *asoc, sctp_cid_t cid, | |||
1844 | struct sctp_transport *transport; | 1844 | struct sctp_transport *transport; |
1845 | struct list_head *pos, *temp; | 1845 | struct list_head *pos, *temp; |
1846 | char *cookie; | 1846 | char *cookie; |
1847 | union sctp_addr tmp; | ||
1848 | 1847 | ||
1849 | /* We must include the address that the INIT packet came from. | 1848 | /* We must include the address that the INIT packet came from. |
1850 | * This is the only address that matters for an INIT packet. | 1849 | * This is the only address that matters for an INIT packet. |
@@ -1857,8 +1856,7 @@ int sctp_process_init(struct sctp_association *asoc, sctp_cid_t cid, | |||
1857 | * be a a better choice than any of the embedded addresses. | 1856 | * be a a better choice than any of the embedded addresses. |
1858 | */ | 1857 | */ |
1859 | if (peer_addr) { | 1858 | if (peer_addr) { |
1860 | flip_to_n(&tmp, peer_addr); | 1859 | if(!sctp_assoc_add_peer(asoc, peer_addr, gfp, SCTP_ACTIVE)) |
1861 | if(!sctp_assoc_add_peer(asoc, &tmp, gfp, SCTP_ACTIVE)) | ||
1862 | goto nomem; | 1860 | goto nomem; |
1863 | } | 1861 | } |
1864 | 1862 | ||
@@ -2419,7 +2417,6 @@ static __be16 sctp_process_asconf_param(struct sctp_association *asoc, | |||
2419 | union sctp_addr addr; | 2417 | union sctp_addr addr; |
2420 | struct list_head *pos; | 2418 | struct list_head *pos; |
2421 | union sctp_addr_param *addr_param; | 2419 | union sctp_addr_param *addr_param; |
2422 | union sctp_addr tmp; | ||
2423 | 2420 | ||
2424 | addr_param = (union sctp_addr_param *) | 2421 | addr_param = (union sctp_addr_param *) |
2425 | ((void *)asconf_param + sizeof(sctp_addip_param_t)); | 2422 | ((void *)asconf_param + sizeof(sctp_addip_param_t)); |
@@ -2463,8 +2460,7 @@ static __be16 sctp_process_asconf_param(struct sctp_association *asoc, | |||
2463 | * an Error Cause TLV set to the new error code 'Request to | 2460 | * an Error Cause TLV set to the new error code 'Request to |
2464 | * Delete Source IP Address' | 2461 | * Delete Source IP Address' |
2465 | */ | 2462 | */ |
2466 | flip_to_n(&tmp, sctp_source(asconf)); | 2463 | if (sctp_cmp_addr_exact(sctp_source(asconf), &addr)) |
2467 | if (sctp_cmp_addr_exact(&tmp, &addr)) | ||
2468 | return SCTP_ERROR_DEL_SRC_IP; | 2464 | return SCTP_ERROR_DEL_SRC_IP; |
2469 | 2465 | ||
2470 | sctp_assoc_del_peer(asoc, &addr); | 2466 | sctp_assoc_del_peer(asoc, &addr); |
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c index c5362638d672..0848309773a5 100644 --- a/net/sctp/sm_statefuns.c +++ b/net/sctp/sm_statefuns.c | |||
@@ -598,7 +598,6 @@ sctp_disposition_t sctp_sf_do_5_1D_ce(const struct sctp_endpoint *ep, | |||
598 | struct sctp_ulpevent *ev, *ai_ev = NULL; | 598 | struct sctp_ulpevent *ev, *ai_ev = NULL; |
599 | int error = 0; | 599 | int error = 0; |
600 | struct sctp_chunk *err_chk_p; | 600 | struct sctp_chunk *err_chk_p; |
601 | union sctp_addr tmp; | ||
602 | 601 | ||
603 | /* If the packet is an OOTB packet which is temporarily on the | 602 | /* If the packet is an OOTB packet which is temporarily on the |
604 | * control endpoint, respond with an ABORT. | 603 | * control endpoint, respond with an ABORT. |
@@ -666,9 +665,8 @@ sctp_disposition_t sctp_sf_do_5_1D_ce(const struct sctp_endpoint *ep, | |||
666 | */ | 665 | */ |
667 | peer_init = &chunk->subh.cookie_hdr->c.peer_init[0]; | 666 | peer_init = &chunk->subh.cookie_hdr->c.peer_init[0]; |
668 | 667 | ||
669 | flip_to_h(&tmp, &chunk->subh.cookie_hdr->c.peer_addr); | ||
670 | if (!sctp_process_init(new_asoc, chunk->chunk_hdr->type, | 668 | if (!sctp_process_init(new_asoc, chunk->chunk_hdr->type, |
671 | &tmp, | 669 | &chunk->subh.cookie_hdr->c.peer_addr, |
672 | peer_init, GFP_ATOMIC)) | 670 | peer_init, GFP_ATOMIC)) |
673 | goto nomem_init; | 671 | goto nomem_init; |
674 | 672 | ||
@@ -5105,7 +5103,6 @@ static struct sctp_packet *sctp_ootb_pkt_new(const struct sctp_association *asoc | |||
5105 | __u16 sport; | 5103 | __u16 sport; |
5106 | __u16 dport; | 5104 | __u16 dport; |
5107 | __u32 vtag; | 5105 | __u32 vtag; |
5108 | union sctp_addr tmp; | ||
5109 | 5106 | ||
5110 | /* Get the source and destination port from the inbound packet. */ | 5107 | /* Get the source and destination port from the inbound packet. */ |
5111 | sport = ntohs(chunk->sctp_hdr->dest); | 5108 | sport = ntohs(chunk->sctp_hdr->dest); |
@@ -5136,8 +5133,7 @@ static struct sctp_packet *sctp_ootb_pkt_new(const struct sctp_association *asoc | |||
5136 | } | 5133 | } |
5137 | 5134 | ||
5138 | /* Make a transport for the bucket, Eliza... */ | 5135 | /* Make a transport for the bucket, Eliza... */ |
5139 | flip_to_n(&tmp, sctp_source(chunk)); | 5136 | transport = sctp_transport_new(sctp_source(chunk), GFP_ATOMIC); |
5140 | transport = sctp_transport_new(&tmp, GFP_ATOMIC); | ||
5141 | if (!transport) | 5137 | if (!transport) |
5142 | goto nomem; | 5138 | goto nomem; |
5143 | 5139 | ||