pftabled

Daniel Hartmeier daniel at benzedrine.cx
Mon Jan 24 23:36:43 PST 2005


On Mon, Jan 24, 2005 at 10:35:30PM -0600, Nick Buraglio wrote:

> Anyone gotten pftabled ( http://www.wolfermann.org/pftabled.html )to 
> compile on freebsd 5.3?  I find it immensely useful under openbsd for 
> managing tables but under free it bombs with
> 
>  pftabled.c:53: error: variable `sdata' has initializer but incomplete 
> type
> 
> I don't really know c, but I think it means that there is something 
> defined in a struct that isn't being found where it's expected.

It's using the reentrant syslog functions from OpenBSD. Since they're
not called from a signal handler, that's not really needed. You can just
switch to the standard versions with the patch below, which builds on
FreeBSD 5.3.

Daniel


--- ../pftabled-1.04.orig/pftabled.c	Sun Sep 12 17:53:22 2004
+++ pftabled.c	Tue Jan 25 08:37:02 2005
@@ -50,7 +50,7 @@
 #define PFDEV "/dev/pf"
 static int pfdev = -1;
 
-static struct syslog_data sdata = SYSLOG_DATA_INIT;
+static int daemonize = 0;
 
 static int timeout = 0;
 
@@ -70,8 +70,8 @@
 
 	va_start(ap, fmt);
 
-	if (sdata.opened) {
-		vsyslog_r(level, &sdata, fmt, ap);
+	if (daemonize) {
+		vsyslog(level, fmt, ap);
 	} else {
 		fprintf(stderr, "%s: ", __progname);
 		vfprintf(stderr, fmt, ap);
@@ -194,7 +194,6 @@
 
 	/* Options and their defaults */
 	char *address = NULL;
-	int daemonize = 0;
 	char *forced = NULL;
 	char key[SHA1_DIGEST_LENGTH];
 	int port = 56789;
@@ -264,7 +263,6 @@
 	/* Daemonize if requested */
 	if (daemonize) {
 		tzset();
-		openlog_r("pftabled", LOG_PID|LOG_NDELAY, LOG_DAEMON, &sdata);
 
 		if (daemon(0, 0) == -1)
 			err(1, "daemon");


More information about the freebsd-pf mailing list