fragmentation

package
v1.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 31, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package fragmentation contains the implementation of IP fragmentation. It is based on RFC 791 and RFC 815.

Index

Constants

View Source
const DefaultReassembleTimeout = 30 * time.Second

DefaultReassembleTimeout is based on the linux stack: net.ipv4.ipfrag_time.

View Source
const HighFragThreshold = 4 << 20 // 4MB

HighFragThreshold is the threshold at which we start trimming old fragmented packets. Linux uses a default value of 4 MB. See net.ipv4.ipfrag_high_thresh for more information.

View Source
const LowFragThreshold = 3 << 20 // 3MB

LowFragThreshold is the threshold we reach to when we start dropping older fragmented packets. It's important that we keep enough room for newer packets to be re-assembled. Hence, this needs to be lower than HighFragThreshold enough. Linux uses a default value of 3 MB. See net.ipv4.ipfrag_low_thresh for more information.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fragmentation

type Fragmentation struct {
	// contains filtered or unexported fields
}

Fragmentation is the main structure that other modules of the stack should use to implement IP Fragmentation.

func NewFragmentation

func NewFragmentation(highMemoryLimit, lowMemoryLimit int, reassemblingTimeout time.Duration) *Fragmentation

NewFragmentation creates a new Fragmentation.

highMemoryLimit specifies the limit on the memory consumed by the fragments stored by Fragmentation (overhead of internal data-structures is not accounted). Fragments are dropped when the limit is reached.

lowMemoryLimit specifies the limit on which we will reach by dropping fragments after reaching highMemoryLimit.

reassemblingTimeout specifes the maximum time allowed to reassemble a packet. Fragments are lazily evicted only when a new a packet with an already existing fragmentation-id arrives after the timeout.

func (*Fragmentation) Process

func (f *Fragmentation) Process(id uint32, first, last uint16, more bool, vv buffer.VectorisedView) (buffer.VectorisedView, bool)

Process processes an incoming fragment beloning to an ID and returns a complete packet when all the packets belonging to that ID have been received.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL