diff options
Diffstat (limited to 'net/ipv6/proc.c')
| -rw-r--r-- | net/ipv6/proc.c | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c index c9605c3ad91f..58344c0fbd13 100644 --- a/net/ipv6/proc.c +++ b/net/ipv6/proc.c | |||
| @@ -59,7 +59,7 @@ static const struct file_operations sockstat6_seq_fops = { | |||
| 59 | .release = single_release_net, | 59 | .release = single_release_net, |
| 60 | }; | 60 | }; |
| 61 | 61 | ||
| 62 | static struct snmp_mib snmp6_ipstats_list[] = { | 62 | static const struct snmp_mib snmp6_ipstats_list[] = { |
| 63 | /* ipv6 mib according to RFC 2465 */ | 63 | /* ipv6 mib according to RFC 2465 */ |
| 64 | SNMP_MIB_ITEM("Ip6InReceives", IPSTATS_MIB_INPKTS), | 64 | SNMP_MIB_ITEM("Ip6InReceives", IPSTATS_MIB_INPKTS), |
| 65 | SNMP_MIB_ITEM("Ip6InHdrErrors", IPSTATS_MIB_INHDRERRORS), | 65 | SNMP_MIB_ITEM("Ip6InHdrErrors", IPSTATS_MIB_INHDRERRORS), |
| @@ -92,7 +92,7 @@ static struct snmp_mib snmp6_ipstats_list[] = { | |||
| 92 | SNMP_MIB_SENTINEL | 92 | SNMP_MIB_SENTINEL |
| 93 | }; | 93 | }; |
| 94 | 94 | ||
| 95 | static struct snmp_mib snmp6_icmp6_list[] = { | 95 | static const struct snmp_mib snmp6_icmp6_list[] = { |
| 96 | /* icmpv6 mib according to RFC 2466 */ | 96 | /* icmpv6 mib according to RFC 2466 */ |
| 97 | SNMP_MIB_ITEM("Icmp6InMsgs", ICMP6_MIB_INMSGS), | 97 | SNMP_MIB_ITEM("Icmp6InMsgs", ICMP6_MIB_INMSGS), |
| 98 | SNMP_MIB_ITEM("Icmp6InErrors", ICMP6_MIB_INERRORS), | 98 | SNMP_MIB_ITEM("Icmp6InErrors", ICMP6_MIB_INERRORS), |
| @@ -120,7 +120,7 @@ static const char *const icmp6type2name[256] = { | |||
| 120 | }; | 120 | }; |
| 121 | 121 | ||
| 122 | 122 | ||
| 123 | static struct snmp_mib snmp6_udp6_list[] = { | 123 | static const struct snmp_mib snmp6_udp6_list[] = { |
| 124 | SNMP_MIB_ITEM("Udp6InDatagrams", UDP_MIB_INDATAGRAMS), | 124 | SNMP_MIB_ITEM("Udp6InDatagrams", UDP_MIB_INDATAGRAMS), |
| 125 | SNMP_MIB_ITEM("Udp6NoPorts", UDP_MIB_NOPORTS), | 125 | SNMP_MIB_ITEM("Udp6NoPorts", UDP_MIB_NOPORTS), |
| 126 | SNMP_MIB_ITEM("Udp6InErrors", UDP_MIB_INERRORS), | 126 | SNMP_MIB_ITEM("Udp6InErrors", UDP_MIB_INERRORS), |
| @@ -128,7 +128,7 @@ static struct snmp_mib snmp6_udp6_list[] = { | |||
| 128 | SNMP_MIB_SENTINEL | 128 | SNMP_MIB_SENTINEL |
| 129 | }; | 129 | }; |
| 130 | 130 | ||
| 131 | static struct snmp_mib snmp6_udplite6_list[] = { | 131 | static const struct snmp_mib snmp6_udplite6_list[] = { |
| 132 | SNMP_MIB_ITEM("UdpLite6InDatagrams", UDP_MIB_INDATAGRAMS), | 132 | SNMP_MIB_ITEM("UdpLite6InDatagrams", UDP_MIB_INDATAGRAMS), |
| 133 | SNMP_MIB_ITEM("UdpLite6NoPorts", UDP_MIB_NOPORTS), | 133 | SNMP_MIB_ITEM("UdpLite6NoPorts", UDP_MIB_NOPORTS), |
| 134 | SNMP_MIB_ITEM("UdpLite6InErrors", UDP_MIB_INERRORS), | 134 | SNMP_MIB_ITEM("UdpLite6InErrors", UDP_MIB_INERRORS), |
| @@ -136,7 +136,7 @@ static struct snmp_mib snmp6_udplite6_list[] = { | |||
| 136 | SNMP_MIB_SENTINEL | 136 | SNMP_MIB_SENTINEL |
| 137 | }; | 137 | }; |
| 138 | 138 | ||
| 139 | static void snmp6_seq_show_icmpv6msg(struct seq_file *seq, void **mib) | 139 | static void snmp6_seq_show_icmpv6msg(struct seq_file *seq, void __percpu **mib) |
| 140 | { | 140 | { |
| 141 | char name[32]; | 141 | char name[32]; |
| 142 | int i; | 142 | int i; |
| @@ -170,8 +170,8 @@ static void snmp6_seq_show_icmpv6msg(struct seq_file *seq, void **mib) | |||
| 170 | return; | 170 | return; |
| 171 | } | 171 | } |
| 172 | 172 | ||
| 173 | static inline void | 173 | static void snmp6_seq_show_item(struct seq_file *seq, void __percpu **mib, |
| 174 | snmp6_seq_show_item(struct seq_file *seq, void **mib, struct snmp_mib *itemlist) | 174 | const struct snmp_mib *itemlist) |
| 175 | { | 175 | { |
| 176 | int i; | 176 | int i; |
| 177 | for (i=0; itemlist[i].name; i++) | 177 | for (i=0; itemlist[i].name; i++) |
| @@ -183,14 +183,15 @@ static int snmp6_seq_show(struct seq_file *seq, void *v) | |||
| 183 | { | 183 | { |
| 184 | struct net *net = (struct net *)seq->private; | 184 | struct net *net = (struct net *)seq->private; |
| 185 | 185 | ||
| 186 | snmp6_seq_show_item(seq, (void **)net->mib.ipv6_statistics, | 186 | snmp6_seq_show_item(seq, (void __percpu **)net->mib.ipv6_statistics, |
| 187 | snmp6_ipstats_list); | 187 | snmp6_ipstats_list); |
| 188 | snmp6_seq_show_item(seq, (void **)net->mib.icmpv6_statistics, | 188 | snmp6_seq_show_item(seq, (void __percpu **)net->mib.icmpv6_statistics, |
| 189 | snmp6_icmp6_list); | 189 | snmp6_icmp6_list); |
| 190 | snmp6_seq_show_icmpv6msg(seq, (void **)net->mib.icmpv6msg_statistics); | 190 | snmp6_seq_show_icmpv6msg(seq, |
| 191 | snmp6_seq_show_item(seq, (void **)net->mib.udp_stats_in6, | 191 | (void __percpu **)net->mib.icmpv6msg_statistics); |
| 192 | snmp6_seq_show_item(seq, (void __percpu **)net->mib.udp_stats_in6, | ||
| 192 | snmp6_udp6_list); | 193 | snmp6_udp6_list); |
| 193 | snmp6_seq_show_item(seq, (void **)net->mib.udplite_stats_in6, | 194 | snmp6_seq_show_item(seq, (void __percpu **)net->mib.udplite_stats_in6, |
| 194 | snmp6_udplite6_list); | 195 | snmp6_udplite6_list); |
| 195 | return 0; | 196 | return 0; |
| 196 | } | 197 | } |
| @@ -213,9 +214,11 @@ static int snmp6_dev_seq_show(struct seq_file *seq, void *v) | |||
| 213 | struct inet6_dev *idev = (struct inet6_dev *)seq->private; | 214 | struct inet6_dev *idev = (struct inet6_dev *)seq->private; |
| 214 | 215 | ||
| 215 | seq_printf(seq, "%-32s\t%u\n", "ifIndex", idev->dev->ifindex); | 216 | seq_printf(seq, "%-32s\t%u\n", "ifIndex", idev->dev->ifindex); |
| 216 | snmp6_seq_show_item(seq, (void **)idev->stats.ipv6, snmp6_ipstats_list); | 217 | snmp6_seq_show_item(seq, (void __percpu **)idev->stats.ipv6, |
| 217 | snmp6_seq_show_item(seq, (void **)idev->stats.icmpv6, snmp6_icmp6_list); | 218 | snmp6_ipstats_list); |
| 218 | snmp6_seq_show_icmpv6msg(seq, (void **)idev->stats.icmpv6msg); | 219 | snmp6_seq_show_item(seq, (void __percpu **)idev->stats.icmpv6, |
| 220 | snmp6_icmp6_list); | ||
| 221 | snmp6_seq_show_icmpv6msg(seq, (void __percpu **)idev->stats.icmpv6msg); | ||
| 219 | return 0; | 222 | return 0; |
| 220 | } | 223 | } |
| 221 | 224 | ||
| @@ -259,7 +262,7 @@ int snmp6_unregister_dev(struct inet6_dev *idev) | |||
| 259 | struct net *net = dev_net(idev->dev); | 262 | struct net *net = dev_net(idev->dev); |
| 260 | if (!net->mib.proc_net_devsnmp6) | 263 | if (!net->mib.proc_net_devsnmp6) |
| 261 | return -ENOENT; | 264 | return -ENOENT; |
| 262 | if (!idev || !idev->stats.proc_dir_entry) | 265 | if (!idev->stats.proc_dir_entry) |
| 263 | return -EINVAL; | 266 | return -EINVAL; |
| 264 | remove_proc_entry(idev->stats.proc_dir_entry->name, | 267 | remove_proc_entry(idev->stats.proc_dir_entry->name, |
| 265 | net->mib.proc_net_devsnmp6); | 268 | net->mib.proc_net_devsnmp6); |
| @@ -267,7 +270,7 @@ int snmp6_unregister_dev(struct inet6_dev *idev) | |||
| 267 | return 0; | 270 | return 0; |
| 268 | } | 271 | } |
| 269 | 272 | ||
| 270 | static int ipv6_proc_init_net(struct net *net) | 273 | static int __net_init ipv6_proc_init_net(struct net *net) |
| 271 | { | 274 | { |
| 272 | if (!proc_net_fops_create(net, "sockstat6", S_IRUGO, | 275 | if (!proc_net_fops_create(net, "sockstat6", S_IRUGO, |
| 273 | &sockstat6_seq_fops)) | 276 | &sockstat6_seq_fops)) |
| @@ -288,7 +291,7 @@ proc_dev_snmp6_fail: | |||
| 288 | return -ENOMEM; | 291 | return -ENOMEM; |
| 289 | } | 292 | } |
| 290 | 293 | ||
| 291 | static void ipv6_proc_exit_net(struct net *net) | 294 | static void __net_exit ipv6_proc_exit_net(struct net *net) |
| 292 | { | 295 | { |
| 293 | proc_net_remove(net, "sockstat6"); | 296 | proc_net_remove(net, "sockstat6"); |
| 294 | proc_net_remove(net, "dev_snmp6"); | 297 | proc_net_remove(net, "dev_snmp6"); |
