aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp/protocol.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sctp/protocol.c')
-rw-r--r--net/sctp/protocol.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index 5b4f82fd98f8..11f3b549f4a4 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -251,7 +251,7 @@ static void sctp_v4_from_skb(union sctp_addr *addr, struct sk_buff *skb,
251 int is_saddr) 251 int is_saddr)
252{ 252{
253 void *from; 253 void *from;
254 __u16 *port; 254 __be16 *port;
255 struct sctphdr *sh; 255 struct sctphdr *sh;
256 256
257 port = &addr->v4.sin_port; 257 port = &addr->v4.sin_port;
@@ -259,10 +259,10 @@ static void sctp_v4_from_skb(union sctp_addr *addr, struct sk_buff *skb,
259 259
260 sh = (struct sctphdr *) skb->h.raw; 260 sh = (struct sctphdr *) skb->h.raw;
261 if (is_saddr) { 261 if (is_saddr) {
262 *port = ntohs(sh->source); 262 *port = sh->source;
263 from = &skb->nh.iph->saddr; 263 from = &skb->nh.iph->saddr;
264 } else { 264 } else {
265 *port = ntohs(sh->dest); 265 *port = sh->dest;
266 from = &skb->nh.iph->daddr; 266 from = &skb->nh.iph->daddr;
267 } 267 }
268 memcpy(&addr->v4.sin_addr.s_addr, from, sizeof(struct in_addr)); 268 memcpy(&addr->v4.sin_addr.s_addr, from, sizeof(struct in_addr));
@@ -272,7 +272,7 @@ static void sctp_v4_from_skb(union sctp_addr *addr, struct sk_buff *skb,
272static void sctp_v4_from_sk(union sctp_addr *addr, struct sock *sk) 272static void sctp_v4_from_sk(union sctp_addr *addr, struct sock *sk)
273{ 273{
274 addr->v4.sin_family = AF_INET; 274 addr->v4.sin_family = AF_INET;
275 addr->v4.sin_port = inet_sk(sk)->num; 275 addr->v4.sin_port = 0;
276 addr->v4.sin_addr.s_addr = inet_sk(sk)->rcv_saddr; 276 addr->v4.sin_addr.s_addr = inet_sk(sk)->rcv_saddr;
277} 277}
278 278
@@ -291,7 +291,7 @@ static void sctp_v4_to_sk_daddr(union sctp_addr *addr, struct sock *sk)
291/* Initialize a sctp_addr from an address parameter. */ 291/* Initialize a sctp_addr from an address parameter. */
292static void sctp_v4_from_addr_param(union sctp_addr *addr, 292static void sctp_v4_from_addr_param(union sctp_addr *addr,
293 union sctp_addr_param *param, 293 union sctp_addr_param *param,
294 __u16 port, int iif) 294 __be16 port, int iif)
295{ 295{
296 addr->v4.sin_family = AF_INET; 296 addr->v4.sin_family = AF_INET;
297 addr->v4.sin_port = port; 297 addr->v4.sin_port = port;
@@ -307,7 +307,7 @@ static int sctp_v4_to_addr_param(const union sctp_addr *addr,
307 int length = sizeof(sctp_ipv4addr_param_t); 307 int length = sizeof(sctp_ipv4addr_param_t);
308 308
309 param->v4.param_hdr.type = SCTP_PARAM_IPV4_ADDRESS; 309 param->v4.param_hdr.type = SCTP_PARAM_IPV4_ADDRESS;
310 param->v4.param_hdr.length = ntohs(length); 310 param->v4.param_hdr.length = htons(length);
311 param->v4.addr.s_addr = addr->v4.sin_addr.s_addr; 311 param->v4.addr.s_addr = addr->v4.sin_addr.s_addr;
312 312
313 return length; 313 return length;
@@ -315,7 +315,7 @@ static int sctp_v4_to_addr_param(const union sctp_addr *addr,
315 315
316/* Initialize a sctp_addr from a dst_entry. */ 316/* Initialize a sctp_addr from a dst_entry. */
317static void sctp_v4_dst_saddr(union sctp_addr *saddr, struct dst_entry *dst, 317static void sctp_v4_dst_saddr(union sctp_addr *saddr, struct dst_entry *dst,
318 unsigned short port) 318 __be16 port)
319{ 319{
320 struct rtable *rt = (struct rtable *)dst; 320 struct rtable *rt = (struct rtable *)dst;
321 saddr->v4.sin_family = AF_INET; 321 saddr->v4.sin_family = AF_INET;
@@ -338,7 +338,7 @@ static int sctp_v4_cmp_addr(const union sctp_addr *addr1,
338} 338}
339 339
340/* Initialize addr struct to INADDR_ANY. */ 340/* Initialize addr struct to INADDR_ANY. */
341static void sctp_v4_inaddr_any(union sctp_addr *addr, unsigned short port) 341static void sctp_v4_inaddr_any(union sctp_addr *addr, __be16 port)
342{ 342{
343 addr->v4.sin_family = AF_INET; 343 addr->v4.sin_family = AF_INET;
344 addr->v4.sin_addr.s_addr = INADDR_ANY; 344 addr->v4.sin_addr.s_addr = INADDR_ANY;
@@ -481,7 +481,7 @@ static struct dst_entry *sctp_v4_get_dst(struct sctp_association *asoc,
481 list); 481 list);
482 if (!laddr->use_as_src) 482 if (!laddr->use_as_src)
483 continue; 483 continue;
484 sctp_v4_dst_saddr(&dst_saddr, dst, bp->port); 484 sctp_v4_dst_saddr(&dst_saddr, dst, htons(bp->port));
485 if (sctp_v4_cmp_addr(&dst_saddr, &laddr->a)) 485 if (sctp_v4_cmp_addr(&dst_saddr, &laddr->a))
486 goto out_unlock; 486 goto out_unlock;
487 } 487 }
@@ -538,7 +538,7 @@ static void sctp_v4_get_saddr(struct sctp_association *asoc,
538 538
539 if (rt) { 539 if (rt) {
540 saddr->v4.sin_family = AF_INET; 540 saddr->v4.sin_family = AF_INET;
541 saddr->v4.sin_port = asoc->base.bind_addr.port; 541 saddr->v4.sin_port = htons(asoc->base.bind_addr.port);
542 saddr->v4.sin_addr.s_addr = rt->rt_src; 542 saddr->v4.sin_addr.s_addr = rt->rt_src;
543 } 543 }
544} 544}
@@ -791,7 +791,7 @@ static int sctp_inet_send_verify(struct sctp_sock *opt, union sctp_addr *addr)
791 * chunks. Returns number of addresses supported. 791 * chunks. Returns number of addresses supported.
792 */ 792 */
793static int sctp_inet_supported_addrs(const struct sctp_sock *opt, 793static int sctp_inet_supported_addrs(const struct sctp_sock *opt,
794 __u16 *types) 794 __be16 *types)
795{ 795{
796 types[0] = SCTP_PARAM_IPV4_ADDRESS; 796 types[0] = SCTP_PARAM_IPV4_ADDRESS;
797 return 1; 797 return 1;
@@ -808,7 +808,7 @@ static inline int sctp_v4_xmit(struct sk_buff *skb,
808 NIPQUAD(((struct rtable *)skb->dst)->rt_dst)); 808 NIPQUAD(((struct rtable *)skb->dst)->rt_dst));
809 809
810 SCTP_INC_STATS(SCTP_MIB_OUTSCTPPACKS); 810 SCTP_INC_STATS(SCTP_MIB_OUTSCTPPACKS);
811 return ip_queue_xmit(skb, ipfragok); 811 return ip_queue_xmit(skb, skb->sk, ipfragok);
812} 812}
813 813
814static struct sctp_af sctp_ipv4_specific; 814static struct sctp_af sctp_ipv4_specific;