pf: emit ICMPv6 packet too big for route-to

Based on OpenBSD's ae08e5b41d6 (by sashan <sashan@openbsd.org>). We already
implemented most of this (i.e. the refragmenting) but we did not send the
packet-too-big error.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
This commit is contained in:
Kristof Provost 2025-04-09 14:38:39 +02:00
parent 22921f4b4a
commit d1f4b9ffab

View file

@ -43,6 +43,7 @@
#include <net/if.h>
#include <net/if_var.h>
#include <net/if_private.h>
#include <net/vnet.h>
#include <net/pfvar.h>
#include <net/if_pflog.h>
@ -1051,7 +1052,13 @@ pf_refragment6(struct ifnet *ifp, struct mbuf **m0, struct m_tag *mtag,
dst.sin6_len = sizeof(dst);
dst.sin6_addr = hdr->ip6_dst;
nd6_output_ifp(rt, rt, m, &dst, NULL);
if (m->m_pkthdr.len <= if_getmtu(ifp)) {
nd6_output_ifp(rt, rt, m, &dst, NULL);
} else {
in6_ifstat_inc(ifp, ifs6_in_toobig);
icmp6_error(m, ICMP6_PACKET_TOO_BIG, 0,
if_getmtu(ifp));
}
} else if (forward) {
MPASS(m->m_pkthdr.rcvif != NULL);
ip6_forward(m, 0);