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

(cherry picked from commit 185c1cddd7ef34db82bc3a25b3c92556416a4e55)

Details

Provenance
kpAuthored on Jun 2 2023, 2:38 PM
Reviewer
cy
Differential Revision
D40395: netinet: re-read IP length after PFIL hook
Parents
rG12ce57e6d3e7: pcib: Allocate the memory BAR with the MSI-X table.
Branches
Unknown
Tags
Unknown