aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp/ipv6.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sctp/ipv6.c')
-rw-r--r--net/sctp/ipv6.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index 78071c6e6cf1..3c3e560087ca 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -84,7 +84,7 @@ static struct notifier_block sctp_inet6addr_notifier = {
84 84
85/* ICMP error handler. */ 85/* ICMP error handler. */
86SCTP_STATIC void sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, 86SCTP_STATIC void sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
87 int type, int code, int offset, __u32 info) 87 int type, int code, int offset, __be32 info)
88{ 88{
89 struct inet6_dev *idev; 89 struct inet6_dev *idev;
90 struct ipv6hdr *iph = (struct ipv6hdr *)skb->data; 90 struct ipv6hdr *iph = (struct ipv6hdr *)skb->data;
@@ -170,8 +170,6 @@ static int sctp_v6_xmit(struct sk_buff *skb, struct sctp_transport *transport,
170 fl.oif = transport->saddr.v6.sin6_scope_id; 170 fl.oif = transport->saddr.v6.sin6_scope_id;
171 else 171 else
172 fl.oif = sk->sk_bound_dev_if; 172 fl.oif = sk->sk_bound_dev_if;
173 fl.fl_ip_sport = inet_sk(sk)->sport;
174 fl.fl_ip_dport = transport->ipaddr.v6.sin6_port;
175 173
176 if (np->opt && np->opt->srcrt) { 174 if (np->opt && np->opt->srcrt) {
177 struct rt0_hdr *rt0 = (struct rt0_hdr *) np->opt->srcrt; 175 struct rt0_hdr *rt0 = (struct rt0_hdr *) np->opt->srcrt;
@@ -239,7 +237,7 @@ static inline int sctp_v6_addr_match_len(union sctp_addr *s1,
239 int i, j; 237 int i, j;
240 238
241 for (i = 0; i < 4 ; i++) { 239 for (i = 0; i < 4 ; i++) {
242 __u32 a1xora2; 240 __be32 a1xora2;
243 241
244 a1xora2 = a1->s6_addr32[i] ^ a2->s6_addr32[i]; 242 a1xora2 = a1->s6_addr32[i] ^ a2->s6_addr32[i];
245 243
@@ -350,7 +348,7 @@ static void sctp_v6_from_skb(union sctp_addr *addr,struct sk_buff *skb,
350 int is_saddr) 348 int is_saddr)
351{ 349{
352 void *from; 350 void *from;
353 __u16 *port; 351 __be16 *port;
354 struct sctphdr *sh; 352 struct sctphdr *sh;
355 353
356 port = &addr->v6.sin6_port; 354 port = &addr->v6.sin6_port;
@@ -360,10 +358,10 @@ static void sctp_v6_from_skb(union sctp_addr *addr,struct sk_buff *skb,
360 358
361 sh = (struct sctphdr *) skb->h.raw; 359 sh = (struct sctphdr *) skb->h.raw;
362 if (is_saddr) { 360 if (is_saddr) {
363 *port = ntohs(sh->source); 361 *port = sh->source;
364 from = &skb->nh.ipv6h->saddr; 362 from = &skb->nh.ipv6h->saddr;
365 } else { 363 } else {
366 *port = ntohs(sh->dest); 364 *port = sh->dest;
367 from = &skb->nh.ipv6h->daddr; 365 from = &skb->nh.ipv6h->daddr;
368 } 366 }
369 ipv6_addr_copy(&addr->v6.sin6_addr, from); 367 ipv6_addr_copy(&addr->v6.sin6_addr, from);
@@ -373,7 +371,7 @@ static void sctp_v6_from_skb(union sctp_addr *addr,struct sk_buff *skb,
373static void sctp_v6_from_sk(union sctp_addr *addr, struct sock *sk) 371static void sctp_v6_from_sk(union sctp_addr *addr, struct sock *sk)
374{ 372{
375 addr->v6.sin6_family = AF_INET6; 373 addr->v6.sin6_family = AF_INET6;
376 addr->v6.sin6_port = inet_sk(sk)->num; 374 addr->v6.sin6_port = 0;
377 addr->v6.sin6_addr = inet6_sk(sk)->rcv_saddr; 375 addr->v6.sin6_addr = inet6_sk(sk)->rcv_saddr;
378} 376}
379 377
@@ -407,7 +405,7 @@ static void sctp_v6_to_sk_daddr(union sctp_addr *addr, struct sock *sk)
407/* Initialize a sctp_addr from an address parameter. */ 405/* Initialize a sctp_addr from an address parameter. */
408static void sctp_v6_from_addr_param(union sctp_addr *addr, 406static void sctp_v6_from_addr_param(union sctp_addr *addr,
409 union sctp_addr_param *param, 407 union sctp_addr_param *param,
410 __u16 port, int iif) 408 __be16 port, int iif)
411{ 409{
412 addr->v6.sin6_family = AF_INET6; 410 addr->v6.sin6_family = AF_INET6;
413 addr->v6.sin6_port = port; 411 addr->v6.sin6_port = port;
@@ -425,7 +423,7 @@ static int sctp_v6_to_addr_param(const union sctp_addr *addr,
425 int length = sizeof(sctp_ipv6addr_param_t); 423 int length = sizeof(sctp_ipv6addr_param_t);
426 424
427 param->v6.param_hdr.type = SCTP_PARAM_IPV6_ADDRESS; 425 param->v6.param_hdr.type = SCTP_PARAM_IPV6_ADDRESS;
428 param->v6.param_hdr.length = ntohs(length); 426 param->v6.param_hdr.length = htons(length);
429 ipv6_addr_copy(&param->v6.addr, &addr->v6.sin6_addr); 427 ipv6_addr_copy(&param->v6.addr, &addr->v6.sin6_addr);
430 428
431 return length; 429 return length;
@@ -433,7 +431,7 @@ static int sctp_v6_to_addr_param(const union sctp_addr *addr,
433 431
434/* Initialize a sctp_addr from a dst_entry. */ 432/* Initialize a sctp_addr from a dst_entry. */
435static void sctp_v6_dst_saddr(union sctp_addr *addr, struct dst_entry *dst, 433static void sctp_v6_dst_saddr(union sctp_addr *addr, struct dst_entry *dst,
436 unsigned short port) 434 __be16 port)
437{ 435{
438 struct rt6_info *rt = (struct rt6_info *)dst; 436 struct rt6_info *rt = (struct rt6_info *)dst;
439 addr->sa.sa_family = AF_INET6; 437 addr->sa.sa_family = AF_INET6;
@@ -480,7 +478,7 @@ static int sctp_v6_cmp_addr(const union sctp_addr *addr1,
480} 478}
481 479
482/* Initialize addr struct to INADDR_ANY. */ 480/* Initialize addr struct to INADDR_ANY. */
483static void sctp_v6_inaddr_any(union sctp_addr *addr, unsigned short port) 481static void sctp_v6_inaddr_any(union sctp_addr *addr, __be16 port)
484{ 482{
485 memset(addr, 0x00, sizeof(union sctp_addr)); 483 memset(addr, 0x00, sizeof(union sctp_addr));
486 addr->v6.sin6_family = AF_INET6; 484 addr->v6.sin6_family = AF_INET6;
@@ -855,7 +853,7 @@ static int sctp_inet6_send_verify(struct sctp_sock *opt, union sctp_addr *addr)
855 * Returns number of addresses supported. 853 * Returns number of addresses supported.
856 */ 854 */
857static int sctp_inet6_supported_addrs(const struct sctp_sock *opt, 855static int sctp_inet6_supported_addrs(const struct sctp_sock *opt,
858 __u16 *types) 856 __be16 *types)
859{ 857{
860 types[0] = SCTP_PARAM_IPV4_ADDRESS; 858 types[0] = SCTP_PARAM_IPV4_ADDRESS;
861 types[1] = SCTP_PARAM_IPV6_ADDRESS; 859 types[1] = SCTP_PARAM_IPV6_ADDRESS;