ip6_tryforward() compares the packet with the MTU of the route it
looked up before the outbound pfil hooks. When those hooks change the
destination or choose the next hop (ipfw fwd), it looks up the route
again, but sends the packet without a second check. A packet too large
for the new route goes out oversize, to be dropped or sent anyway by the
interface, and its sender never gets a packet-too-big; one that fits
the new route but not the old one gets one it should not.
ip6_forward() and ip_tryforward() check the MTU of the route they send
by. So far this only shows when net.inet6.ip6.redirect is 0.
Check it once, at passout, after the outbound hooks and the second
lookup. A packet a hook sends to a local address now goes back to
ip6_input() before the check, as in ip6_forward(). The new
fwd:nexthop_mtu_v6 test covers both directions on both forwarding
paths.
Fixes: 5a1842a2 ("Add ip6_tryforward() - a run to completion ...")
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")