lxcmap

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: 8 Imported by: 0

Documentation

Overview

Package lxcmap represents the endpoints BPF map in the BPF programs. It is implemented as a hash table containing an entry for all local endpoints. The hashtable can be accessed through the key EndpointKey and points which points to the value EndpointInfo.

Index

Constants

View Source
const (
	MapName = "cilium_lxc"

	// MaxKeys represents the maximum number of endpoints in the map
	MaxKeys = 0xFFFF

	// PortMapMax represents the maximum number of Ports Mapping per container.
	PortMapMax = 16
)
View Source
const (
	// EndpointFlagHost indicates that this endpoint represents the host
	EndpointFlagHost = 1
)

Variables

This section is empty.

Functions

func AddHostEntry added in v0.10.0

func AddHostEntry(ip net.IP) error

AddHostEntry adds a special endpoint which represents the local host

func DeleteElement added in v0.10.0

func DeleteElement(f EndpointFrontend) int

DeleteElement deletes the endpoint using all keys which represent the endpoint. It returns the number of errors encountered during deletion.

func WriteEndpoint added in v0.10.0

func WriteEndpoint(f EndpointFrontend) error

WriteEndpoint updates the BPF map with the endpoint information and links the endpoint information to all keys provided.

Types

type EndpointFrontend added in v0.10.0

type EndpointFrontend interface {
	// GetBPFKeys must return a slice of EndpointKey which all represent the endpoint
	GetBPFKeys() []EndpointKey

	// GetBPFValue must return an EndpointInfo structure representing the frontend
	GetBPFValue() (*EndpointInfo, error)
}

EndpointFrontend is the interface to implement for an object to synchronize with the endpoint BPF map

type EndpointInfo added in v0.10.0

type EndpointInfo struct {
	IfIndex    uint32
	SecLabelID uint16
	LxcID      uint16
	Flags      uint32
	MAC        MAC
	NodeMAC    MAC
	V6Addr     types.IPv6
	PortMap    [PortMapMax]PortMap
}

EndpointInfo represents the value of the endpoints BPF map.

Must be in sync with struct endpoint_info in <bpf/lib/common.h>

func (EndpointInfo) GetValuePtr added in v0.10.0

func (v EndpointInfo) GetValuePtr() unsafe.Pointer

GetValuePtr returns the unsafe pointer to the BPF value

func (EndpointInfo) String added in v0.10.0

func (v EndpointInfo) String() string

String returns the human readable representation of an EndpointInfo

type EndpointKey added in v0.10.0

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

EndpointKey represents the key value of the endpoints BPF map

Must be in sync with struct endpoint_key in <bpf/lib/common.h>

func NewEndpointKey added in v0.10.0

func NewEndpointKey(ip net.IP) EndpointKey

NewEndpointKey returns an EndpointKey based on the provided IP address. The address family is automatically detected

func (EndpointKey) GetKeyPtr added in v0.10.0

func (k EndpointKey) GetKeyPtr() unsafe.Pointer

GetKeyPtr returns the unsafe pointer to the BPF key

func (EndpointKey) NewValue added in v0.10.0

func (k EndpointKey) NewValue() bpf.MapValue

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

type MAC

type MAC uint64

MAC is the __u64 representation of a MAC address.

func ParseMAC

func ParseMAC(s string) (MAC, error)

ParseMAC parses s only as an IEEE 802 MAC-48.

func (MAC) String

func (m MAC) String() string

type PortMap

type PortMap struct {
	From uint16
	To   uint16
}

PortMap represents a port mapping from the host to the LXC.

func (PortMap) String

func (pm PortMap) String() string

Jump to

Keyboard shortcuts

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