diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2006-11-20 20:08:41 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-03 00:26:41 -0500 |
commit | e2fccedb0136205d02e97a41851503e2b96d2a17 (patch) | |
tree | 053ce92764dfac3e71d3a21786eff2b79a74cb72 /net/sctp/input.c | |
parent | 1c7d1fc14974f44809b22521bd9796411d8ba440 (diff) |
[SCTP]: Switch sctp_assoc_is_match to net-endian.
Along with it, statics in input.c that end up calling it
(__sctp_lookup_association, sctp_lookup_association,
__sctp_rcv_init_lookup, __sctp_rcv_lookup). Callers
are adjusted.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp/input.c')
-rw-r--r-- | net/sctp/input.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/net/sctp/input.c b/net/sctp/input.c index 1bb3f264da1f..85b3441c4a23 100644 --- a/net/sctp/input.c +++ b/net/sctp/input.c | |||
@@ -127,7 +127,7 @@ int sctp_rcv(struct sk_buff *skb) | |||
127 | struct sctphdr *sh; | 127 | struct sctphdr *sh; |
128 | union sctp_addr src; | 128 | union sctp_addr src; |
129 | union sctp_addr dest; | 129 | union sctp_addr dest; |
130 | union sctp_addr tmp; | 130 | union sctp_addr tmp, tmp2; |
131 | int family; | 131 | int family; |
132 | struct sctp_af *af; | 132 | struct sctp_af *af; |
133 | 133 | ||
@@ -179,9 +179,10 @@ int sctp_rcv(struct sk_buff *skb) | |||
179 | !af->addr_valid(&dest, NULL, skb)) | 179 | !af->addr_valid(&dest, NULL, skb)) |
180 | goto discard_it; | 180 | goto discard_it; |
181 | 181 | ||
182 | asoc = __sctp_rcv_lookup(skb, &src, &dest, &transport); | ||
183 | |||
184 | flip_to_n(&tmp, &dest); | 182 | flip_to_n(&tmp, &dest); |
183 | flip_to_n(&tmp2, &src); | ||
184 | |||
185 | asoc = __sctp_rcv_lookup(skb, &tmp2, &tmp, &transport); | ||
185 | 186 | ||
186 | if (!asoc) | 187 | if (!asoc) |
187 | ep = __sctp_rcv_lookup_endpoint(&tmp); | 188 | ep = __sctp_rcv_lookup_endpoint(&tmp); |
@@ -443,6 +444,7 @@ struct sock *sctp_err_lookup(int family, struct sk_buff *skb, | |||
443 | struct sock *sk = NULL; | 444 | struct sock *sk = NULL; |
444 | struct sctp_association *asoc; | 445 | struct sctp_association *asoc; |
445 | struct sctp_transport *transport = NULL; | 446 | struct sctp_transport *transport = NULL; |
447 | union sctp_addr tmp, tmp2; | ||
446 | 448 | ||
447 | *app = NULL; *tpp = NULL; | 449 | *app = NULL; *tpp = NULL; |
448 | 450 | ||
@@ -454,11 +456,13 @@ struct sock *sctp_err_lookup(int family, struct sk_buff *skb, | |||
454 | /* Initialize local addresses for lookups. */ | 456 | /* Initialize local addresses for lookups. */ |
455 | af->from_skb(&saddr, skb, 1); | 457 | af->from_skb(&saddr, skb, 1); |
456 | af->from_skb(&daddr, skb, 0); | 458 | af->from_skb(&daddr, skb, 0); |
459 | flip_to_n(&tmp, &saddr); | ||
460 | flip_to_n(&tmp2, &daddr); | ||
457 | 461 | ||
458 | /* Look for an association that matches the incoming ICMP error | 462 | /* Look for an association that matches the incoming ICMP error |
459 | * packet. | 463 | * packet. |
460 | */ | 464 | */ |
461 | asoc = __sctp_lookup_association(&saddr, &daddr, &transport); | 465 | asoc = __sctp_lookup_association(&tmp, &tmp2, &transport); |
462 | if (!asoc) | 466 | if (!asoc) |
463 | return NULL; | 467 | return NULL; |
464 | 468 | ||
@@ -833,7 +837,7 @@ static struct sctp_association *__sctp_lookup_association( | |||
833 | /* Optimize here for direct hit, only listening connections can | 837 | /* Optimize here for direct hit, only listening connections can |
834 | * have wildcards anyways. | 838 | * have wildcards anyways. |
835 | */ | 839 | */ |
836 | hash = sctp_assoc_hashfn(local->v4.sin_port, peer->v4.sin_port); | 840 | hash = sctp_assoc_hashfn(ntohs(local->v4.sin_port), ntohs(peer->v4.sin_port)); |
837 | head = &sctp_assoc_hashtable[hash]; | 841 | head = &sctp_assoc_hashtable[hash]; |
838 | read_lock(&head->lock); | 842 | read_lock(&head->lock); |
839 | for (epb = head->chain; epb; epb = epb->next) { | 843 | for (epb = head->chain; epb; epb = epb->next) { |
@@ -875,8 +879,11 @@ int sctp_has_association(const union sctp_addr *laddr, | |||
875 | { | 879 | { |
876 | struct sctp_association *asoc; | 880 | struct sctp_association *asoc; |
877 | struct sctp_transport *transport; | 881 | struct sctp_transport *transport; |
882 | union sctp_addr tmp, tmp2; | ||
883 | flip_to_n(&tmp, laddr); | ||
884 | flip_to_n(&tmp2, paddr); | ||
878 | 885 | ||
879 | if ((asoc = sctp_lookup_association(laddr, paddr, &transport))) { | 886 | if ((asoc = sctp_lookup_association(&tmp, &tmp2, &transport))) { |
880 | sctp_association_put(asoc); | 887 | sctp_association_put(asoc); |
881 | return 1; | 888 | return 1; |
882 | } | 889 | } |
@@ -914,6 +921,7 @@ static struct sctp_association *__sctp_rcv_init_lookup(struct sk_buff *skb, | |||
914 | sctp_init_chunk_t *init; | 921 | sctp_init_chunk_t *init; |
915 | struct sctp_transport *transport; | 922 | struct sctp_transport *transport; |
916 | struct sctp_af *af; | 923 | struct sctp_af *af; |
924 | union sctp_addr tmp2; | ||
917 | 925 | ||
918 | ch = (sctp_chunkhdr_t *) skb->data; | 926 | ch = (sctp_chunkhdr_t *) skb->data; |
919 | 927 | ||
@@ -961,8 +969,9 @@ static struct sctp_association *__sctp_rcv_init_lookup(struct sk_buff *skb, | |||
961 | continue; | 969 | continue; |
962 | 970 | ||
963 | af->from_addr_param(paddr, params.addr, ntohs(sh->source), 0); | 971 | af->from_addr_param(paddr, params.addr, ntohs(sh->source), 0); |
972 | flip_to_n(&tmp2, paddr); | ||
964 | 973 | ||
965 | asoc = __sctp_lookup_association(laddr, paddr, &transport); | 974 | asoc = __sctp_lookup_association(laddr, &tmp2, &transport); |
966 | if (asoc) | 975 | if (asoc) |
967 | return asoc; | 976 | return asoc; |
968 | } | 977 | } |