Re: pf: "set skip on tap" is lost when vmd destroys and recreates tap(4)
Alexander Bluhm <[email protected]>
| Newsgroups | gmane.os.openbsd.bugs |
|---|---|
| Message-ID | <[email protected]> |
On Sun, Apr 19, 2026 at 11:53:10AM +0200, Alexandr Nedvedicky wrote:
> the /etc/pf.conf on that test box contained two 'set skip on' statements
> for lo0 interface. Diff below avoids the assert on that box.
>
> OK ?
OK bluhm@
> --------8<---------------8<---------------8<------------------8<--------
> diff --git a/sys/net/pf_if.c b/sys/net/pf_if.c
> index 0c6681e757e..bba7237c904 100644
> --- a/sys/net/pf_if.c
> +++ b/sys/net/pf_if.c
> @@ -854,8 +854,22 @@ pfi_set_flags(const char *name, int flags)
> } else
> panic("%s pfi_kif_get() returned NULL\n",
> __func__);
> - } else
> + } else {
> + /*
> + * pf.conf may accidentally contain two set skip on ...
> + * statements. For example:
> + * set skip lo
> + * set skip lo
> + * We need to grab reference only when skip flag is
> + * set to avoid tripping assert pfi_clear_flags()
> + */
> + if (ISSET(flags, PFI_IFLAG_SKIP) &&
> + !ISSET(p->pfik_flags_new, PFI_IFLAG_SKIP) &&
> + !ISSET(p->pfik_flags, PFI_IFLAG_SKIP))
> + pfi_kif_ref(p, PFI_KIF_REF_FLAG);
> +
> p->pfik_flags_new = p->pfik_flags | flags;
> + }
> } else {
> RB_FOREACH(p, pfi_ifhead, &pfi_ifs)
> p->pfik_flags_new = p->pfik_flags | flags;
>
>