HomeFreeBSD

pf: Move route-to information to rule actions

Description

pf: Move route-to information to rule actions

Route-to redirection information (rt, rt_kif, rt_addr) can be considered an
action of a rule. This information is duplicated in struct pf_kstate which
means that the pf_route() function must always figure out where to get this
information from: state for stateful forwarding, or rule for stateless.

Create the necessary members in struct pf_rule_action. Fill them in right after
parsing the ruleset, similar for how NAT redirection is applied right after
parsing the NAT ruleset. Remove the logic for finding the right source for
route-to redirection from pf_route().

As a bonus simplify pf_map_addr_sn() and source node handling. Both for the
NAT and the filter ruleset there is now only one path:

  1. parse the rules
  2. apply redirection either from an existing source node or by load balancing for the last matching rule
  3. create the source node using the redirection if the node does not yet exist

Reviewed by: kp
Approved by: kp (mentor)
Sponsored by: InnoGames GmbH
Differential Revision: https://reviews.freebsd.org/D47827

Details

Provenance
vegeta_tuxpowered.netAuthored on Nov 28 2024, 1:08 PM
Reviewer
kp
Differential Revision
D47827: Draft: pf: Move route-to information to pf_rule_actions
Parents
rG6b17d944a1d4: rc.d/sendmail: Fix error with some configurations
Branches
Unknown
Tags
Unknown