pf: cope with missing rpool.cur
authorKristof Provost <kp@FreeBSD.org>
Tue, 3 Oct 2023 15:11:44 +0000 (17:11 +0200)
committerKristof Provost <kp@FreeBSD.org>
Wed, 4 Oct 2023 08:16:03 +0000 (10:16 +0200)
commit74c2461386ea5eeb41e674df6b16a44b0509a882
tree8fb8cfa8d067f5fd9880192324c78df56f373c7b
parent6c38c6b1b917957d420902213f318bf0153214f2
pf: cope with missing rpool.cur

If we're evaluating a pfsync'd state (and have different rules on both
ends) our state may point to the default rule, which does not have
rpool.cur set. As a result we can end up dereferencing a NULL pointer.

Explicitly check for this when we try to re-construct the route-to interface.

Also add a test case which can trigger this issue.

MFC after: 3 days
See also: https://redmine.pfsense.org/issues/14804
Sponsored by: Rubicon Communications, LLC ("Netgate")
sys/netpfil/pf/pf.c
tests/sys/netpfil/pf/pfsync.sh