Hi,

Attached is a patch so that the networks file
can contain comments.  (Apparently it can contain
comments now, but there's memory allocated as if
each comment line was a network specification.
And you occasionally get errors that
don't matter depending on
comment content. E.g the comment
! We're not using 192.168.0.0/16 on alternate Tuesdays.
produces an ignorable error.  (IIRC.)
)

This patch works for me.  I would not swear
up and down that it does not break things,
mostly because I'm not super clear on what
the syntax and semantics of the networks
file is supposed to be.  I think I know,
but I don't find the examples/network.lst.example
file 100% unambiguous.  I'm 99% sure it works,
but...

Against cvs.  To apply:

cd pmacct
patch < net_aggr-comment.patch


Karl <[email protected]>
Free Software:  "You don't pay back, you pay forward."
                 -- Robert A. Heinlein
--- ../pmacct/src/net_aggr.c	Wed Sep  3 05:12:00 2008
+++ src/net_aggr.c	Mon Mar  9 20:26:21 2009
@@ -77,7 +77,7 @@
       rows = 0;
       /* 1st step: count rows for table allocation */
       while (!feof(file)) {
-        if (fgets(buf, SRVBUFLEN, file)) rows++; 
+        if (fgets(buf, SRVBUFLEN, file) && !iscomment(buf)) rows++; 
       }
       /* 2nd step: loading data into a temporary table */
       freopen(filename, "r", file);
@@ -106,6 +106,8 @@
 	bufptr = buf;
 	memset(buf, 0, SRVBUFLEN);
         if (fgets(buf, SRVBUFLEN, file)) { 
+	  if (iscomment(buf))
+	    continue;
 	  if (delim = strchr(buf, ',')) {
 	    as = buf;
 	    *delim = '\0';

_______________________________________________
pmacct-discussion mailing list
http://www.pmacct.net/#mailinglists

Reply via email to