#
65c31863 |
| 01-Aug-2025 |
Kajetan Staszkiewicz <ks@FreeBSD.org> |
pf: Add prefer-ipv6-nexthop option for route-to pools
Now that pf is aware of address family of each pool address and source tracking uses distinct address family for source and redirection adddress
pf: Add prefer-ipv6-nexthop option for route-to pools
Now that pf is aware of address family of each pool address and source tracking uses distinct address family for source and redirection adddresses it is possible to add a new pool option prefer-ipv6-nexthop which enables routing of IPv4 packets over IPv6 next hops for rules with the route-to option.
Add a pool option flag PF_POOL_IPV6NH, apply it to pools with a keyword prefer-ipv6-nexthop.
Modify pf_map_addr() to handle pools with addresses of different families. Use *naf as a hint about what address family the forwarded packet is, then pick from the pool addresses of family that can be used as a next hop for the forwarded packet, controlled by the PF_POOL_IPV6NH flag. For NAT pools this flag is never set and thus pf_map_addr() will return an IP address of the same family as the forwarded packet. For route-to pools when the flag is enabled IPv6 addresses can be returned or IPv4 packets.
In pf_route() check rt_af, it is not guaranteed to be AF_INET anymore because pf_map_addr() could have changed it (as *naf).
Add tests for behaviour of pf_map_addr() both with PF_POOL_IPV6NH and without, for single IP addresses, prefixes and subnets.
Reviewed by: kp Sponsored by: InnoGames GmbH Differential Revision: https://reviews.freebsd.org/D50781
show more ...
|