aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2006-11-20 20:09:40 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-03 00:26:44 -0500
commitd55c41b115e74b30a3d1a61db806bd03bdd9dd6f (patch)
tree24591dcdbcd8b3c84599b64e6c01bd5a16974473
parent9b1dfad011d409bc56476a81810342751645ee54 (diff)
[SCTP]: Switch ->from_skb() to net-endian.
All instances switched, callers updated. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/sctp/input.c15
-rw-r--r--net/sctp/ipv6.c6
-rw-r--r--net/sctp/protocol.c6
-rw-r--r--net/sctp/sm_make_chunk.c4
4 files changed, 11 insertions, 20 deletions
diff --git a/net/sctp/input.c b/net/sctp/input.c
index 0e5ac5e42c96..3b4a552c9f18 100644
--- a/net/sctp/input.c
+++ b/net/sctp/input.c
@@ -127,7 +127,6 @@ 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, tmp2;
131 int family; 130 int family;
132 struct sctp_af *af; 131 struct sctp_af *af;
133 132
@@ -179,13 +178,10 @@ int sctp_rcv(struct sk_buff *skb)
179 !af->addr_valid(&dest, NULL, skb)) 178 !af->addr_valid(&dest, NULL, skb))
180 goto discard_it; 179 goto discard_it;
181 180
182 flip_to_n(&tmp, &dest); 181 asoc = __sctp_rcv_lookup(skb, &src, &dest, &transport);
183 flip_to_n(&tmp2, &src);
184
185 asoc = __sctp_rcv_lookup(skb, &tmp2, &tmp, &transport);
186 182
187 if (!asoc) 183 if (!asoc)
188 ep = __sctp_rcv_lookup_endpoint(&tmp); 184 ep = __sctp_rcv_lookup_endpoint(&dest);
189 185
190 /* Retrieve the common input handling substructure. */ 186 /* Retrieve the common input handling substructure. */
191 rcvr = asoc ? &asoc->base : &ep->base; 187 rcvr = asoc ? &asoc->base : &ep->base;
@@ -245,7 +241,7 @@ int sctp_rcv(struct sk_buff *skb)
245 chunk->sctp_hdr = sh; 241 chunk->sctp_hdr = sh;
246 242
247 /* Set the source and destination addresses of the incoming chunk. */ 243 /* Set the source and destination addresses of the incoming chunk. */
248 sctp_init_addrs(chunk, &tmp2, &tmp); 244 sctp_init_addrs(chunk, &src, &dest);
249 245
250 /* Remember where we came from. */ 246 /* Remember where we came from. */
251 chunk->transport = transport; 247 chunk->transport = transport;
@@ -444,7 +440,6 @@ struct sock *sctp_err_lookup(int family, struct sk_buff *skb,
444 struct sock *sk = NULL; 440 struct sock *sk = NULL;
445 struct sctp_association *asoc; 441 struct sctp_association *asoc;
446 struct sctp_transport *transport = NULL; 442 struct sctp_transport *transport = NULL;
447 union sctp_addr tmp, tmp2;
448 443
449 *app = NULL; *tpp = NULL; 444 *app = NULL; *tpp = NULL;
450 445
@@ -456,13 +451,11 @@ struct sock *sctp_err_lookup(int family, struct sk_buff *skb,
456 /* Initialize local addresses for lookups. */ 451 /* Initialize local addresses for lookups. */
457 af->from_skb(&saddr, skb, 1); 452 af->from_skb(&saddr, skb, 1);
458 af->from_skb(&daddr, skb, 0); 453 af->from_skb(&daddr, skb, 0);
459 flip_to_n(&tmp, &saddr);
460 flip_to_n(&tmp2, &daddr);
461 454
462 /* Look for an association that matches the incoming ICMP error 455 /* Look for an association that matches the incoming ICMP error
463 * packet. 456 * packet.
464 */ 457 */
465 asoc = __sctp_lookup_association(&tmp, &tmp2, &transport); 458 asoc = __sctp_lookup_association(&saddr, &daddr, &transport);
466 if (!asoc) 459 if (!asoc)
467 return NULL; 460 return NULL;
468 461
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index 6139d1d964eb..d6b585b85cbb 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -351,7 +351,7 @@ static void sctp_v6_from_skb(union sctp_addr *addr,struct sk_buff *skb,
351 int is_saddr) 351 int is_saddr)
352{ 352{
353 void *from; 353 void *from;
354 __u16 *port; 354 __be16 *port;
355 struct sctphdr *sh; 355 struct sctphdr *sh;
356 356
357 port = &addr->v6.sin6_port; 357 port = &addr->v6.sin6_port;
@@ -361,10 +361,10 @@ static void sctp_v6_from_skb(union sctp_addr *addr,struct sk_buff *skb,
361 361
362 sh = (struct sctphdr *) skb->h.raw; 362 sh = (struct sctphdr *) skb->h.raw;
363 if (is_saddr) { 363 if (is_saddr) {
364 *port = ntohs(sh->source); 364 *port = sh->source;
365 from = &skb->nh.ipv6h->saddr; 365 from = &skb->nh.ipv6h->saddr;
366 } else { 366 } else {
367 *port = ntohs(sh->dest); 367 *port = sh->dest;
368 from = &skb->nh.ipv6h->daddr; 368 from = &skb->nh.ipv6h->daddr;
369 } 369 }
370 ipv6_addr_copy(&addr->v6.sin6_addr, from); 370 ipv6_addr_copy(&addr->v6.sin6_addr, from);
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index d1fbd1f5c6d1..d08bafd4439e 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -252,7 +252,7 @@ static void sctp_v4_from_skb(union sctp_addr *addr, struct sk_buff *skb,
252 int is_saddr) 252 int is_saddr)
253{ 253{
254 void *from; 254 void *from;
255 __u16 *port; 255 __be16 *port;
256 struct sctphdr *sh; 256 struct sctphdr *sh;
257 257
258 port = &addr->v4.sin_port; 258 port = &addr->v4.sin_port;
@@ -260,10 +260,10 @@ static void sctp_v4_from_skb(union sctp_addr *addr, struct sk_buff *skb,
260 260
261 sh = (struct sctphdr *) skb->h.raw; 261 sh = (struct sctphdr *) skb->h.raw;
262 if (is_saddr) { 262 if (is_saddr) {
263 *port = ntohs(sh->source); 263 *port = sh->source;
264 from = &skb->nh.iph->saddr; 264 from = &skb->nh.iph->saddr;
265 } else { 265 } else {
266 *port = ntohs(sh->dest); 266 *port = sh->dest;
267 from = &skb->nh.iph->daddr; 267 from = &skb->nh.iph->daddr;
268 } 268 }
269 memcpy(&addr->v4.sin_addr.s_addr, from, sizeof(struct in_addr)); 269 memcpy(&addr->v4.sin_addr.s_addr, from, sizeof(struct in_addr));
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 59536368f79a..632a1159610e 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -1227,7 +1227,6 @@ struct sctp_association *sctp_make_temp_asoc(const struct sctp_endpoint *ep,
1227 struct sk_buff *skb; 1227 struct sk_buff *skb;
1228 sctp_scope_t scope; 1228 sctp_scope_t scope;
1229 struct sctp_af *af; 1229 struct sctp_af *af;
1230 union sctp_addr tmp;
1231 1230
1232 /* Create the bare association. */ 1231 /* Create the bare association. */
1233 scope = sctp_scope(sctp_source(chunk)); 1232 scope = sctp_scope(sctp_source(chunk));
@@ -1240,8 +1239,7 @@ struct sctp_association *sctp_make_temp_asoc(const struct sctp_endpoint *ep,
1240 af = sctp_get_af_specific(ipver2af(skb->nh.iph->version)); 1239 af = sctp_get_af_specific(ipver2af(skb->nh.iph->version));
1241 if (unlikely(!af)) 1240 if (unlikely(!af))
1242 goto fail; 1241 goto fail;
1243 af->from_skb(&tmp, skb, 1); 1242 af->from_skb(&asoc->c.peer_addr, skb, 1);
1244 flip_to_n(&asoc->c.peer_addr, &tmp);
1245nodata: 1243nodata:
1246 return asoc; 1244 return asoc;
1247 1245