18 #include <linux/socket.h>
19 #include <linux/net.h>
20 #include <linux/ipv6.h>
23 #include <linux/stddef.h>
24 #include <linux/export.h>
33 static int sockstat6_seq_show(
struct seq_file *seq,
void *
v)
46 ip6_frag_nqueues(net), ip6_frag_mem(net));
57 .open = sockstat6_seq_open,
63 static const struct snmp_mib snmp6_ipstats_list[] = {
96 static const struct snmp_mib snmp6_icmp6_list[] = {
106 static const char *
const icmp6type2name[256] = {
125 static const struct snmp_mib snmp6_udp6_list[] = {
135 static const struct snmp_mib snmp6_udplite6_list[] = {
156 p = icmp6type2name[icmptype];
159 snprintf(name,
sizeof(name),
"Icmp6%s%s",
160 i & 0x100 ?
"Out" :
"In", p);
162 atomic_long_read(smib + i));
169 val = atomic_long_read(smib + i);
172 snprintf(name,
sizeof(name),
"Icmp6%sType%u",
173 i & 0x100 ?
"Out" :
"In", i & 0xff);
181 static void snmp6_seq_show_item(
struct seq_file *seq,
void __percpu **pcpumib,
188 for (i = 0; itemlist[
i].
name; i++) {
191 atomic_long_read(smib + itemlist[i].entry);
192 seq_printf(seq,
"%-32s\t%lu\n", itemlist[i].name, val);
196 static void snmp6_seq_show_item64(
struct seq_file *seq,
void __percpu **mib,
197 const struct snmp_mib *itemlist,
size_t syncpoff)
201 for (i = 0; itemlist[
i].
name; i++)
202 seq_printf(seq,
"%-32s\t%llu\n", itemlist[i].name,
203 snmp_fold_field64(mib, itemlist[i].
entry, syncpoff));
206 static int snmp6_seq_show(
struct seq_file *seq,
void *v)
208 struct net *net = (
struct net *)seq->
private;
210 snmp6_seq_show_item64(seq, (
void __percpu **)net->
mib.ipv6_statistics,
212 snmp6_seq_show_item(seq, (
void __percpu **)net->
mib.icmpv6_statistics,
213 NULL, snmp6_icmp6_list);
214 snmp6_seq_show_icmpv6msg(seq, net->
mib.icmpv6msg_statistics->mibs);
215 snmp6_seq_show_item(seq, (
void __percpu **)net->
mib.udp_stats_in6,
216 NULL, snmp6_udp6_list);
217 snmp6_seq_show_item(seq, (
void __percpu **)net->
mib.udplite_stats_in6,
218 NULL, snmp6_udplite6_list);
229 .open = snmp6_seq_open,
235 static int snmp6_dev_seq_show(
struct seq_file *seq,
void *v)
239 seq_printf(seq,
"%-32s\t%u\n",
"ifIndex", idev->
dev->ifindex);
240 snmp6_seq_show_item64(seq, (
void __percpu **)idev->
stats.ipv6,
242 snmp6_seq_show_item(seq,
NULL, idev->
stats.icmpv6dev->mibs,
244 snmp6_seq_show_icmpv6msg(seq, idev->
stats.icmpv6msgdev->mibs);
255 .open = snmp6_dev_seq_open,
266 if (!idev || !idev->
dev)
269 net = dev_net(idev->
dev);
270 if (!net->
mib.proc_net_devsnmp6)
274 net->
mib.proc_net_devsnmp6,
275 &snmp6_dev_seq_fops, idev);
279 idev->
stats.proc_dir_entry =
p;
285 struct net *net = dev_net(idev->
dev);
286 if (!net->
mib.proc_net_devsnmp6)
288 if (!idev->
stats.proc_dir_entry)
291 net->
mib.proc_net_devsnmp6);
296 static int __net_init ipv6_proc_init_net(
struct net *net)
299 &sockstat6_seq_fops))
303 goto proc_snmp6_fail;
306 if (!net->
mib.proc_net_devsnmp6)
307 goto proc_dev_snmp6_fail;
317 static void __net_exit ipv6_proc_exit_net(
struct net *net)
325 .init = ipv6_proc_init_net,
326 .exit = ipv6_proc_exit_net,