have pf_route{,6} clear the pf_pdesc mbuf ref early for route-to/reply-to.
authordlg <dlg@openbsd.org>
Wed, 27 Jan 2021 04:46:21 +0000 (04:46 +0000)
committerdlg <dlg@openbsd.org>
Wed, 27 Jan 2021 04:46:21 +0000 (04:46 +0000)
commit80bc0a3f809e78e72d30f4d949cd97e1054ca935
tree9b88762d903f6f2cc6a52ac2bff9ef3010684dd2
parent670ae1ca2f741f5623d5b74af4ffbda999c3e86d
have pf_route{,6} clear the pf_pdesc mbuf ref early for route-to/reply-to.

pf_route and pf_route6 are called to take over delivery of the
packet with route-to and reply-to instead of letting it get processed
normally. for the dup-to handling, it copies the mbuf but leaves
the original mbuf in place. pf_route takes over the packet by
clearing the mbuf pointer in the pf_pdesc struct. this diff moves
the clearing of that pointer to the start of the function, rather
than checking for dup-to again on the way out of the function.

i think this is better because it means that it's more robust in
the face of future code changes. even if that's not true, it's still
shorter code in a forwarding path.

ok sashan@ jmatthew@
sys/net/pf.c