diff options
Diffstat (limited to 'net/sctp/ipv6.c')
-rw-r--r-- | net/sctp/ipv6.c | 36 |
1 files changed, 2 insertions, 34 deletions
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c index ceaa4aa066ea..a63de3f7f185 100644 --- a/net/sctp/ipv6.c +++ b/net/sctp/ipv6.c | |||
@@ -97,8 +97,7 @@ static int sctp_inet6addr_event(struct notifier_block *this, unsigned long ev, | |||
97 | if (addr) { | 97 | if (addr) { |
98 | addr->a.v6.sin6_family = AF_INET6; | 98 | addr->a.v6.sin6_family = AF_INET6; |
99 | addr->a.v6.sin6_port = 0; | 99 | addr->a.v6.sin6_port = 0; |
100 | memcpy(&addr->a.v6.sin6_addr, &ifa->addr, | 100 | ipv6_addr_copy(&addr->a.v6.sin6_addr, &ifa->addr); |
101 | sizeof(struct in6_addr)); | ||
102 | addr->a.v6.sin6_scope_id = ifa->idev->dev->ifindex; | 101 | addr->a.v6.sin6_scope_id = ifa->idev->dev->ifindex; |
103 | addr->valid = 1; | 102 | addr->valid = 1; |
104 | spin_lock_bh(&sctp_local_addr_lock); | 103 | spin_lock_bh(&sctp_local_addr_lock); |
@@ -628,9 +627,7 @@ static sctp_scope_t sctp_v6_scope(union sctp_addr *addr) | |||
628 | static struct sock *sctp_v6_create_accept_sk(struct sock *sk, | 627 | static struct sock *sctp_v6_create_accept_sk(struct sock *sk, |
629 | struct sctp_association *asoc) | 628 | struct sctp_association *asoc) |
630 | { | 629 | { |
631 | struct inet_sock *inet = inet_sk(sk); | ||
632 | struct sock *newsk; | 630 | struct sock *newsk; |
633 | struct inet_sock *newinet; | ||
634 | struct ipv6_pinfo *newnp, *np = inet6_sk(sk); | 631 | struct ipv6_pinfo *newnp, *np = inet6_sk(sk); |
635 | struct sctp6_sock *newsctp6sk; | 632 | struct sctp6_sock *newsctp6sk; |
636 | 633 | ||
@@ -640,17 +637,7 @@ static struct sock *sctp_v6_create_accept_sk(struct sock *sk, | |||
640 | 637 | ||
641 | sock_init_data(NULL, newsk); | 638 | sock_init_data(NULL, newsk); |
642 | 639 | ||
643 | newsk->sk_type = SOCK_STREAM; | 640 | sctp_copy_sock(newsk, sk, asoc); |
644 | |||
645 | newsk->sk_prot = sk->sk_prot; | ||
646 | newsk->sk_no_check = sk->sk_no_check; | ||
647 | newsk->sk_reuse = sk->sk_reuse; | ||
648 | |||
649 | newsk->sk_destruct = inet_sock_destruct; | ||
650 | newsk->sk_family = PF_INET6; | ||
651 | newsk->sk_protocol = IPPROTO_SCTP; | ||
652 | newsk->sk_backlog_rcv = sk->sk_prot->backlog_rcv; | ||
653 | newsk->sk_shutdown = sk->sk_shutdown; | ||
654 | sock_reset_flag(sk, SOCK_ZAPPED); | 641 | sock_reset_flag(sk, SOCK_ZAPPED); |
655 | 642 | ||
656 | newsctp6sk = (struct sctp6_sock *)newsk; | 643 | newsctp6sk = (struct sctp6_sock *)newsk; |
@@ -658,7 +645,6 @@ static struct sock *sctp_v6_create_accept_sk(struct sock *sk, | |||
658 | 645 | ||
659 | sctp_sk(newsk)->v4mapped = sctp_sk(sk)->v4mapped; | 646 | sctp_sk(newsk)->v4mapped = sctp_sk(sk)->v4mapped; |
660 | 647 | ||
661 | newinet = inet_sk(newsk); | ||
662 | newnp = inet6_sk(newsk); | 648 | newnp = inet6_sk(newsk); |
663 | 649 | ||
664 | memcpy(newnp, np, sizeof(struct ipv6_pinfo)); | 650 | memcpy(newnp, np, sizeof(struct ipv6_pinfo)); |
@@ -666,26 +652,8 @@ static struct sock *sctp_v6_create_accept_sk(struct sock *sk, | |||
666 | /* Initialize sk's sport, dport, rcv_saddr and daddr for getsockname() | 652 | /* Initialize sk's sport, dport, rcv_saddr and daddr for getsockname() |
667 | * and getpeername(). | 653 | * and getpeername(). |
668 | */ | 654 | */ |
669 | newinet->sport = inet->sport; | ||
670 | newnp->saddr = np->saddr; | ||
671 | newnp->rcv_saddr = np->rcv_saddr; | ||
672 | newinet->dport = htons(asoc->peer.port); | ||
673 | sctp_v6_to_sk_daddr(&asoc->peer.primary_addr, newsk); | 655 | sctp_v6_to_sk_daddr(&asoc->peer.primary_addr, newsk); |
674 | 656 | ||
675 | /* Init the ipv4 part of the socket since we can have sockets | ||
676 | * using v6 API for ipv4. | ||
677 | */ | ||
678 | newinet->uc_ttl = -1; | ||
679 | newinet->mc_loop = 1; | ||
680 | newinet->mc_ttl = 1; | ||
681 | newinet->mc_index = 0; | ||
682 | newinet->mc_list = NULL; | ||
683 | |||
684 | if (ipv4_config.no_pmtu_disc) | ||
685 | newinet->pmtudisc = IP_PMTUDISC_DONT; | ||
686 | else | ||
687 | newinet->pmtudisc = IP_PMTUDISC_WANT; | ||
688 | |||
689 | sk_refcnt_debug_inc(newsk); | 657 | sk_refcnt_debug_inc(newsk); |
690 | 658 | ||
691 | if (newsk->sk_prot->init(newsk)) { | 659 | if (newsk->sk_prot->init(newsk)) { |