ipcache

package
v1.18.5 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2025 License: Apache-2.0 Imports: 13 Imported by: 25

Documentation

Overview

+groupName=maps

Index

Constants

View Source
const (
	// MaxEntries is the maximum number of keys that can be present in the
	// RemoteEndpointMap.
	MaxEntries = 512000

	// OldName is the canonical name for the v1 IPCache map on the filesystem.
	OldName = "cilium_ipcache"

	// Name is the canonical name for the IPCache map on the filesystem.
	Name = "cilium_ipcache_v2"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Key

type Key struct {
	Prefixlen uint32 `align:"lpm_key"`
	ClusterID uint16 `align:"cluster_id"`
	Pad1      uint8  `align:"pad1"`
	Family    uint8  `align:"family"`
	// represents both IPv6 and IPv4 (in the lowest four bytes)
	IP types.IPv6 `align:"$union0"`
}

Key implements the bpf.MapKey interface.

Must be in sync with struct ipcache_key in <bpf/lib/maps.h>

func NewKey

func NewKey(ip net.IP, mask net.IPMask, clusterID uint16) Key

NewKey returns an Key based on the provided IP address, mask, and ClusterID. The address family is automatically detected

func (*Key) New

func (k *Key) New() bpf.MapKey

func (Key) Prefix

func (k Key) Prefix() netip.Prefix

func (Key) String

func (k Key) String() string

type Map

type Map struct {
	bpf.Map
}

Map represents an IPCache BPF map.

func IPCacheMap

func IPCacheMap(registry *metrics.Registry) *Map

IPCacheMap gets the ipcache Map singleton. If it has not already been done, this also initializes the Map.

func IPCacheMapV1 added in v1.18.0

func IPCacheMapV1() *Map

IPCacheMapV1 does the same as IPCacheMap but for the v1 ipcache map, from v1.18.

func NewMap

func NewMap(registry *metrics.Registry, name string) *Map

NewMap instantiates a Map.

type RemoteEndpointInfo

type RemoteEndpointInfo struct {
	SecurityIdentity uint32 `align:"sec_identity"`
	// represents both IPv6 and IPv4 (in the lowest four bytes)
	TunnelEndpoint types.IPv6 `align:"tunnel_endpoint"`

	Key   uint8                   `align:"key"`
	Flags RemoteEndpointInfoFlags `align:"flag_skip_tunnel"`
	// contains filtered or unexported fields
}

RemoteEndpointInfo implements the bpf.MapValue interface. It contains the security identity of a remote endpoint.

func NewValue added in v1.18.0

func NewValue(secID uint32, tunnelEndpoint net.IP, key uint8, flags RemoteEndpointInfoFlags) RemoteEndpointInfo

NewValue returns a RemoteEndpointInfo based on the provided security identity, tunnel endpoint IP, IPsec key, and flags. The address family is automatically detected.

func (*RemoteEndpointInfo) GetTunnelEndpoint added in v1.18.0

func (v *RemoteEndpointInfo) GetTunnelEndpoint() net.IP

func (*RemoteEndpointInfo) New

func (v *RemoteEndpointInfo) New() bpf.MapValue

func (*RemoteEndpointInfo) String

func (v *RemoteEndpointInfo) String() string

type RemoteEndpointInfoFlags added in v1.16.0

type RemoteEndpointInfoFlags uint8

RemoteEndpointInfoFlags represents various flags that can be attached to remote endpoints in the IPCache.

const (
	// FlagSkipTunnel can be applied to a remote endpoint to signal that
	// packets destined for said endpoint shall not be forwarded through
	// a VXLAN/Geneve tunnel, regardless of Cilium's configuration.
	FlagSkipTunnel RemoteEndpointInfoFlags = 1 << iota
	// FlagHasTunnelEndpoint is set when the tunnel endpoint is not null. It
	// aims to simplify the logic compared to checking the IPv6 address.
	FlagHasTunnelEndpoint
	// FlagIPv6TunnelEndpoint is set when the tunnel endpoint IP address
	// is an IPv6 address.
	FlagIPv6TunnelEndpoint
	// FlagRemoteCluster is set when the node is in a remote cluster.
	// It's always unset when clustermesh is disabled or for pods.
	FlagRemoteCluster
)

func (RemoteEndpointInfoFlags) String added in v1.16.0

func (f RemoteEndpointInfoFlags) String() string

String returns a human-readable representation of the flags present in the RemoteEndpointInfoFlags. The output format is the string name of each flag contained in the flag set, separated by a comma. If no flags are set, then "<none>" is returned.

type RemoteEndpointInfoV1 added in v1.18.0

type RemoteEndpointInfoV1 struct {
	SecurityIdentity uint32     `align:"sec_identity"`
	TunnelEndpoint   types.IPv4 `align:"tunnel_endpoint"`

	Key   uint8                   `align:"key"`
	Flags RemoteEndpointInfoFlags `align:"flag_skip_tunnel"`
	// contains filtered or unexported fields
}

RemoteEndpointInfoV1 implements the bpf.MapValue interface for the v1 ipcache map value.

func (*RemoteEndpointInfoV1) New added in v1.18.0

func (*RemoteEndpointInfoV1) String added in v1.18.0

func (v *RemoteEndpointInfoV1) String() string

Jump to

Keyboard shortcuts

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