fib_triestats has been buggy and caused oopses some platforms as openwrt.
The patch below should cure those problems.
Cheers.
--ro
Signed-off-by: Robert Olsson <[EMAIL PROTECTED]>
--- linux-2.6.16-rc4/net/ipv4/fib_trie.c.061021 2006-02-21 22:22:57.0
+0100
+++ linux-2.6.16-rc4/net/ipv4/fib_trie.c2006-02-21 22:31:10.0
+0100
@@ -50,7 +50,7 @@
* Patrick McHardy <[EMAIL PROTECTED]>
*/
-#define VERSION "0.405"
+#define VERSION "0.406"
#include
#include
@@ -84,7 +84,7 @@
#include "fib_lookup.h"
#undef CONFIG_IP_FIB_TRIE_STATS
-#define MAX_CHILDS 16384
+#define MAX_STAT_DEPTH 32
#define KEYLENGTH (8*sizeof(t_key))
#define MASK_PFX(k, l) (((l)==0)?0:(k >> (KEYLENGTH-l)) << (KEYLENGTH-l))
@@ -154,7 +154,7 @@
unsigned int tnodes;
unsigned int leaves;
unsigned int nullpointers;
- unsigned int nodesizes[MAX_CHILDS];
+ unsigned int nodesizes[MAX_STAT_DEPTH];
};
struct trie {
@@ -2080,7 +2080,9 @@
int i;
s->tnodes++;
- s->nodesizes[tn->bits]++;
+ if(tn->bits < MAX_STAT_DEPTH)
+ s->nodesizes[tn->bits]++;
+
for (i = 0; i < (1child[i])
s->nullpointers++;
@@ -2110,8 +2112,8 @@
seq_printf(seq, "\tInternal nodes: %d\n\t", stat->tnodes);
bytes += sizeof(struct tnode) * stat->tnodes;
- max = MAX_CHILDS-1;
- while (max >= 0 && stat->nodesizes[max] == 0)
+ max = MAX_STAT_DEPTH;
+ while (max > 0 && stat->nodesizes[max-1] == 0)
max--;
pointers = 0;
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html