Re: introduce 'pfctl -FR' to reset settings to defaults

2019-04-09 Thread Alexandr Nedvedicky
Hello Klemens, On Tue, Apr 09, 2019 at 04:02:06PM +0200, Klemens Nanni wrote: > OK either way, but see below. > > On Mon, Apr 08, 2019 at 09:56:46AM +0200, Alexandr Nedvedicky wrote: > > + pf.ifname = strdup("none"); > > + if (pf.ifname == NULL) > > + err(1, "%s: strdup",

Re: introduce 'pfctl -FR' to reset settings to defaults

2019-04-09 Thread Klemens Nanni
OK either way, but see below. On Mon, Apr 08, 2019 at 09:56:46AM +0200, Alexandr Nedvedicky wrote: > + pf.ifname = strdup("none"); > + if (pf.ifname == NULL) > + err(1, "%s: strdup", __func__); > + else > + pf.ifname_set = 1; This branch is redundant and

Re: introduce 'pfctl -FR' to reset settings to defaults

2019-04-08 Thread Alexandr Nedvedicky
Hello, > We should fail hard as in almost all other strdup(3) use cases. > Failure means the system ran out of memory, there's no point in going > any further. > > So just something like > > pf.ifname = strdup("none"); > if (pf.ifname == NULL) > err(1, "%s: strdup",

Re: introduce 'pfctl -FR' to reset settings to defaults

2019-04-06 Thread Klemens Nanni
On Sat, Apr 06, 2019 at 02:37:05AM +0200, Alexandr Nedvedicky wrote: > updated diff is attached. I'll commit the change after unlock. OK kn with comments inline. > + pf.ifname = strdup("none"); > + if (pf.ifname == NULL) > + warn("%s: Warning: can't reset loginterface\n",

Re: introduce 'pfctl -FR' to reset settings to defaults

2019-04-06 Thread Gleydson Soares
+void > +pfctl_reset(int dev, int opts) > +{ > + struct pfctlpf; > + struct pfr_buffer t; > + int i; > + > + pf.dev = dev; > + pfctl_init_options(); > + > + /* Force reset upon pfctl_load_options() */ > + pf.debug_set = 1; > + pf.reass_set = 1; > +

Re: introduce 'pfctl -FR' to reset settings to defaults

2019-04-05 Thread Alexandr Nedvedicky
Hello, > > +void > > +pfctl_reset(int dev, int opts) > > +{ > > + struct pfctlpf; > > + struct pfr_buffer t; > > + int i; > > + > > + pf.dev = dev; > > + pfctl_init_options(); > > + > > + /* Force reset upon pfctl_load_options() */ > > + pf.debug_set = 1; > > +

Re: introduce 'pfctl -FR' to reset settings to defaults

2019-04-05 Thread Hiltjo Posthuma
On Wed, Apr 03, 2019 at 11:10:21AM +0200, Alexandr Nedvedicky wrote: > Hello, > > On Tue, Apr 02, 2019 at 11:28:43AM +0200, Petr Hoffmann wrote: > > Hi, > > > > seeing this in the manpage > > --8<-- > > +.It Fl F Cm Reset >

Re: introduce 'pfctl -FR' to reset settings to defaults

2019-04-03 Thread Ted Unangst
Alexandr Nedvedicky wrote: > below is the diff I'd like to commit. this is fine with me.

Re: introduce 'pfctl -FR' to reset settings to defaults

2019-04-03 Thread Klemens Nanni
On Wed, Apr 03, 2019 at 11:10:21AM +0200, Alexandr Nedvedicky wrote: > I did look at pf.conf(5) manpage yesterday. It requires more updates, > which > I would like to leave for another diff. For example pf.conf(5) does not > mention default values for limits and time outs. I expect

Re: introduce 'pfctl -FR' to reset settings to defaults

2019-04-03 Thread Alexandr Nedvedicky
Hello, On Tue, Apr 02, 2019 at 11:28:43AM +0200, Petr Hoffmann wrote: > Hi, > > seeing this in the manpage > --8<-- > +.It Fl F Cm Reset > +Reset limits, timeouts and options back to default settings. >

Re: introduce 'pfctl -FR' to reset settings to defaults

2019-04-02 Thread Klemens Nanni
On Tue, Apr 02, 2019 at 02:01:05PM +0200, Alexandr Nedvedicky wrote: > I think Petr is right here. my patch requires yet another finishing touch: Fair enough, but it should be noted that this somewhat changes behaviour of the existing interface: >

Re: introduce 'pfctl -FR' to reset settings to defaults

2019-04-02 Thread Alexandr Nedvedicky
Hello, On Tue, Apr 02, 2019 at 12:59:33PM +0200, Petr Hoffmann wrote: > On 02.04.2019 12:06, Klemens Nanni wrote: > >On Tue, Apr 02, 2019 at 11:28:43AM +0200, Petr Hoffmann wrote: > >>would make me believe everything mentioned as OPTIONS in pf.conf(5) is about > >>to be reset. I see e.g. the

Re: introduce 'pfctl -FR' to reset settings to defaults

2019-04-02 Thread Petr Hoffmann
On 02.04.2019 12:06, Klemens Nanni wrote: On Tue, Apr 02, 2019 at 11:28:43AM +0200, Petr Hoffmann wrote: would make me believe everything mentioned as OPTIONS in pf.conf(5) is about to be reset. I see e.g. the debug level is reset, but what about the other stuff like fingerprints, 'skip on' and

Re: introduce 'pfctl -FR' to reset settings to defaults

2019-04-02 Thread Klemens Nanni
On Tue, Apr 02, 2019 at 11:28:43AM +0200, Petr Hoffmann wrote: > would make me believe everything mentioned as OPTIONS in pf.conf(5) is about > to be reset. I see e.g. the debug level is reset, but what about the other > stuff like fingerprints, 'skip on' and other options set via the 'set' >

Re: introduce 'pfctl -FR' to reset settings to defaults

2019-04-02 Thread Petr Hoffmann
Hi, seeing this in the manpage --8<-- +.It Fl F Cm Reset +Reset limits, timeouts and options back to default settings. -->8-- would make me believe

Re: introduce 'pfctl -FR' to reset settings to defaults

2019-04-02 Thread Alexandr Nedvedicky
Hello, below is diff I plan to commit. I did add a comment to pfctl_reset() and wording in manpage. thanks and regards sashan 8<---8<---8<---8<--- diff --git a/sbin/pfctl/pfctl.8 b/sbin/pfctl/pfctl.8 index 48b2893cfcd..00bd27c200a 100644 ---

Re: introduce 'pfctl -FR' to reset settings to defaults

2019-03-28 Thread Alexandr Nedvedicky
Hello, > > +Flush all of the above (+ reset settings). > This is fine as is, I think. > > > +void pfctl_restore_defaults(int, int); > Why not simply pfctl_reset()? I had used pfctl_reset() at some point of history, then I stopped to like it. Now I like it again. updated diff

Re: introduce 'pfctl -FR' to reset settings to defaults

2019-03-28 Thread Klemens Nanni
On Wed, Mar 27, 2019 at 02:17:03AM +0100, Alexandr Nedvedicky wrote: > tedu@ has planted idea for diff below here [1]. That particular email is part > of thread [2], where various cleanup/unconfigure options for PF are discussed. > To keep progressing in small steps I've decided to factor out the

introduce 'pfctl -FR' to reset settings to defaults

2019-03-26 Thread Alexandr Nedvedicky
Hello, tedu@ has planted idea for diff below here [1]. That particular email is part of thread [2], where various cleanup/unconfigure options for PF are discussed. To keep progressing in small steps I've decided to factor out the first diff here, which introduces '-FR' (a.k.a. reset settings)