diff options
Diffstat (limited to 'net/sctp/protocol.c')
| -rw-r--r-- | net/sctp/protocol.c | 50 |
1 files changed, 13 insertions, 37 deletions
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c index c4986d0f7419..a76da657244a 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 | ||
| @@ -164,6 +160,7 @@ static void sctp_proc_exit(void) | |||
| 164 | remove_proc_entry("sctp", init_net.proc_net); | 160 | remove_proc_entry("sctp", init_net.proc_net); |
| 165 | } | 161 | } |
| 166 | #endif | 162 | #endif |
| 163 | percpu_counter_destroy(&sctp_sockets_allocated); | ||
| 167 | } | 164 | } |
| 168 | 165 | ||
| 169 | /* Private helper to extract ipv4 address and stash them in | 166 | /* Private helper to extract ipv4 address and stash them in |
| @@ -397,7 +394,7 @@ static int sctp_v4_addr_valid(union sctp_addr *addr, | |||
| 397 | return 0; | 394 | return 0; |
| 398 | 395 | ||
| 399 | /* Is this a broadcast address? */ | 396 | /* Is this a broadcast address? */ |
| 400 | if (skb && skb->rtable->rt_flags & RTCF_BROADCAST) | 397 | if (skb && skb_rtable(skb)->rt_flags & RTCF_BROADCAST) |
| 401 | return 0; | 398 | return 0; |
| 402 | 399 | ||
| 403 | return 1; | 400 | return 1; |
| @@ -576,7 +573,7 @@ static void sctp_v4_get_saddr(struct sctp_sock *sk, | |||
| 576 | /* What interface did this skb arrive on? */ | 573 | /* What interface did this skb arrive on? */ |
| 577 | static int sctp_v4_skb_iif(const struct sk_buff *skb) | 574 | static int sctp_v4_skb_iif(const struct sk_buff *skb) |
| 578 | { | 575 | { |
| 579 | return skb->rtable->rt_iif; | 576 | return skb_rtable(skb)->rt_iif; |
| 580 | } | 577 | } |
| 581 | 578 | ||
| 582 | /* Was this packet marked by Explicit Congestion Notification? */ | 579 | /* Was this packet marked by Explicit Congestion Notification? */ |
| @@ -589,46 +586,21 @@ static int sctp_v4_is_ce(const struct sk_buff *skb) | |||
| 589 | static struct sock *sctp_v4_create_accept_sk(struct sock *sk, | 586 | static struct sock *sctp_v4_create_accept_sk(struct sock *sk, |
| 590 | struct sctp_association *asoc) | 587 | struct sctp_association *asoc) |
| 591 | { | 588 | { |
| 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, | 589 | struct sock *newsk = sk_alloc(sock_net(sk), PF_INET, GFP_KERNEL, |
| 595 | sk->sk_prot); | 590 | sk->sk_prot); |
| 591 | struct inet_sock *newinet; | ||
| 596 | 592 | ||
| 597 | if (!newsk) | 593 | if (!newsk) |
| 598 | goto out; | 594 | goto out; |
| 599 | 595 | ||
| 600 | sock_init_data(NULL, newsk); | 596 | sock_init_data(NULL, newsk); |
| 601 | 597 | ||
| 602 | newsk->sk_type = SOCK_STREAM; | 598 | 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); | 599 | sock_reset_flag(newsk, SOCK_ZAPPED); |
| 613 | 600 | ||
| 614 | newinet = inet_sk(newsk); | 601 | newinet = inet_sk(newsk); |
| 615 | 602 | ||
| 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; | 603 | 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 | 604 | ||
| 633 | sk_refcnt_debug_inc(newsk); | 605 | sk_refcnt_debug_inc(newsk); |
| 634 | 606 | ||
| @@ -877,8 +849,8 @@ static inline int sctp_v4_xmit(struct sk_buff *skb, | |||
| 877 | 849 | ||
| 878 | SCTP_DEBUG_PRINTK("%s: skb:%p, len:%d, src:%pI4, dst:%pI4\n", | 850 | SCTP_DEBUG_PRINTK("%s: skb:%p, len:%d, src:%pI4, dst:%pI4\n", |
| 879 | __func__, skb, skb->len, | 851 | __func__, skb, skb->len, |
| 880 | &skb->rtable->rt_src, | 852 | &skb_rtable(skb)->rt_src, |
| 881 | &skb->rtable->rt_dst); | 853 | &skb_rtable(skb)->rt_dst); |
| 882 | 854 | ||
| 883 | inet->pmtudisc = transport->param_flags & SPP_PMTUD_ENABLE ? | 855 | inet->pmtudisc = transport->param_flags & SPP_PMTUD_ENABLE ? |
| 884 | IP_PMTUDISC_DO : IP_PMTUDISC_DONT; | 856 | IP_PMTUDISC_DO : IP_PMTUDISC_DONT; |
| @@ -1399,6 +1371,8 @@ SCTP_STATIC __exit void sctp_exit(void) | |||
| 1399 | sctp_proc_exit(); | 1371 | sctp_proc_exit(); |
| 1400 | cleanup_sctp_mibs(); | 1372 | cleanup_sctp_mibs(); |
| 1401 | 1373 | ||
| 1374 | rcu_barrier(); /* Wait for completion of call_rcu()'s */ | ||
| 1375 | |||
| 1402 | kmem_cache_destroy(sctp_chunk_cachep); | 1376 | kmem_cache_destroy(sctp_chunk_cachep); |
| 1403 | kmem_cache_destroy(sctp_bucket_cachep); | 1377 | kmem_cache_destroy(sctp_bucket_cachep); |
| 1404 | } | 1378 | } |
| @@ -1413,4 +1387,6 @@ MODULE_ALIAS("net-pf-" __stringify(PF_INET) "-proto-132"); | |||
| 1413 | MODULE_ALIAS("net-pf-" __stringify(PF_INET6) "-proto-132"); | 1387 | MODULE_ALIAS("net-pf-" __stringify(PF_INET6) "-proto-132"); |
| 1414 | MODULE_AUTHOR("Linux Kernel SCTP developers <lksctp-developers@lists.sourceforge.net>"); | 1388 | MODULE_AUTHOR("Linux Kernel SCTP developers <lksctp-developers@lists.sourceforge.net>"); |
| 1415 | MODULE_DESCRIPTION("Support for the SCTP protocol (RFC2960)"); | 1389 | MODULE_DESCRIPTION("Support for the SCTP protocol (RFC2960)"); |
| 1390 | module_param_named(no_checksums, sctp_checksum_disable, bool, 0644); | ||
| 1391 | MODULE_PARM_DESC(no_checksums, "Disable checksums computing and verification"); | ||
| 1416 | MODULE_LICENSE("GPL"); | 1392 | MODULE_LICENSE("GPL"); |
