pftabled
Nick Buraglio
nick at buraglio.com
Tue Jan 25 07:36:28 PST 2005
Excellent. Thanks. The author also provided a patch, which I tested
as good on freebsd 5.3.
Thanks again for the quick responses!
nb
--- pftabled.c.orig Tue Jan 25 09:26:16 2005
+++ pftabled.c Tue Jan 25 09:28:37 2005
@@ -50,7 +50,11 @@
#define PFDEV "/dev/pf"
static int pfdev = -1;
+#ifdef __FreeBSD__
+static int use_syslog = 0;
+#else
static struct syslog_data sdata = SYSLOG_DATA_INIT;
+#endif
static int timeout = 0;
@@ -70,8 +74,13 @@
va_start(ap, fmt);
+#ifdef __FreeBSD__
+ if (use_syslog) {
+ vsyslog(level, fmt, ap);
+#else
if (sdata.opened) {
vsyslog_r(level, &sdata, fmt, ap);
+#endif
} else {
fprintf(stderr, "%s: ", __progname);
vfprintf(stderr, fmt, ap);
@@ -264,7 +273,11 @@
/* Daemonize if requested */
if (daemonize) {
tzset();
+#ifdef __FreeBSD__
+ use_syslog = 1;
+#else
openlog_r("pftabled", LOG_PID|LOG_NDELAY, LOG_DAEMON, &sdata);
+#endif
if (daemon(0, 0) == -1)
err(1, "daemon");
------------
- Nick Buraglio, Network Engineer, NCSA
- Phone: 217.244.6428
- GnuPG Key: 0x2E5B44F4
------------
On Jan 25, 2005, at 1:36 AM, Daniel Hartmeier wrote:
> 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