diff options
author | Toshi Kikuchi <toshik@google.com> | 2020-11-30 16:34:33 -0800 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-11-30 16:36:51 -0800 |
commit | 54ad145f2eb6d16a3a18b69e1c2adfa558639b72 (patch) | |
tree | 01fc9e79c350d524342684efb10ae17e998c12fc /pkg/tcpip/network/ipv4 | |
parent | 786f32c2b1c1fa6a84603758ae93edbaa24b4720 (diff) |
Add more fragment reassembly tests
These tests check if a maximum-sized (64k) packet is reassembled without
receiving a fragment with MF flag set to zero.
PiperOrigin-RevId: 344913172
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 2e96dabfe..9b660eef0 100644 --- a/pkg/tcpip/network/ipv4/ipv4_test.go +++ b/pkg/tcpip/network/ipv4/ipv4_test.go @@ -2424,6 +2424,28 @@ func TestReceiveFragments(t *testing.T) { }, expectedPayloads: [][]byte{udpPayload4Addr1ToAddr2}, }, + { + name: "Two fragments with MF flag reassembled into a maximum UDP packet", + fragments: []fragmentData{ + { + srcAddr: addr1, + dstAddr: addr2, + id: 1, + flags: header.IPv4FlagMoreFragments, + fragmentOffset: 0, + payload: ipv4Payload4Addr1ToAddr2[:65512], + }, + { + srcAddr: addr1, + dstAddr: addr2, + id: 1, + flags: header.IPv4FlagMoreFragments, + fragmentOffset: 65512, + payload: ipv4Payload4Addr1ToAddr2[65512:], + }, + }, + expectedPayloads: nil, + }, } for _, test := range tests { |