[patch] Source entries removing is awfully slow.

Gleb Smirnoff glebius at FreeBSD.org
Thu Dec 5 08:19:07 UTC 2013


  Kajetan,

On Wed, Dec 04, 2013 at 03:29:21PM +0100, Kajetan Staszkiewicz wrote:
K> Dnia poniedziałek, 2 grudnia 2013 o 17:39:27 Gleb Smirnoff napisał(a):
K> 
K> > I won't object on any interface that is consistent and resides in the
K> > '-K' and '-k' namespace. As said before, I am against utilizing new
K> > letters for options to avoid clashing with pfctl syntax in OpenBSD.
K> 
K> I have a nice commandline parser working, but I got blocked by one problem. As 
K> the parser is quite big and most options are common for -K and -k, the parser 
K> is just one function for both operation modes (and a similar thing for the 
K> loops going over IP addresses found by given host names). Unfortunately 
K> DIOCKILLSTATES and DIOCKILLSRCNODES are using separate structures.
K> 
K> Whatever the parser reads, it puts the result in the following structure 
K> (defined only inside pfctl, not kernel):
K> 
K> struct pfioc_universal_kill {
K>         sa_family_t             puk_af;
K>         int                     puk_proto;
K>         struct pf_rule_addr     puk_src;
K>         struct pf_rule_addr     puk_dst;
K>         struct pf_rule_addr     puk_rdr;
K>         struct pf_state_cmp     puk_pfcmp;
K>         char                    puk_ifname[IFNAMSIZ];
K>         char                    puk_label[PF_RULE_LABEL_SIZE];
K>         char                    puk_table[PF_TABLE_NAME_SIZE];
K>         u_int                   puk_killed_states;
K>         u_int                   puk_killed_src_nodes;
K> };
K> 
K> Which later gets translated for every ioctl to pfioc_src_node_kill or 
K> pfioc_state_kill.
K> 
K> To have the most clean and simple code it would make the most sense to use the 
K> aforementioned pfioc_universal_kill for both DIOCKILLSTATES and 
K> DIOCKILLSRCNODES. But that would be a change of kernel api which I assume can 
K> not take place inside major release, so translation of structures is currently 
K> the way to go. Please correct me if I am wrong.

It is okay to add new API.

So in head we will add new API/ABI, then remove obsoleted one. We will merge
only addition to stable/10, not removal.

The ABI constraints for stable branches are the following. Newer kernel must
work with older utilities. So, 10.1 kernel will work with pfctl from 10.0, since
old ioctls are still supported.

-- 
Totus tuus, Glebius.


More information about the freebsd-pf mailing list