pf: Make ":0" (noalias) also ignore link-local IPv6 addresses
authorAaron LI <aly@aaronly.me>
Sun, 1 May 2022 04:59:57 +0000 (12:59 +0800)
committerAaron LI <aly@aaronly.me>
Sun, 1 May 2022 04:59:57 +0000 (12:59 +0800)
commit6aa338e1205b533679b84dd50b38f5664f0d9cef
tree87c82ceafd75f8b79330bf22f89931b8b502485f
parent1f4644306e2abec3b56e1ef6ef21613ff4c991ad
pf: Make ":0" (noalias) also ignore link-local IPv6 addresses

When users mark an interface to not use aliases they likely also don't
want to use the link-local IPv6 address there.

For example, with the following rule to NAT IPv6:

nat on $ext_if inet6 from $int_if:network to !$int_if:network -> ($ext_if:0)

PF was selecting the link-local address (which comes the first) for the
NAT'ed IPv6 address, which was wrong and broke the NAT setup.

This commit makes PF to ignore the link-local IPv6 addresses so that the
above NAT setup would work.

Obtained-from: FreeBSD (revision 339835, review D17633)
See also: https://lists.freebsd.org/pipermail/freebsd-pf/2014-September/007441.html
share/man/man5/pf.conf.5
sys/net/pf/pf_if.c
usr.sbin/pfctl/pfctl_parser.c