ctmap

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2017 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MapName6       = "cilium_ct6_"
	MapName4       = "cilium_ct4_"
	MapName6Global = MapName6 + "global"
	MapName4Global = MapName4 + "global"

	MapNumEntriesLocal  = 64000
	MapNumEntriesGlobal = 1000000

	TUPLE_F_OUT     = 0
	TUPLE_F_IN      = 1
	TUPLE_F_RELATED = 2
)
View Source
const (
	// GCFilterByTime filters CT entries by time
	GCFilterByTime = 1 << iota
	// GCFilterByID filters CT entries by IP and IDsToRem
	GCFilterByID
)

Variables

This section is empty.

Functions

func GC added in v0.9.0

func GC(m *bpf.Map, mapName string, filter *GCFilter) int

GC runs garbage collection for map m with name mapName with the given filter. It returns how many items were deleted from m.

func ToString added in v0.9.0

func ToString(m *bpf.Map, mapName string) (string, error)

ToString iterates through Map m and writes the values of the ct entries in m to a string.

Types

type CtEntry

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

CtEntry represents an entry in the connection tracking table.

func (*CtEntry) GetValuePtr added in v0.9.0

func (c *CtEntry) GetValuePtr() unsafe.Pointer

GetValuePtr returns the unsafe.Pointer for s.

type CtEntryDump

type CtEntryDump struct {
	Key   CtKey
	Value CtEntry
}

CtEntryDump represents the key and value contained in the conntrack map.

type CtKey

type CtKey interface {
	bpf.MapKey

	// Returns human readable string representation
	String() string

	// ToNetwork converts fields to network byte order.
	ToNetwork() CtKey

	// ToHost converts fields to host byte order.
	ToHost() CtKey

	// Dumps contents of key to buffer. Returns true if successful.
	Dump(buffer *bytes.Buffer) bool
}

CtKey is the interface describing keys to the conntrack maps.

type CtKey4

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

CtKey4 represents the key for IPv4 entries in the local BPF conntrack map.

func (CtKey4) Dump

func (k CtKey4) Dump(buffer *bytes.Buffer) bool

Dump writes the contents of key to buffer and returns true if the value for next header in the key is nonzero.

func (*CtKey4) GetKeyPtr added in v0.9.0

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

GetKeyPtr returns the unsafe.Pointer for k.

func (*CtKey4) NewValue added in v0.9.0

func (k *CtKey4) NewValue() bpf.MapValue

NewValue creates a new bpf.MapValue.

func (*CtKey4) String added in v0.9.0

func (k *CtKey4) String() string

func (*CtKey4) ToHost added in v0.10.0

func (k *CtKey4) ToHost() CtKey

ToHost converts CtKey4 ports to host byte order.

func (*CtKey4) ToNetwork added in v0.10.0

func (k *CtKey4) ToNetwork() CtKey

ToNetwork converts CtKey4 ports to network byte order.

type CtKey4Global added in v0.9.0

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

CtKey4Global represents the key for IPv4 entries in the global BPF conntrack map.

func (CtKey4Global) Dump added in v0.9.0

func (k CtKey4Global) Dump(buffer *bytes.Buffer) bool

Dump writes the contents of key to buffer and returns true if the value for next header in the key is nonzero.

func (*CtKey4Global) GetKeyPtr added in v0.9.0

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

GetKeyPtr returns the unsafe.Pointer for k.

func (*CtKey4Global) NewValue added in v0.9.0

func (k *CtKey4Global) NewValue() bpf.MapValue

NewValue creates a new bpf.MapValue.

func (*CtKey4Global) String added in v0.9.0

func (k *CtKey4Global) String() string

func (*CtKey4Global) ToHost added in v0.10.0

func (k *CtKey4Global) ToHost() CtKey

ToHost converts CtKey4Global ports to host byte order.

func (*CtKey4Global) ToNetwork added in v0.10.0

func (k *CtKey4Global) ToNetwork() CtKey

ToNetwork converts CtKey4Global ports to network byte order.

type CtKey6

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

CtKey6 represents the key for IPv6 entries in the local BPF conntrack map.

func (CtKey6) Dump

func (k CtKey6) Dump(buffer *bytes.Buffer) bool

Dump writes the contents of key to buffer and returns true if the value for next header in the key is nonzero.

func (*CtKey6) GetKeyPtr added in v0.9.0

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

GetKeyPtr returns the unsafe.Pointer for k.

func (*CtKey6) NewValue added in v0.9.0

func (k *CtKey6) NewValue() bpf.MapValue

NewValue creates a new bpf.MapValue.

func (*CtKey6) String added in v0.9.0

func (k *CtKey6) String() string

func (*CtKey6) ToHost added in v0.10.0

func (k *CtKey6) ToHost() CtKey

ToHost converts CtKey6 ports to network byte order.

func (*CtKey6) ToNetwork added in v0.10.0

func (k *CtKey6) ToNetwork() CtKey

ToNetwork converts CtKey6 ports to network byte order.

type CtKey6Global added in v0.9.0

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

CtKey6Global represents the key for IPv6 entries in the global BPF conntrack map.

func (CtKey6Global) Dump added in v0.9.0

func (k CtKey6Global) Dump(buffer *bytes.Buffer) bool

Dump writes the contents of key to buffer and returns true if the value for next header in the key is nonzero.

func (*CtKey6Global) GetKeyPtr added in v0.9.0

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

GetKeyPtr returns the unsafe.Pointer for k.

func (*CtKey6Global) NewValue added in v0.9.0

func (k *CtKey6Global) NewValue() bpf.MapValue

NewValue creates a new bpf.MapValue.

func (*CtKey6Global) String added in v0.9.0

func (k *CtKey6Global) String() string

func (*CtKey6Global) ToHost added in v0.10.0

func (k *CtKey6Global) ToHost() CtKey

ToHost converts CtKey6Global ports to host byte order.

func (*CtKey6Global) ToNetwork added in v0.10.0

func (k *CtKey6Global) ToNetwork() CtKey

ToNetwork converts CtKey6Global ports to network byte order.

type CtType

type CtType int

type CtValue added in v0.9.0

type CtValue interface {
	bpf.MapValue

	// ToNetwork converts fields to network byte order.
	ToNetwork() CtValue

	// ToHost converts fields to host byte order.
	ToHost() CtValue
}

CtValue is the interface describing values in the conntrack maps.

type GCFilter added in v0.10.0

type GCFilter struct {
	Time    uint32
	IP      net.IP
	IDsToRm map[uint32]bool
	// contains filtered or unexported fields
}

GCFilter contains the necessary fields to filter the CT maps.

func NewGCFilterBy added in v0.10.0

func NewGCFilterBy(f GCFilterFlags) *GCFilter

NewGCFilterBy creates a new GCFilter with the given flags.

type GCFilterFlags added in v0.10.0

type GCFilterFlags uint

GCFilterFlags is the type for the different filter flags

Jump to

Keyboard shortcuts

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