Hi,

I had a problem with nfdump statistics. When I tried to print out some 
information using a command line like:

$ nfdump-r <file>-o "fmt: %mpls10"

The program was printing %mpls1 field, with a zero added at the end.


Something like:

   MPLS lbl 1
     21576-0-00
     16978-0-00
     17477-0-00


When it should be something like:

   MPLS lbl 10
     21576-0-0
     16978-0-0
     17477-0-0




The problem resides on the comparison between fields length and 
arguments length.

For example, "%mpls1" has length 6, but "%mpls10" has length 7.

If you run strncmp ("%mpls1", "%mpls10", 6), it WILL return true.



The following patch solves the problem.

--- nfdump-1.6.6/bin/nf_common.c    2012-02-19 08:42:43.000000000 -0200
+++ nfdump-1.6.6-fix/bin/nf_common.c    2012-03-28 11:41:56.028180232 -0300
@@ -1387,4 +1387,9 @@
                  if ( remaining >= len &&  !isalpha((int)c[len]) ) {
                      // separator found a expected position
+                    /* XXX: If mpls10 is given, an error occurs. 
Handling this specific error */
+                    if (c[len] == '0' && c[len-1] == '1') {
+                        i++;             // skip mpls1 when mpls10 is given
+                        continue;
+                    }
                      char p = c[len];     // save separator;
                      c[len] = '\0';






------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Nfdump-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nfdump-discuss

Reply via email to