34 #include <linux/types.h>
45 #include <linux/export.h>
52 static int sockstat_seq_show(
struct seq_file *seq,
void *
v)
59 sockets = proto_sockets_allocated_sum_positive(&
tcp_prot);
63 seq_printf(seq,
"TCP: inuse %d orphan %d tw %d alloc %d mem %ld\n",
64 sock_prot_inuse_get(net, &
tcp_prot), orphans,
73 sock_prot_inuse_get(net, &
raw_prot));
86 .open = sockstat_seq_open,
93 static const struct snmp_mib snmp4_ipstats_list[] = {
115 static const struct snmp_mib snmp4_ipextstats_list[] = {
131 static const struct {
150 static const struct snmp_mib snmp4_tcp_list[] = {
168 static const struct snmp_mib snmp4_udp_list[] = {
178 static const struct snmp_mib snmp4_net_list[] = {
273 static void icmpmsg_put_line(
struct seq_file *seq,
unsigned long *vals,
280 for (j = 0; j <
count; ++
j)
282 type[j] & 0x100 ?
"Out" :
"In",
285 for (j = 0; j <
count; ++
j)
290 static void icmpmsg_put(
struct seq_file *seq)
297 struct net *net = seq->
private;
301 val = atomic_long_read(&net->
mib.icmpmsg_statistics->mibs[i]);
306 if (count == PERLINE) {
307 icmpmsg_put_line(seq, vals, type, count);
311 icmpmsg_put_line(seq, vals, type, count);
316 static void icmp_put(
struct seq_file *seq)
319 struct net *net = seq->
private;
322 seq_puts(seq,
"\nIcmp: InMsgs InErrors");
323 for (i=0; icmpmibmap[
i].name !=
NULL; i++)
326 for (i=0; icmpmibmap[
i].name !=
NULL; i++)
327 seq_printf(seq,
" Out%s", icmpmibmap[i].name);
331 for (i=0; icmpmibmap[
i].name !=
NULL; i++)
333 atomic_long_read(ptr + icmpmibmap[i].
index));
337 for (i=0; icmpmibmap[
i].name !=
NULL; i++)
339 atomic_long_read(ptr + (icmpmibmap[i].index | 0x100)));
345 static int snmp_seq_show(
struct seq_file *seq,
void *v)
348 struct net *net = seq->
private;
350 seq_puts(seq,
"Ip: Forwarding DefaultTTL");
352 for (i = 0; snmp4_ipstats_list[
i].
name !=
NULL; i++)
353 seq_printf(seq,
" %s", snmp4_ipstats_list[i].name);
356 IPV4_DEVCONF_ALL(net, FORWARDING) ? 1 : 2,
357 sysctl_ip_default_ttl);
360 for (i = 0; snmp4_ipstats_list[
i].
name !=
NULL; i++)
362 snmp_fold_field64((
void __percpu **)net->
mib.ip_statistics,
363 snmp4_ipstats_list[i].
entry,
370 for (i = 0; snmp4_tcp_list[
i].
name !=
NULL; i++)
371 seq_printf(seq,
" %s", snmp4_tcp_list[i].name);
374 for (i = 0; snmp4_tcp_list[
i].
name !=
NULL; i++) {
379 snmp4_tcp_list[i].
entry));
383 snmp4_tcp_list[i].
entry));
387 for (i = 0; snmp4_udp_list[
i].
name !=
NULL; i++)
388 seq_printf(seq,
" %s", snmp4_udp_list[i].name);
391 for (i = 0; snmp4_udp_list[
i].
name !=
NULL; i++)
394 snmp4_udp_list[i].
entry));
398 for (i = 0; snmp4_udp_list[
i].
name !=
NULL; i++)
399 seq_printf(seq,
" %s", snmp4_udp_list[i].name);
402 for (i = 0; snmp4_udp_list[
i].
name !=
NULL; i++)
405 snmp4_udp_list[i].
entry));
418 .open = snmp_seq_open,
429 static int netstat_seq_show(
struct seq_file *seq,
void *v)
432 struct net *net = seq->
private;
435 for (i = 0; snmp4_net_list[
i].
name !=
NULL; i++)
436 seq_printf(seq,
" %s", snmp4_net_list[i].name);
439 for (i = 0; snmp4_net_list[
i].
name !=
NULL; i++)
442 snmp4_net_list[i].
entry));
445 for (i = 0; snmp4_ipextstats_list[
i].
name !=
NULL; i++)
446 seq_printf(seq,
" %s", snmp4_ipextstats_list[i].name);
449 for (i = 0; snmp4_ipextstats_list[
i].
name !=
NULL; i++)
451 snmp_fold_field64((
void __percpu **)net->
mib.ip_statistics,
452 snmp4_ipextstats_list[i].
entry,
466 .open = netstat_seq_open,
472 static __net_init int ip_proc_init_net(
struct net *net)
491 static __net_exit void ip_proc_exit_net(
struct net *net)
499 .init = ip_proc_init_net,
500 .exit = ip_proc_exit_net,