diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -195,6 +195,15 @@ #error PF_QNAME_SIZE must be equal to PF_TAG_NAME_SIZE #endif +#ifdef PF_DEFAULT_TO_DROP +static bool default_to_drop = true; +#else +static bool default_to_drop; +#endif +SYSCTL_BOOL(_net_pf, OID_AUTO, default_to_drop, CTLFLAG_RDTUN, + &default_to_drop, false, + "Make the default rule drop all packets."); + static void pf_init_tagset(struct pf_tagset *, unsigned int *, unsigned int); static void pf_cleanup_tagset(struct pf_tagset *); @@ -331,11 +340,7 @@ /* default rule should never be garbage collected */ V_pf_default_rule.entries.tqe_prev = &V_pf_default_rule.entries.tqe_next; -#ifdef PF_DEFAULT_TO_DROP - V_pf_default_rule.action = PF_DROP; -#else - V_pf_default_rule.action = PF_PASS; -#endif + V_pf_default_rule.action = default_to_drop ? PF_DROP : PF_PASS; V_pf_default_rule.nr = -1; V_pf_default_rule.rtableid = -1;