forked from zephyrproject-rtos/zephyr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
net: ipv6_fragment: improve reassembly condition
Currently net_ipv6_handle_fragment_hdr() performs 2 distinct tests: it checks the M-bit of the most recent fragment to decide if we can proceed with the reassembly. Then it performs some sanity checks which can lead to dropping the whole packet if not successful. The test on the M-bit assumes that fragments arrive in order. But this will fail if packets arrive out-of-order, since the last fragment can arrive before some other fragments. In that case, we proceed with the reassembly but it will fail because not all the fragments have been received. We need a more complete check before proceeding with the reassembly: - We received the first fragment (offset = 0) - All intermediate fragments are contiguous - The More bit of the last fragment is 0 Since these conditions can also detect a malformed fragmented packet, we can replace the existing sanity check that is performed before reassembly. As a bonus, we can now detect and rejected overlapping fragments, since this can have some security issues (see RFC 5722). Signed-off-by: Florian Vaussard <[email protected]>
- Loading branch information
Showing
1 changed file
with
54 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters