patch-2.3.39 linux/net/ipv6/proc.c
Next file: linux/net/ipv6/raw.c
Previous file: linux/net/ipv6/ndisc.c
Back to the patch index
Back to the overall index
- Lines: 99
- Date:
Sat Jan 8 21:36:21 2000
- Orig file:
v2.3.38/linux/net/ipv6/proc.c
- Orig date:
Wed Dec 29 13:13:21 1999
diff -u --recursive --new-file v2.3.38/linux/net/ipv6/proc.c linux/net/ipv6/proc.c
@@ -7,7 +7,7 @@
* PROC file system. This is very similar to the IPv4 version,
* except it reports the sockets in the INET6 address family.
*
- * Version: $Id: proc.c,v 1.12 1999/12/15 22:39:48 davem Exp $
+ * Version: $Id: proc.c,v 1.13 2000/01/09 02:19:55 davem Exp $
*
* Authors: David S. Miller (davem@caip.rutgers.edu)
*
@@ -26,15 +26,26 @@
#include <net/transp_v6.h>
#include <net/ipv6.h>
-int afinet6_get_info(char *buffer, char **start, off_t offset, int length)
+static int fold_prot_inuse(struct proto *proto)
+{
+ int res = 0;
+ int cpu;
+
+ for (cpu=0; cpu<smp_num_cpus; cpu++)
+ res += proto->stats[cpu].inuse;
+
+ return res;
+}
+
+int afinet6_get_info(char *buffer, char **start, off_t offset, int length, int dummy)
{
int len = 0;
- len += sprintf(buffer+len, "TCP6: inuse %d highest %d\n",
- tcpv6_prot.inuse, tcpv6_prot.highestinuse);
- len += sprintf(buffer+len, "UDP6: inuse %d highest %d\n",
- udpv6_prot.inuse, udpv6_prot.highestinuse);
- len += sprintf(buffer+len, "RAW6: inuse %d highest %d\n",
- rawv6_prot.inuse, rawv6_prot.highestinuse);
+ len += sprintf(buffer+len, "TCP6: inuse %d\n",
+ fold_prot_inuse(&tcpv6_prot));
+ len += sprintf(buffer+len, "UDP6: inuse %d\n",
+ fold_prot_inuse(&udpv6_prot));
+ len += sprintf(buffer+len, "RAW6: inuse %d\n",
+ fold_prot_inuse(&rawv6_prot));
*start = buffer + offset;
len -= offset;
if(len > length)
@@ -47,9 +58,10 @@
{
char *name;
unsigned long *ptr;
+ int mibsize;
} snmp6_list[] = {
/* ipv6 mib according to draft-ietf-ipngwg-ipv6-mib-04 */
-#define SNMP6_GEN(x) { #x , &ipv6_statistics.x }
+#define SNMP6_GEN(x) { #x , &ipv6_statistics[0].x, sizeof(struct ipv6_mib)/sizeof(unsigned long) }
SNMP6_GEN(Ip6InReceives),
SNMP6_GEN(Ip6InHdrErrors),
SNMP6_GEN(Ip6InTooBigErrors),
@@ -83,7 +95,7 @@
OutRouterAdvertisements too.
OutGroupMembQueries too.
*/
-#define SNMP6_GEN(x) { #x , &icmpv6_statistics.x }
+#define SNMP6_GEN(x) { #x , &icmpv6_statistics[0].x, sizeof(struct icmpv6_mib)/sizeof(unsigned long) }
SNMP6_GEN(Icmp6InMsgs),
SNMP6_GEN(Icmp6InErrors),
SNMP6_GEN(Icmp6InDestUnreachs),
@@ -113,7 +125,7 @@
SNMP6_GEN(Icmp6OutGroupMembResponses),
SNMP6_GEN(Icmp6OutGroupMembReductions),
#undef SNMP6_GEN
-#define SNMP6_GEN(x) { "Udp6" #x , &udp_stats_in6.Udp##x }
+#define SNMP6_GEN(x) { "Udp6" #x , &udp_stats_in6[0].Udp##x, sizeof(struct udp_mib)/sizeof(unsigned long) }
SNMP6_GEN(InDatagrams),
SNMP6_GEN(NoPorts),
SNMP6_GEN(InErrors),
@@ -121,6 +133,16 @@
#undef SNMP6_GEN
};
+static unsigned long fold_field(unsigned long *ptr, int size)
+{
+ unsigned long res = 0;
+ int i;
+
+ for (i=0; i<smp_num_cpus; i++)
+ res += ptr[i*size];
+
+ return res;
+}
int afinet6_get_snmp(char *buffer, char **start, off_t offset, int length)
{
@@ -129,7 +151,7 @@
for (i=0; i<sizeof(snmp6_list)/sizeof(snmp6_list[0]); i++)
len += sprintf(buffer+len, "%-32s\t%ld\n", snmp6_list[i].name,
- *(snmp6_list[i].ptr));
+ fold_field(snmp6_list[i].ptr, snmp6_list[i].mibsize));
len -= offset;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)