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.c39
1 files changed, 6 insertions, 33 deletions
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index c4986d0f7419..8eb3e61cb701 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -106,12 +106,8 @@ static __init int sctp_proc_init(void)
106 goto out_nomem; 106 goto out_nomem;
107#ifdef CONFIG_PROC_FS 107#ifdef CONFIG_PROC_FS
108 if (!proc_net_sctp) { 108 if (!proc_net_sctp) {
109 struct proc_dir_entry *ent; 109 proc_net_sctp = proc_mkdir("sctp", init_net.proc_net);
110 ent = proc_mkdir("sctp", init_net.proc_net); 110 if (!proc_net_sctp)
111 if (ent) {
112 ent->owner = THIS_MODULE;
113 proc_net_sctp = ent;
114 } else
115 goto out_free_percpu; 111 goto out_free_percpu;
116 } 112 }
117 113
@@ -589,46 +585,21 @@ static int sctp_v4_is_ce(const struct sk_buff *skb)
589static struct sock *sctp_v4_create_accept_sk(struct sock *sk, 585static struct sock *sctp_v4_create_accept_sk(struct sock *sk,
590 struct sctp_association *asoc) 586 struct sctp_association *asoc)
591{ 587{
592 struct inet_sock *inet = inet_sk(sk);
593 struct inet_sock *newinet;
594 struct sock *newsk = sk_alloc(sock_net(sk), PF_INET, GFP_KERNEL, 588 struct sock *newsk = sk_alloc(sock_net(sk), PF_INET, GFP_KERNEL,
595 sk->sk_prot); 589 sk->sk_prot);
590 struct inet_sock *newinet;
596 591
597 if (!newsk) 592 if (!newsk)
598 goto out; 593 goto out;
599 594
600 sock_init_data(NULL, newsk); 595 sock_init_data(NULL, newsk);
601 596
602 newsk->sk_type = SOCK_STREAM; 597 sctp_copy_sock(newsk, sk, asoc);
603
604 newsk->sk_no_check = sk->sk_no_check;
605 newsk->sk_reuse = sk->sk_reuse;
606 newsk->sk_shutdown = sk->sk_shutdown;
607
608 newsk->sk_destruct = inet_sock_destruct;
609 newsk->sk_family = PF_INET;
610 newsk->sk_protocol = IPPROTO_SCTP;
611 newsk->sk_backlog_rcv = sk->sk_prot->backlog_rcv;
612 sock_reset_flag(newsk, SOCK_ZAPPED); 598 sock_reset_flag(newsk, SOCK_ZAPPED);
613 599
614 newinet = inet_sk(newsk); 600 newinet = inet_sk(newsk);
615 601
616 /* Initialize sk's sport, dport, rcv_saddr and daddr for
617 * getsockname() and getpeername()
618 */
619 newinet->sport = inet->sport;
620 newinet->saddr = inet->saddr;
621 newinet->rcv_saddr = inet->rcv_saddr;
622 newinet->dport = htons(asoc->peer.port);
623 newinet->daddr = asoc->peer.primary_addr.v4.sin_addr.s_addr; 602 newinet->daddr = asoc->peer.primary_addr.v4.sin_addr.s_addr;
624 newinet->pmtudisc = inet->pmtudisc;
625 newinet->id = asoc->next_tsn ^ jiffies;
626
627 newinet->uc_ttl = -1;
628 newinet->mc_loop = 1;
629 newinet->mc_ttl = 1;
630 newinet->mc_index = 0;
631 newinet->mc_list = NULL;
632 603
633 sk_refcnt_debug_inc(newsk); 604 sk_refcnt_debug_inc(newsk);
634 605
@@ -1413,4 +1384,6 @@ MODULE_ALIAS("net-pf-" __stringify(PF_INET) "-proto-132");
1413MODULE_ALIAS("net-pf-" __stringify(PF_INET6) "-proto-132"); 1384MODULE_ALIAS("net-pf-" __stringify(PF_INET6) "-proto-132");
1414MODULE_AUTHOR("Linux Kernel SCTP developers <lksctp-developers@lists.sourceforge.net>"); 1385MODULE_AUTHOR("Linux Kernel SCTP developers <lksctp-developers@lists.sourceforge.net>");
1415MODULE_DESCRIPTION("Support for the SCTP protocol (RFC2960)"); 1386MODULE_DESCRIPTION("Support for the SCTP protocol (RFC2960)");
1387module_param_named(no_checksums, sctp_checksum_disable, bool, 0644);
1388MODULE_PARM_DESC(no_checksums, "Disable checksums computing and verification");
1416MODULE_LICENSE("GPL"); 1389MODULE_LICENSE("GPL");