aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2006-11-20 20:08:41 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-03 00:26:41 -0500
commite2fccedb0136205d02e97a41851503e2b96d2a17 (patch)
tree053ce92764dfac3e71d3a21786eff2b79a74cb72 /net/sctp
parent1c7d1fc14974f44809b22521bd9796411d8ba440 (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')
-rw-r--r--net/sctp/associola.c11
-rw-r--r--net/sctp/input.c23
2 files changed, 20 insertions, 14 deletions
diff --git a/net/sctp/associola.c b/net/sctp/associola.c
index 3be8b6081a15..4bd916c808c1 100644
--- a/net/sctp/associola.c
+++ b/net/sctp/associola.c
@@ -927,19 +927,16 @@ struct sctp_transport *sctp_assoc_is_match(struct sctp_association *asoc,
927 const union sctp_addr *paddr) 927 const union sctp_addr *paddr)
928{ 928{
929 struct sctp_transport *transport; 929 struct sctp_transport *transport;
930 union sctp_addr tmp, tmp2;
931 flip_to_n(&tmp, laddr);
932 flip_to_n(&tmp2, paddr);
933 930
934 sctp_read_lock(&asoc->base.addr_lock); 931 sctp_read_lock(&asoc->base.addr_lock);
935 932
936 if ((asoc->base.bind_addr.port == laddr->v4.sin_port) && 933 if ((htons(asoc->base.bind_addr.port) == laddr->v4.sin_port) &&
937 (asoc->peer.port == paddr->v4.sin_port)) { 934 (htons(asoc->peer.port) == paddr->v4.sin_port)) {
938 transport = sctp_assoc_lookup_paddr(asoc, &tmp2); 935 transport = sctp_assoc_lookup_paddr(asoc, paddr);
939 if (!transport) 936 if (!transport)
940 goto out; 937 goto out;
941 938
942 if (sctp_bind_addr_match(&asoc->base.bind_addr, &tmp, 939 if (sctp_bind_addr_match(&asoc->base.bind_addr, laddr,
943 sctp_sk(asoc->base.sk))) 940 sctp_sk(asoc->base.sk)))
944 goto out; 941 goto out;
945 } 942 }
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 }