Esempio n. 1
0
static int snmp_seq_show(struct seq_file *seq, void *v)
{
	snmp_seq_show_ipstats(seq, v);

	icmp_put(seq);	/* RFC 2011 compatibility */
	icmpmsg_put(seq);

	snmp_seq_show_tcp_udp(seq, v);

	return 0;
}
Esempio n. 2
0
/*
 *	Called from the PROCfs module. This outputs /proc/net/snmp.
 */
static int snmp_seq_show(struct seq_file *seq, void *v)
{
	int i;

	seq_puts(seq, "Ip: Forwarding DefaultTTL");

	for (i = 0; snmp4_ipstats_list[i].name != NULL; i++)
		seq_printf(seq, " %s", snmp4_ipstats_list[i].name);

	seq_printf(seq, "\nIp: %d %d",
			ipv4_devconf.forwarding ? 1 : 2, sysctl_ip_default_ttl);

	for (i = 0; snmp4_ipstats_list[i].name != NULL; i++)
		seq_printf(seq, " %lu",
			   fold_field((void **) ip_statistics, 
				      snmp4_ipstats_list[i].entry));

	icmp_put(seq);  /* RFC 2011 compatibility */
	icmpmsg_put(seq);

	seq_puts(seq, "\nTcp:");
	for (i = 0; snmp4_tcp_list[i].name != NULL; i++)
		seq_printf(seq, " %s", snmp4_tcp_list[i].name);

	seq_puts(seq, "\nTcp:");
	for (i = 0; snmp4_tcp_list[i].name != NULL; i++) {
		/* MaxConn field is signed, RFC 2012 */
		if (snmp4_tcp_list[i].entry == TCP_MIB_MAXCONN)
			seq_printf(seq, " %ld",
				   fold_field((void **) tcp_statistics, 
					      snmp4_tcp_list[i].entry));
		else
			seq_printf(seq, " %lu",
				   fold_field((void **) tcp_statistics,
					      snmp4_tcp_list[i].entry));
	}

	seq_puts(seq, "\nUdp:");
	for (i = 0; snmp4_udp_list[i].name != NULL; i++)
		seq_printf(seq, " %s", snmp4_udp_list[i].name);

	seq_puts(seq, "\nUdp:");
	for (i = 0; snmp4_udp_list[i].name != NULL; i++)
		seq_printf(seq, " %lu",
			   fold_field((void **) udp_statistics, 
				      snmp4_udp_list[i].entry));

	seq_putc(seq, '\n');
	return 0;
}
Esempio n. 3
0
/*
 *	Called from the PROCfs module. This outputs /proc/net/snmp.
 */
static int snmp_seq_show(struct seq_file *seq, void *v)
{
	int i;
	struct net *net = seq->private;

	seq_puts(seq, "Ip: Forwarding DefaultTTL");

	for (i = 0; snmp4_ipstats_list[i].name != NULL; i++)
		seq_printf(seq, " %s", snmp4_ipstats_list[i].name);

	seq_printf(seq, "\nIp: %d %d",
		   IPV4_DEVCONF_ALL(net, FORWARDING) ? 1 : 2,
		   sysctl_ip_default_ttl);

	BUILD_BUG_ON(offsetof(struct ipstats_mib, mibs) != 0);
	for (i = 0; snmp4_ipstats_list[i].name != NULL; i++)
		seq_printf(seq, " %llu",
			   snmp_fold_field64((void __percpu **)net->mib.ip_statistics,
					     snmp4_ipstats_list[i].entry,
					     offsetof(struct ipstats_mib, syncp)));

	icmp_put(seq);	/* RFC 2011 compatibility */
	icmpmsg_put(seq);

	seq_puts(seq, "\nTcp:");
	for (i = 0; snmp4_tcp_list[i].name != NULL; i++)
		seq_printf(seq, " %s", snmp4_tcp_list[i].name);

	seq_puts(seq, "\nTcp:");
	for (i = 0; snmp4_tcp_list[i].name != NULL; i++) {
		/* MaxConn field is signed, RFC 2012 */
		if (snmp4_tcp_list[i].entry == TCP_MIB_MAXCONN)
			seq_printf(seq, " %ld",
				   snmp_fold_field((void __percpu **)net->mib.tcp_statistics,
						   snmp4_tcp_list[i].entry));
		else
			seq_printf(seq, " %lu",
				   snmp_fold_field((void __percpu **)net->mib.tcp_statistics,
						   snmp4_tcp_list[i].entry));
	}

	seq_puts(seq, "\nUdp:");
	for (i = 0; snmp4_udp_list[i].name != NULL; i++)
		seq_printf(seq, " %s", snmp4_udp_list[i].name);

	seq_puts(seq, "\nUdp:");
	for (i = 0; snmp4_udp_list[i].name != NULL; i++)
		seq_printf(seq, " %lu",
			   snmp_fold_field((void __percpu **)net->mib.udp_statistics,
					   snmp4_udp_list[i].entry));

	/* the UDP and UDP-Lite MIBs are the same */
	seq_puts(seq, "\nUdpLite:");
	for (i = 0; snmp4_udp_list[i].name != NULL; i++)
		seq_printf(seq, " %s", snmp4_udp_list[i].name);

	seq_puts(seq, "\nUdpLite:");
	for (i = 0; snmp4_udp_list[i].name != NULL; i++)
		seq_printf(seq, " %lu",
			   snmp_fold_field((void __percpu **)net->mib.udplite_statistics,
					   snmp4_udp_list[i].entry));

	seq_putc(seq, '\n');
	return 0;
}
Esempio n. 4
0
static int snmp_seq_show(struct seq_file *seq, void *v)
{
	int i;
	struct net *net = seq->private;

	seq_puts(seq, "Ip: Forwarding DefaultTTL");

	for (i = 0; snmp4_ipstats_list[i].name != NULL; i++)
		seq_printf(seq, " %s", snmp4_ipstats_list[i].name);

	seq_printf(seq, "\nIp: %d %d",
		   IPV4_DEVCONF_ALL(net, FORWARDING) ? 1 : 2,
		   sysctl_ip_default_ttl);

	for (i = 0; snmp4_ipstats_list[i].name != NULL; i++)
		seq_printf(seq, " %lu",
			   snmp_fold_field((void **)net->mib.ip_statistics,
					   snmp4_ipstats_list[i].entry));

	icmp_put(seq);	
	icmpmsg_put(seq);

	seq_puts(seq, "\nTcp:");
	for (i = 0; snmp4_tcp_list[i].name != NULL; i++)
		seq_printf(seq, " %s", snmp4_tcp_list[i].name);

	seq_puts(seq, "\nTcp:");
	for (i = 0; snmp4_tcp_list[i].name != NULL; i++) {
		
		if (snmp4_tcp_list[i].entry == TCP_MIB_MAXCONN)
			seq_printf(seq, " %ld",
				   snmp_fold_field((void **)net->mib.tcp_statistics,
						   snmp4_tcp_list[i].entry));
		else
			seq_printf(seq, " %lu",
				   snmp_fold_field((void **)net->mib.tcp_statistics,
						   snmp4_tcp_list[i].entry));
	}

	seq_puts(seq, "\nUdp:");
	for (i = 0; snmp4_udp_list[i].name != NULL; i++)
		seq_printf(seq, " %s", snmp4_udp_list[i].name);

	seq_puts(seq, "\nUdp:");
	for (i = 0; snmp4_udp_list[i].name != NULL; i++)
		seq_printf(seq, " %lu",
			   snmp_fold_field((void **)net->mib.udp_statistics,
					   snmp4_udp_list[i].entry));

	
	seq_puts(seq, "\nUdpLite:");
	for (i = 0; snmp4_udp_list[i].name != NULL; i++)
		seq_printf(seq, " %s", snmp4_udp_list[i].name);

	seq_puts(seq, "\nUdpLite:");
	for (i = 0; snmp4_udp_list[i].name != NULL; i++)
		seq_printf(seq, " %lu",
			   snmp_fold_field((void **)net->mib.udplite_statistics,
					   snmp4_udp_list[i].entry));

	seq_putc(seq, '\n');
	return 0;
}
Esempio n. 5
0
File: proc.c Progetto: 274914765/C
/*
 *    Called from the PROCfs module. This outputs /proc/net/snmp.
 */
static int snmp_seq_show(struct seq_file *seq, void *v)
{
    int i;

    seq_puts(seq, "Ip: Forwarding DefaultTTL");

    for (i = 0; snmp4_ipstats_list[i].name != NULL; i++)
        seq_printf(seq, " %s", snmp4_ipstats_list[i].name);

    seq_printf(seq, "\nIp: %d %d",
           IPV4_DEVCONF_ALL(&init_net, FORWARDING) ? 1 : 2,
           sysctl_ip_default_ttl);

    for (i = 0; snmp4_ipstats_list[i].name != NULL; i++)
        seq_printf(seq, " %lu",
               snmp_fold_field((void **)ip_statistics,
                       snmp4_ipstats_list[i].entry));

    icmp_put(seq);    /* RFC 2011 compatibility */
    icmpmsg_put(seq);

    seq_puts(seq, "\nTcp:");
    for (i = 0; snmp4_tcp_list[i].name != NULL; i++)
        seq_printf(seq, " %s", snmp4_tcp_list[i].name);

    seq_puts(seq, "\nTcp:");
    for (i = 0; snmp4_tcp_list[i].name != NULL; i++) {
        /* MaxConn field is signed, RFC 2012 */
        if (snmp4_tcp_list[i].entry == TCP_MIB_MAXCONN)
            seq_printf(seq, " %ld",
                   snmp_fold_field((void **)tcp_statistics,
                           snmp4_tcp_list[i].entry));
        else
            seq_printf(seq, " %lu",
                   snmp_fold_field((void **)tcp_statistics,
                           snmp4_tcp_list[i].entry));
    }

    seq_puts(seq, "\nUdp:");
    for (i = 0; snmp4_udp_list[i].name != NULL; i++)
        seq_printf(seq, " %s", snmp4_udp_list[i].name);

    seq_puts(seq, "\nUdp:");
    for (i = 0; snmp4_udp_list[i].name != NULL; i++)
        seq_printf(seq, " %lu",
               snmp_fold_field((void **)udp_statistics,
                       snmp4_udp_list[i].entry));

    /* the UDP and UDP-Lite MIBs are the same */
    seq_puts(seq, "\nUdpLite:");
    for (i = 0; snmp4_udp_list[i].name != NULL; i++)
        seq_printf(seq, " %s", snmp4_udp_list[i].name);

    seq_puts(seq, "\nUdpLite:");
    for (i = 0; snmp4_udp_list[i].name != NULL; i++)
        seq_printf(seq, " %lu",
               snmp_fold_field((void **)udplite_statistics,
                       snmp4_udp_list[i].entry));

    seq_putc(seq, '\n');
    return 0;
}