Commit Graph

11 Commits

Author SHA1 Message Date
Ting-Yu Wang 825c185dc5 Make fragmentation return a reassembled PacketBuffer
This allows later decoupling of the backing network buffer implementation.

PiperOrigin-RevId: 354643297
2021-01-29 17:37:29 -08:00
Toshi Kikuchi 08d36b6c63 Reduce the memory overhead in IP fragment management
- Deep-copy pkt.Data and hold it instead of shallow-copy (vv.Clone).
  This allows the pkt's backing array, which includes the header portion,
  to be freed.
- Remove fragHeap. The fragments are now held in holes struct instead.
- Stop reserving the initial capacity of holes slice.

PiperOrigin-RevId: 347198744
2020-12-12 15:32:03 -08:00
Arthur Sfez 6a26930eeb Abandon reassembly of a packet if fragments overlap
However, receiving duplicated fragments will not cause reassembly to
fail. This is what Linux does too:
https://github.com/torvalds/linux/blob/38525c6/net/ipv4/inet_fragment.c#L355

PiperOrigin-RevId: 345309546
2020-12-02 14:12:01 -08:00
Toshi Kikuchi 758e45618f Clean up fragmentation.Process
- Pass a PacketBuffer directly instead of releaseCB
- No longer pass a VectorisedView, which is included in the PacketBuffer
- Make it an error if data size is not equal to (last - first + 1)
- Set the callback for the reassembly timeout on NewFragmentation

PiperOrigin-RevId: 342702432
2020-11-16 13:06:38 -08:00
Toshi Kikuchi 0a035a1011 Send ICMP error message if IP fragment reassembly fails
Fixes #4427, #4428

PiperOrigin-RevId: 338805047
2020-10-24 00:19:15 -07:00
Toshi Kikuchi f15182243e Discard IP fragments as soon as it expires
Currently expired IP fragments are discarded only if another fragment for the
same IP datagram is received after timeout or the total size of the fragment
queue exceeded a predefined value.

Test: fragmentation.TestReassemblingTimeout

Fixes #3960

PiperOrigin-RevId: 334423710
2020-09-29 11:29:50 -07:00
Ghanan Gowripalan ade4ff95fc Support fragments from different sources
Prevent fragments with different source-destination pairs from
conflicting with each other.

Test:
    - ipv6_test.TestReceiveIPv6Fragments
    - ipv4_test.TestReceiveIPv6Fragments
PiperOrigin-RevId: 324283246
2020-07-31 14:19:49 -07:00
Michael Pratt 4d52a55201 Change copyright notice to "The gVisor Authors"
Based on the guidelines at
https://opensource.google.com/docs/releasing/authors/.

1. $ rg -l "Google LLC" | xargs sed -i 's/Google LLC.*/The gVisor Authors./'
2. Manual fixup of "Google Inc" references.
3. Add AUTHORS file. Authors may request to be added to this file.
4. Point netstack AUTHORS to gVisor AUTHORS. Drop CONTRIBUTORS.

Fixes #209

PiperOrigin-RevId: 245823212
Change-Id: I64530b24ad021a7d683137459cafc510f5ee1de9
2019-04-29 14:26:23 -07:00
Ian Gudger 8fce67af24 Use correct company name in copyright header
PiperOrigin-RevId: 217951017
Change-Id: Ie08bf6987f98467d07457bcf35b5f1ff6e43c035
2018-10-19 16:35:11 -07:00
Nicolas Lacasse bf0fa09537 Switch netstack licenses to Apache 2.0.
Fixes #27

PiperOrigin-RevId: 203825288
Change-Id: Ie9f3a2b2c1e296b026b024f75c07da1a7e118633
2018-07-09 14:04:40 -07:00
Googler d02b74a5dc Check in gVisor.
PiperOrigin-RevId: 194583126
Change-Id: Ica1d8821a90f74e7e745962d71801c598c652463
2018-04-28 01:44:26 -04:00