HomeFreeBSD

netinet: re-read IP length after PFIL hook

Description

netinet: re-read IP length after PFIL hook

The pfil hook may modify the packet, so before we check its length (to
decide if it needs to be fragmented or not) we should re-read that
length.

This is most likely to happen when pf is reassembling packets. In that
scenario we'd receive the last fragment, which is likely to be a short
packet, pf would reassemble it (likely exceeding the interface MTU) and
then we'd transmit it without fragmenting, because we're comparing the
MTU to the length of the last fragment, not the fully reassembled
packet.

See also: https://redmine.pfsense.org/issues/14396
Reviewed by: cy
MFC after: 3 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D40395

Details

Provenance
kpAuthored on Jun 2 2023, 2:38 PM
Reviewer
cy
Differential Revision
D40395: netinet: re-read IP length after PFIL hook
Parents
rGa9bfd080d09a: if_epair: do not transmit packets that exceed the interface MTU
Branches
Unknown
Tags
Unknown