[PATCH] pfctl configuration file parser

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] pfctl configuration file parser

Julien Dhaille
Hi,
Most of daemons like bgpd, ospfd, smtpd, relayd, ... use to return
"configuration OK" when the parsing of configuration file is correct.
This patch probably seems useless, it's just a thought to stay coherent
with an uniform behavior.


Index: pfctl.c
===================================================================
RCS file: /cvs/src/sbin/pfctl/pfctl.c,v
retrieving revision 1.314
diff -u -r1.314 pfctl.c
--- pfctl.c     19 Sep 2012 15:52:17 -0000      1.314
+++ pfctl.c     23 Jan 2013 23:46:48 -0000
@@ -1342,6 +1342,8 @@
                            "pf rules not loaded");
                else
                        goto _error;
+       } else {
+               fprintf(stderr, "configuration OK\n");
        }

        if (pfctl_load_ruleset(&pf, path, rs, 0)) {



Cheers
--
Julien Dhaille

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] pfctl configuration file parser

Julien Dhaille
Oops.
This one is better, only display on :
# pfctl -nf /etc/pf.conf

Cheers

Index: pfctl.c
===================================================================
RCS file: /cvs/src/sbin/pfctl/pfctl.c,v
retrieving revision 1.314
diff -u -r1.314 pfctl.c
--- pfctl.c     19 Sep 2012 15:52:17 -0000      1.314
+++ pfctl.c     24 Jan 2013 07:30:15 -0000
@@ -2123,6 +2123,7 @@
                opts &= ~ (PF_OPT_DISABLE | PF_OPT_ENABLE);
                clearopt = showopt = debugopt = NULL;
                altqsupport = 1;
+               fprintf(stderr, "configuration OK\n");
        }

        if (opts & PF_OPT_DISABLE)


--
Julien Dhaille

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] pfctl configuration file parser

Janne Johansson-3
Yes, I think the usual "programs should not print if the normal
operation went fine" style should keep pfctl -f some-file quiet.
Having output in the specific config test mode would not hurt, but
it's not something I've been longing for.

2013/1/24 Julien Dhaille <[hidden email]>:

> Oops.
> This one is better, only display on :
> # pfctl -nf /etc/pf.conf
>
> Cheers
>
> Index: pfctl.c
> ===================================================================
> RCS file: /cvs/src/sbin/pfctl/pfctl.c,v
> retrieving revision 1.314
> diff -u -r1.314 pfctl.c
> --- pfctl.c     19 Sep 2012 15:52:17 -0000      1.314
> +++ pfctl.c     24 Jan 2013 07:30:15 -0000
> @@ -2123,6 +2123,7 @@
>                 opts &= ~ (PF_OPT_DISABLE | PF_OPT_ENABLE);
>                 clearopt = showopt = debugopt = NULL;
>                 altqsupport = 1;
> +               fprintf(stderr, "configuration OK\n");
>         }
>
>         if (opts & PF_OPT_DISABLE)
>
>
> --
> Julien Dhaille
>



--
May the most significant bit of your life be positive.

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] pfctl configuration file parser

sven falempin
printf $?

On Thu, Jan 24, 2013 at 2:45 AM, Janne Johansson <[hidden email]>wrote:

> Yes, I think the usual "programs should not print if the normal
> operation went fine" style should keep pfctl -f some-file quiet.
> Having output in the specific config test mode would not hurt, but
> it's not something I've been longing for.
>
> 2013/1/24 Julien Dhaille <[hidden email]>:
> > Oops.
> > This one is better, only display on :
> > # pfctl -nf /etc/pf.conf
> >
> > Cheers
> >
> > Index: pfctl.c
> > ===================================================================
> > RCS file: /cvs/src/sbin/pfctl/pfctl.c,v
> > retrieving revision 1.314
> > diff -u -r1.314 pfctl.c
> > --- pfctl.c     19 Sep 2012 15:52:17 -0000      1.314
> > +++ pfctl.c     24 Jan 2013 07:30:15 -0000
> > @@ -2123,6 +2123,7 @@
> >                 opts &= ~ (PF_OPT_DISABLE | PF_OPT_ENABLE);
> >                 clearopt = showopt = debugopt = NULL;
> >                 altqsupport = 1;
> > +               fprintf(stderr, "configuration OK\n");
> >         }
> >
> >         if (opts & PF_OPT_DISABLE)
> >
> >
> > --
> > Julien Dhaille
> >
>
>
>
> --
> May the most significant bit of your life be positive.
>
>


--
---------------------------------------------------------------------------------------------------------------------
() ascii ribbon campaign - against html e-mail
/\