sockmap

package
v1.6.12 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package Sockmap represents the map from 5-tuple to the socket. It is primarily managed from the datapath using a sockops program. Cilium side is primarily for pretty printing. +groupName=maps

Index

Constants

View Source
const (

	// MaxEntries represents the maximum number of endpoints in the map
	MaxEntries = 65535
)

Variables

View Source
var (
	// SockMap represents the BPF map for sockets
	SockMap = bpf.NewMap(mapName,
		bpf.MapTypeSockHash,
		&SockmapKey{},
		int(unsafe.Sizeof(SockmapKey{})),
		&SockmapValue{},
		4,
		MaxEntries,
		0, 0,
		bpf.ConvertKeyValue,
	)
)

Functions

func SockmapCreate

func SockmapCreate()

SockmapCreate will create sockmap map

Types

type SockmapKey

type SockmapKey struct {
	DIP    types.IPv6 `align:"$union0"`
	SIP    types.IPv6 `align:"$union1"`
	Family uint8      `align:"family"`
	Pad7   uint8      `align:"pad7"`
	Pad8   uint16     `align:"pad8"`
	SPort  uint32     `align:"sport"`
	DPort  uint32     `align:"dport"`
}

SockmapKey is the 5-tuple used to lookup a socket +k8s:deepcopy-gen=true +k8s:deepcopy-gen:interfaces=github.com/cilium/cilium/pkg/bpf.MapKey

func NewSockmapKey

func NewSockmapKey(dip, sip net.IP, sport, dport uint32) SockmapKey

NewSockmapKey returns a new key using 5-tuple input.

func (*SockmapKey) DeepCopy added in v1.5.1

func (in *SockmapKey) DeepCopy() *SockmapKey

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SockmapKey.

func (*SockmapKey) DeepCopyInto added in v1.5.1

func (in *SockmapKey) DeepCopyInto(out *SockmapKey)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*SockmapKey) DeepCopyMapKey added in v1.5.1

func (in *SockmapKey) DeepCopyMapKey() bpf.MapKey

DeepCopyMapKey is an autogenerated deepcopy function, copying the receiver, creating a new bpf.MapKey.

func (*SockmapKey) GetKeyPtr

func (k *SockmapKey) GetKeyPtr() unsafe.Pointer

GetKeyPtr returns the unsafe pointer to the BPF key

func (SockmapKey) NewValue

func (k SockmapKey) NewValue() bpf.MapValue

NewValue returns a new empty instance of the structure representing the BPF map value

func (SockmapKey) String

func (v SockmapKey) String() string

String pretty print the 5-tuple as sip:sport->dip:dport

type SockmapValue

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

SockmapValue is the fd of a socket +k8s:deepcopy-gen=true +k8s:deepcopy-gen:interfaces=github.com/cilium/cilium/pkg/bpf.MapValue

func (*SockmapValue) DeepCopy added in v1.5.1

func (in *SockmapValue) DeepCopy() *SockmapValue

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SockmapValue.

func (*SockmapValue) DeepCopyInto added in v1.5.1

func (in *SockmapValue) DeepCopyInto(out *SockmapValue)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*SockmapValue) DeepCopyMapValue added in v1.5.1

func (in *SockmapValue) DeepCopyMapValue() bpf.MapValue

DeepCopyMapValue is an autogenerated deepcopy function, copying the receiver, creating a new bpf.MapValue.

func (*SockmapValue) GetValuePtr

func (v *SockmapValue) GetValuePtr() unsafe.Pointer

GetValuePtr returns the unsafe pointer to the BPF value.

func (SockmapValue) String

func (v SockmapValue) String() string

String pretty print the file descriptor value, note this is local to agent.

Jump to

Keyboard shortcuts

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