diff options
author | Arthur Sfez <asfez@google.com> | 2020-08-17 10:04:03 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-08-17 10:19:11 -0700 |
commit | 58154194b3e472cf476be6bf0530bf271d1d29f8 (patch) | |
tree | 8ca83c0b9674112fe800f20102bdfb833bc24f20 /pkg/tcpip/network/ipv4 | |
parent | 97263e505324b7d1c58a3daaac7175241921998f (diff) |
Add a unit test for out of order IP reassembly
PiperOrigin-RevId: 327042869
Diffstat (limited to 'pkg/tcpip/network/ipv4')
-rw-r--r-- | pkg/tcpip/network/ipv4/ipv4_test.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/pkg/tcpip/network/ipv4/ipv4_test.go b/pkg/tcpip/network/ipv4/ipv4_test.go index afd3ac06d..197e3bc51 100644 --- a/pkg/tcpip/network/ipv4/ipv4_test.go +++ b/pkg/tcpip/network/ipv4/ipv4_test.go @@ -628,6 +628,28 @@ func TestReceiveFragments(t *testing.T) { expectedPayloads: [][]byte{udpPayload1Addr1ToAddr2}, }, { + name: "Two fragments out of order", + fragments: []fragmentData{ + { + srcAddr: addr1, + dstAddr: addr2, + id: 1, + flags: 0, + fragmentOffset: 64, + payload: ipv4Payload1Addr1ToAddr2[64:], + }, + { + srcAddr: addr1, + dstAddr: addr2, + id: 1, + flags: header.IPv4FlagMoreFragments, + fragmentOffset: 0, + payload: ipv4Payload1Addr1ToAddr2[:64], + }, + }, + expectedPayloads: [][]byte{udpPayload1Addr1ToAddr2}, + }, + { name: "Two fragments with last fragment size not a multiple of fragment block size", fragments: []fragmentData{ { |