Index: flowd-reader.c
===================================================================
RCS file: /var/cvs/flowd/flowd-reader.c,v
retrieving revision 1.15
diff -u -p -r1.15 flowd-reader.c
--- flowd-reader.c	4 Feb 2005 06:26:10 -0000	1.15
+++ flowd-reader.c	9 Jul 2005 01:48:55 -0000
@@ -17,6 +17,7 @@
 #define PROGNAME	"flowd-reader"
 
 #include <sys/types.h>
+#include <sys/stat.h>
 
 #include <unistd.h>
 #include <errno.h>
@@ -50,11 +51,12 @@ usage(void)
 }
 
 static int
-open_start_log(const char *path, int debug)
+open_start_log(const char *path, int skip_header, int debug)
 {
 	int fd;
 	off_t pos;
 	char ebuf[512];
+	struct stat sb;
 
 	if (path == NULL) {
 		/* Logfile on stdout */
@@ -62,6 +64,8 @@ open_start_log(const char *path, int deb
 	} else {
 		if ((fd = open(path, O_RDWR|O_APPEND|O_CREAT, 0600)) == -1)
 			logerr("open(%s)", path);
+		if (fstat(fd, &sb) == -1)
+			logerr("fstat");
 
 		/* Only write out the header if we are at the start of the file */
 		switch ((pos = lseek(fd, 0, SEEK_END))) {
@@ -69,7 +73,9 @@ open_start_log(const char *path, int deb
 			/* New file, continue below */
 			break;
 		case -1:
-			logerr("lseek");
+			if (!S_ISFIFO(sb.st_mode))
+				logerr("lseek");
+			break;
 		default:
 			/* Logfile exists, don't write new header */
 			if (lseek(fd, 0, SEEK_SET) != 0)
@@ -89,11 +95,13 @@ open_start_log(const char *path, int deb
 		}
 	}
 
-	if (debug)
-		fprintf(stderr, "Writing new logfile header\n");
+	if (!skip_header) {
+		if (debug)
+			fprintf(stderr, "Writing new logfile header\n");
 
-	if (store_put_header(fd, ebuf, sizeof(ebuf)) != STORE_ERR_OK)
-		logerrx("Store error: %s", ebuf);
+		if (store_put_header(fd, ebuf, sizeof(ebuf)) != STORE_ERR_OK)
+			logerrx("Store error: %s", ebuf);
+	}
 
 	return (fd);
 }
@@ -102,7 +110,7 @@ open_start_log(const char *path, int deb
 int
 main(int argc, char **argv)
 {
-	int ch, i, fd, utc, r, verbose, debug;
+	int ch, i, fd, utc, r, verbose, debug, skip_hdr_in, skip_hdr_out;
 	extern char *optarg;
 	extern int optind;
 	struct store_flow_complete flow;
@@ -114,15 +122,18 @@ main(int argc, char **argv)
 	u_int32_t disp_mask;
 	struct flowd_config filter_config;
 
-	utc = verbose = debug = 0;
+	utc = verbose = debug = skip_hdr_in = skip_hdr_out = 0;
 	ofile = ffile = NULL;
 	ofd = -1;
 	ffilef = NULL;
 
 	bzero(&filter_config, sizeof(filter_config));
 
-	while ((ch = getopt(argc, argv, "Udf:ho:qv")) != -1) {
+	while ((ch = getopt(argc, argv, "USdf:ho:qsv")) != -1) {
 		switch (ch) {
+		case 'S':
+			skip_hdr_in = 1;
+			break;
 		case 'h':
 			usage();
 			return (0);
@@ -142,6 +153,9 @@ main(int argc, char **argv)
 		case 'q':
 			verbose = -1;
 			break;
+		case 's':
+			skip_hdr_out = 1;
+			break;
 		case 'v':
 			verbose = 1;
 			break;
@@ -175,7 +189,7 @@ main(int argc, char **argv)
 				logerrx("Refusing to write binary flow data to "
 				    "standard output.");
 		}
-		ofd = open_start_log(ofile, debug);
+		ofd = open_start_log(ofile, skip_hdr_out, debug);
 	}
 
 	if (filter_config.store_mask == 0)
@@ -190,14 +204,16 @@ main(int argc, char **argv)
 		else if ((fd = open(argv[i], O_RDONLY)) == -1)
 			logerr("open(%s)", argv[i]);
 
-		if (store_get_header(fd, &hdr, ebuf,
-		    sizeof(ebuf)) != STORE_ERR_OK)
-		    	logerrx("%s", ebuf);
-
-		if (verbose >= 0) {
-			printf("LOGFILE %s started at %s\n", argv[i],
-			    iso_time(ntohl(hdr.start_time), utc));
-			fflush(stdout);
+		if (skip_hdr_in) {
+			if (store_get_header(fd, &hdr, ebuf,
+			    sizeof(ebuf)) != STORE_ERR_OK)
+		    		logerrx("%s", ebuf);
+
+			if (verbose >= 0) {
+				printf("LOGFILE %s started at %s\n", argv[i],
+				    iso_time(ntohl(hdr.start_time), utc));
+				fflush(stdout);
+			}
 		}
 
 		for (;;) {
Index: flowd.c
===================================================================
RCS file: /var/cvs/flowd/flowd.c,v
retrieving revision 1.56
diff -u -p -r1.56 flowd.c
--- flowd.c	28 Apr 2005 09:02:58 -0000	1.56
+++ flowd.c	9 Jul 2005 01:48:55 -0000
@@ -116,7 +116,7 @@ dump_packet(const char *tag, const u_int
 }
 
 static int
-start_log(int monitor_fd)
+start_log(struct flowd_config *conf, int monitor_fd)
 {
 	int fd;
 	off_t pos;
@@ -125,6 +125,9 @@ start_log(int monitor_fd)
 	if ((fd = client_open_log(monitor_fd)) == -1)
 		logerrx("Logfile open failed, exiting");
 
+	if ((conf->opts & FLOWD_OPT_LOG_NOHEADER) != 0)
+		return (fd);
+
 	/* Only write out the header if we are at the start of the file */
 	switch ((pos = lseek(fd, 0, SEEK_END))) {
 	case 0:
@@ -1087,7 +1090,7 @@ flowd_mainloop(struct flowd_config *conf
 			reconf_flag = 0;
 		}
 		if (log_fd == -1)
-			log_fd = start_log(monitor_fd);
+			log_fd = start_log(conf, monitor_fd);
 
 		if (info_flag) {
 			struct filter_rule *fr;
Index: flowd.h
===================================================================
RCS file: /var/cvs/flowd/flowd.h,v
retrieving revision 1.16
diff -u -p -r1.16 flowd.h
--- flowd.h	28 Apr 2005 09:02:58 -0000	1.16
+++ flowd.h	9 Jul 2005 01:48:55 -0000
@@ -66,9 +66,10 @@ struct join_group {
 };
 TAILQ_HEAD(join_groups, join_group);
 
-#define FLOWD_OPT_DONT_FORK		(1)
-#define FLOWD_OPT_VERBOSE		(1<<1)
-#define FLOWD_OPT_INSECURE		(1<<2)
+#define FLOWD_OPT_DONT_FORK		(1)		/* command-line only */
+#define FLOWD_OPT_VERBOSE		(1<<1)		/* command-line only */
+#define FLOWD_OPT_INSECURE		(1<<2)		/* command-line only */
+#define FLOWD_OPT_LOG_NOHEADER		(1<<3)		/* config file only */
 struct flowd_config {
 	char			*log_file;
 	char			*pid_file;
Index: flowd.py
===================================================================
RCS file: /var/cvs/flowd/flowd.py,v
retrieving revision 1.10
diff -u -p -r1.10 flowd.py
--- flowd.py	14 May 2005 07:22:08 -0000	1.10
+++ flowd.py	9 Jul 2005 01:48:55 -0000
@@ -49,11 +49,15 @@ def interval_time_ms(tms):
 	return "%s.%03u" % ( interval_time(int(tms / 1000)), tms % 1000 )
 
 class log:
-	def __init__(self, path, mode = "r", start_time = None):
+	def __init__(self, path, mode = "r", start_time = None,
+	             skip_header = False):
 		self.path = path
 		self.mode = mode
 		if mode == "r":
 			self.flow_file = open(path, "rb")
+			if skip_header:
+				return
+
 			# Read header
 			hdr = self.flow_file.read(16)
 			if len(hdr) != 16:
Index: parse.y
===================================================================
RCS file: /var/cvs/flowd/parse.y,v
retrieving revision 1.30
diff -u -p -r1.30 parse.y
--- parse.y	14 May 2005 06:04:48 -0000	1.30
+++ parse.y	9 Jul 2005 01:48:55 -0000
@@ -103,7 +103,7 @@ static const char *longdays[7] = {
 
 %token	LISTEN ON JOIN GROUP LOGFILE STORE PIDFILE FLOW SOURCE
 %token	ALL TAG ACCEPT DISCARD QUICK AGENT SRC DST PORT PROTO TOS ANY
-%token	TCP_FLAGS EQUALS MASK INET INET6 DAYS AFTER BEFORE
+%token	TCP_FLAGS EQUALS MASK INET INET6 DAYS AFTER BEFORE NOHEADER
 %token	ERROR
 %token	<v.string>		STRING
 %type	<v.number>		number quick logspec not octet tcp_flags tcp_mask af dayname dayrange daylist dayspec daytime 
@@ -393,6 +393,10 @@ conf_main	: LISTEN ON address_port	{
 		| LOGFILE string		{
 			conf->log_file = $2;
 		}
+		| LOGFILE string NOHEADER	{
+			conf->log_file = $2;
+			conf->opts |= FLOWD_OPT_LOG_NOHEADER;
+		}
 		| PIDFILE string		{
 			conf->pid_file = $2;
 		}
@@ -815,6 +819,7 @@ lookup(char *s)
 		{ "listen",		LISTEN},
 		{ "logfile",		LOGFILE},
 		{ "mask",		MASK},
+		{ "noheader",		NOHEADER},
 		{ "on",			ON},
 		{ "pidfile",		PIDFILE},
 		{ "port",		PORT},
Index: Flowd-perl/lib/Flowd.pm
===================================================================
RCS file: /var/cvs/flowd/Flowd-perl/lib/Flowd.pm,v
retrieving revision 1.2
diff -u -p -r1.2 Flowd.pm
--- Flowd-perl/lib/Flowd.pm	14 May 2005 07:22:08 -0000	1.2
+++ Flowd-perl/lib/Flowd.pm	9 Jul 2005 01:48:55 -0000
@@ -135,6 +135,7 @@ sub new {
 sub init {
 	my $self = shift;
 	my $filename = shift;
+	my $skip_header = shift;
 	my $fhandle;
 	my $hdr;
 	my $r;
@@ -142,6 +143,8 @@ sub init {
 	$self->{filename} = $filename;
 	open($fhandle, "<$filename") or die "open($filename): $!";
 	$self->{handle} = $fhandle;
+
+	return if defined $skip_header and $skip_header != 0;
 
 	# Read initial header
 	$r = read($self->{handle}, $hdr, 16);
