diff options
Diffstat (limited to 'net/sctp/protocol.c')
-rw-r--r-- | net/sctp/protocol.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c index 0b65354aaf64..b78e3be69013 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c | |||
@@ -102,6 +102,8 @@ struct sock *sctp_get_ctl_sock(void) | |||
102 | /* Set up the proc fs entry for the SCTP protocol. */ | 102 | /* Set up the proc fs entry for the SCTP protocol. */ |
103 | static __init int sctp_proc_init(void) | 103 | static __init int sctp_proc_init(void) |
104 | { | 104 | { |
105 | if (percpu_counter_init(&sctp_sockets_allocated, 0)) | ||
106 | goto out_nomem; | ||
105 | #ifdef CONFIG_PROC_FS | 107 | #ifdef CONFIG_PROC_FS |
106 | if (!proc_net_sctp) { | 108 | if (!proc_net_sctp) { |
107 | struct proc_dir_entry *ent; | 109 | struct proc_dir_entry *ent; |
@@ -110,7 +112,7 @@ static __init int sctp_proc_init(void) | |||
110 | ent->owner = THIS_MODULE; | 112 | ent->owner = THIS_MODULE; |
111 | proc_net_sctp = ent; | 113 | proc_net_sctp = ent; |
112 | } else | 114 | } else |
113 | goto out_nomem; | 115 | goto out_free_percpu; |
114 | } | 116 | } |
115 | 117 | ||
116 | if (sctp_snmp_proc_init()) | 118 | if (sctp_snmp_proc_init()) |
@@ -135,11 +137,14 @@ out_snmp_proc_init: | |||
135 | proc_net_sctp = NULL; | 137 | proc_net_sctp = NULL; |
136 | remove_proc_entry("sctp", init_net.proc_net); | 138 | remove_proc_entry("sctp", init_net.proc_net); |
137 | } | 139 | } |
138 | out_nomem: | 140 | out_free_percpu: |
139 | return -ENOMEM; | 141 | percpu_counter_destroy(&sctp_sockets_allocated); |
140 | #else | 142 | #else |
141 | return 0; | 143 | return 0; |
142 | #endif /* CONFIG_PROC_FS */ | 144 | #endif /* CONFIG_PROC_FS */ |
145 | |||
146 | out_nomem: | ||
147 | return -ENOMEM; | ||
143 | } | 148 | } |
144 | 149 | ||
145 | /* Clean up the proc fs entry for the SCTP protocol. | 150 | /* Clean up the proc fs entry for the SCTP protocol. |
@@ -482,9 +487,8 @@ static struct dst_entry *sctp_v4_get_dst(struct sctp_association *asoc, | |||
482 | if (saddr) | 487 | if (saddr) |
483 | fl.fl4_src = saddr->v4.sin_addr.s_addr; | 488 | fl.fl4_src = saddr->v4.sin_addr.s_addr; |
484 | 489 | ||
485 | SCTP_DEBUG_PRINTK("%s: DST:%u.%u.%u.%u, SRC:%u.%u.%u.%u - ", | 490 | SCTP_DEBUG_PRINTK("%s: DST:%pI4, SRC:%pI4 - ", |
486 | __func__, NIPQUAD(fl.fl4_dst), | 491 | __func__, &fl.fl4_dst, &fl.fl4_src); |
487 | NIPQUAD(fl.fl4_src)); | ||
488 | 492 | ||
489 | if (!ip_route_output_key(&init_net, &rt, &fl)) { | 493 | if (!ip_route_output_key(&init_net, &rt, &fl)) { |
490 | dst = &rt->u.dst; | 494 | dst = &rt->u.dst; |
@@ -540,8 +544,8 @@ out_unlock: | |||
540 | rcu_read_unlock(); | 544 | rcu_read_unlock(); |
541 | out: | 545 | out: |
542 | if (dst) | 546 | if (dst) |
543 | SCTP_DEBUG_PRINTK("rt_dst:%u.%u.%u.%u, rt_src:%u.%u.%u.%u\n", | 547 | SCTP_DEBUG_PRINTK("rt_dst:%pI4, rt_src:%pI4\n", |
544 | NIPQUAD(rt->rt_dst), NIPQUAD(rt->rt_src)); | 548 | &rt->rt_dst, &rt->rt_src); |
545 | else | 549 | else |
546 | SCTP_DEBUG_PRINTK("NO ROUTE\n"); | 550 | SCTP_DEBUG_PRINTK("NO ROUTE\n"); |
547 | 551 | ||
@@ -646,7 +650,7 @@ static void sctp_v4_addr_v4map(struct sctp_sock *sp, union sctp_addr *addr) | |||
646 | /* Dump the v4 addr to the seq file. */ | 650 | /* Dump the v4 addr to the seq file. */ |
647 | static void sctp_v4_seq_dump_addr(struct seq_file *seq, union sctp_addr *addr) | 651 | static void sctp_v4_seq_dump_addr(struct seq_file *seq, union sctp_addr *addr) |
648 | { | 652 | { |
649 | seq_printf(seq, "%d.%d.%d.%d ", NIPQUAD(addr->v4.sin_addr)); | 653 | seq_printf(seq, "%pI4 ", &addr->v4.sin_addr); |
650 | } | 654 | } |
651 | 655 | ||
652 | static void sctp_v4_ecn_capable(struct sock *sk) | 656 | static void sctp_v4_ecn_capable(struct sock *sk) |
@@ -866,11 +870,10 @@ static inline int sctp_v4_xmit(struct sk_buff *skb, | |||
866 | { | 870 | { |
867 | struct inet_sock *inet = inet_sk(skb->sk); | 871 | struct inet_sock *inet = inet_sk(skb->sk); |
868 | 872 | ||
869 | SCTP_DEBUG_PRINTK("%s: skb:%p, len:%d, " | 873 | SCTP_DEBUG_PRINTK("%s: skb:%p, len:%d, src:%pI4, dst:%pI4\n", |
870 | "src:%u.%u.%u.%u, dst:%u.%u.%u.%u\n", | ||
871 | __func__, skb, skb->len, | 874 | __func__, skb, skb->len, |
872 | NIPQUAD(skb->rtable->rt_src), | 875 | &skb->rtable->rt_src, |
873 | NIPQUAD(skb->rtable->rt_dst)); | 876 | &skb->rtable->rt_dst); |
874 | 877 | ||
875 | inet->pmtudisc = transport->param_flags & SPP_PMTUD_ENABLE ? | 878 | inet->pmtudisc = transport->param_flags & SPP_PMTUD_ENABLE ? |
876 | IP_PMTUDISC_DO : IP_PMTUDISC_DONT; | 879 | IP_PMTUDISC_DO : IP_PMTUDISC_DONT; |