On Sun, Feb 09, 2003 at 08:14:33PM +0800, Michael Boman wrote: > After a while BPF filters can grow very large and keeping track of what > everything is for get's somewhat complicated.. Attached is a patch that > allow you to have comments (shell '#' style) in the BPF file. The patch > is against tcpdump 3.7.1. > > Have a nice day!
I really need to check that I've attached the file before sending the mail... This time it should be attached ;) Best regards Michael Boman -- Michael Boman Security Architect, SecureCiRT Pte Ltd http://www.securecirt.com
--- util.c.original 2003-02-08 10:49:54.000000000 +0000
+++ util.c 2003-02-03 09:16:19.000000000 +0000
@@ -315,7 +315,7 @@
read_infile(char *fname)
{
register int fd, cc;
- register char *cp;
+ register char *cp, *cmt;
struct stat buf;
fd = open(fname, O_RDONLY);
@@ -336,6 +336,9 @@
error("short read %s (%d != %d)", fname, cc, (int)buf.st_size);
cp[(int)buf.st_size] = '\0';
+ while ((cmt = strchr (cp, '#')))
+ while (*cmt != '\r' && *cmt != '\n' && *cmt != NULL)
+ *cmt++ = ' ';
return (cp);
}
msg02280/pgp00000.pgp
Description: PGP signature
