pf: work around icmp6 packet-too-big not being sent when binat-ing
authorKristof Provost <kp@FreeBSD.org>
Wed, 17 Jan 2024 17:11:27 +0000 (18:11 +0100)
committerKristof Provost <kp@FreeBSD.org>
Mon, 22 Jan 2024 11:52:14 +0000 (12:52 +0100)
commit54c62e3e5d8cd90c5571a1d4c8c5f062d580480e
tree1a18e5b3e2cb7d34d7e3195918cebca2c148e096
parentf7d3d0a4ded35ba15d63cdf9287b4a2d6f80da11
pf: work around icmp6 packet-too-big not being sent when binat-ing

If we're applying NPTv6 we pass a packet with a modified source and/or
destination address to the network stack.

If that packet then turns out to be larger than the MTU of the sending
interface the stack will attempt to generate an icmp6 packet-too-big
error, but may fail to look up the appropriate source address for that
error message. Even if it does, pf would still have to undo the binat
operation inside the icmp6 packet so the sending host can make sense of
the error.

We can avoid both problems entirely by having pf also perform the MTU
check (taking the potential refragmentation into account), and
generating the icmp6 error directly in pf.

See also: https://redmine.pfsense.org/issues/14290
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D43499
sys/net/pfvar.h
sys/netpfil/pf/pf.c
sys/netpfil/pf/pf_norm.c