ipv4

package
v0.0.0-...-0f8db9f Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0, MIT Imports: 17 Imported by: 242

Documentation

Overview

Package ipv4 contains the implementation of the ipv4 network protocol.

Index

Constants

View Source
const (
	// ReassembleTimeout is the time a packet stays in the reassembly
	// system before being evicted.
	// As per RFC 791 section 3.2:
	//   The current recommendation for the initial timer setting is 15 seconds.
	//   This may be changed as experience with this protocol accumulates.
	//
	// Considering that it is an old recommendation, we use the same reassembly
	// timeout that linux defines, which is 30 seconds:
	// https://github.com/torvalds/linux/blob/47ec5303d73ea344e84f46660fff693c57641386/include/net/ip.h#L138
	ReassembleTimeout = 30 * time.Second

	// ProtocolNumber is the ipv4 protocol number.
	ProtocolNumber = header.IPv4ProtocolNumber

	// MaxTotalSize is maximum size that can be encoded in the 16-bit
	// TotalLength field of the ipv4 header.
	MaxTotalSize = 0xffff

	// DefaultTTL is the default time-to-live value for this endpoint.
	DefaultTTL = 64
)
View Source
const (

	// UnsolicitedReportIntervalMax is the maximum delay between sending
	// unsolicited IGMP reports.
	//
	// Obtained from RFC 2236 Section 8.10, Page 19.
	UnsolicitedReportIntervalMax = 10 * time.Second
)

Variables

This section is empty.

Functions

func NewProtocol

func NewProtocol(s *stack.Stack) stack.NetworkProtocol

NewProtocol is equivalent to NewProtocolWithOptions with an empty Options.

func NewProtocolWithOptions

func NewProtocolWithOptions(opts Options) stack.NetworkProtocolFactory

NewProtocolWithOptions returns an IPv4 network protocol.

Types

type IGMPEndpoint

type IGMPEndpoint interface {
	// SetIGMPVersion sets the IGMP version.
	//
	// Returns the previous IGMP version.
	SetIGMPVersion(IGMPVersion) IGMPVersion

	// GetIGMPVersion returns the IGMP version.
	GetIGMPVersion() IGMPVersion
}

IGMPEndpoint is a network endpoint that supports IGMP.

type IGMPOptions

type IGMPOptions struct {
	// Enabled indicates whether IGMP will be performed.
	//
	// When enabled, IGMP may transmit IGMP report and leave messages when
	// joining and leaving multicast groups respectively, and handle incoming
	// IGMP packets.
	//
	// This field is ignored and is always assumed to be false for interfaces
	// without neighbouring nodes (e.g. loopback).
	Enabled bool
}

IGMPOptions holds options for IGMP.

+stateify savable

type IGMPVersion

type IGMPVersion int

IGMPVersion is the forced version of IGMP.

const (

	// IGMPVersion1 indicates IGMPv1.
	IGMPVersion1 IGMPVersion
	// IGMPVersion2 indicates IGMPv2. Note that IGMP may still fallback to V1
	// compatibility mode as required by IGMPv2.
	IGMPVersion2
	// IGMPVersion3 indicates IGMPv3. Note that IGMP may still fallback to V2
	// compatibility mode as required by IGMPv3.
	IGMPVersion3
)

type Options

type Options struct {
	// IGMP holds options for IGMP.
	IGMP IGMPOptions

	// AllowExternalLoopbackTraffic indicates that inbound loopback packets (i.e.
	// martian loopback packets) should be accepted.
	AllowExternalLoopbackTraffic bool
}

Options holds options to configure a new protocol.

+stateify savable

type Stats

type Stats struct {
	// IP holds IPv4 statistics.
	IP tcpip.IPStats

	// IGMP holds IGMP statistics.
	IGMP tcpip.IGMPStats

	// ICMP holds ICMPv4 statistics.
	ICMP tcpip.ICMPv4Stats
}

Stats holds statistics related to the IPv4 protocol family.

+stateify savable

func (*Stats) IPStats

func (s *Stats) IPStats() *tcpip.IPStats

IPStats implements stack.IPNetworkEndointStats

func (*Stats) IsNetworkEndpointStats

func (*Stats) IsNetworkEndpointStats()

IsNetworkEndpointStats implements stack.NetworkEndpointStats.

Jump to

Keyboard shortcuts

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