srv6map

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

+groupName=maps

Index

Constants

This section is empty.

Variables

View Source
var Cell = cell.Module(
	"srv6map",
	"SRv6 Maps",
	cell.Provide(
		newPolicyMaps,
		newVRFMaps,
		newSIDMap,
	),
	cell.Invoke(cleanupStateMap),
)

Functions

func OpenPolicyMaps

func OpenPolicyMaps() (*PolicyMap4, *PolicyMap6, error)

OpenPolicyMaps opens the SRv6 policy maps on bpffs

func OpenVRFMaps

func OpenVRFMaps() (*VRFMap4, *VRFMap6, error)

OpenVRFMaps opens the SRv6 VRF maps on bpffs

Types

type PolicyKey

type PolicyKey struct {
	VRFID    uint32
	DestCIDR netip.Prefix
}

PolicyKey abstracts away the differences between PolicyKey4 and PolicyKey6.

type PolicyKey4

type PolicyKey4 struct {
	// PrefixLen is full 32 bits of VRF ID + DestCIDR's mask bits
	PrefixLen uint32     `align:"lpm"`
	VRFID     uint32     `align:"vrf_id"`
	DestCIDR  types.IPv4 `align:"dst_cidr"`
}

PolicyKey4 is a key for the PolicyMap4. Implements bpf.MapKey.

func (*PolicyKey4) New added in v1.16.0

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

func (*PolicyKey4) String added in v1.16.0

func (k *PolicyKey4) String() string

type PolicyKey6

type PolicyKey6 struct {
	// PrefixLen is full 32 bits of VRF ID + DestCIDR's mask bits
	PrefixLen uint32     `align:"lpm"`
	VRFID     uint32     `align:"vrf_id"`
	DestCIDR  types.IPv6 `align:"dst_cidr"`
}

PolicyKey6 is a key for the PolicyMap6. Implements bpf.MapKey.

func (*PolicyKey6) New added in v1.16.0

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

func (*PolicyKey6) String added in v1.16.0

func (k *PolicyKey6) String() string

type PolicyMap4 added in v1.16.0

type PolicyMap4 srv6PolicyMap

Define different types for IPv4 and IPv6 maps for DI

func (*PolicyMap4) IterateWithCallback added in v1.16.0

func (m *PolicyMap4) IterateWithCallback(cb SRv6PolicyIterateCallback) error

IterateWithCallback4 iterates through the IPv4 keys/values of an egress policy map, passing each key/value pair to the cb callback.

type PolicyMap6 added in v1.16.0

type PolicyMap6 srv6PolicyMap

func (*PolicyMap6) IterateWithCallback added in v1.16.0

func (m *PolicyMap6) IterateWithCallback(cb SRv6PolicyIterateCallback) error

IterateWithCallback iterates through the IPv6 keys/values of an egress policy map, passing each key/value pair to the cb callback.

type PolicyValue

type PolicyValue struct {
	SID types.IPv6
}

PolicyValue is a value for the PolicyMap4/6. Implements bpf.MapValue.

func (*PolicyValue) New added in v1.16.0

func (k *PolicyValue) New() bpf.MapValue

func (*PolicyValue) String

func (v *PolicyValue) String() string

type SIDKey

type SIDKey struct {
	SID types.IPv6
}

SIDKey is a key for the SIDMap. Implements bpf.MapKey.

func (*SIDKey) New added in v1.16.0

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

func (*SIDKey) String

func (k *SIDKey) String() string

type SIDMap added in v1.16.0

type SIDMap struct {
	*bpf.Map
}

SIDMap is the internal representation of an SRv6 SID map.

func OpenSIDMap

func OpenSIDMap() (*SIDMap, error)

OpenSIDMap opens the SIDMap on bpffs

func (*SIDMap) IterateWithCallback added in v1.16.0

func (m *SIDMap) IterateWithCallback(cb SRv6SIDIterateCallback) error

IterateWithCallback iterates through all the keys/values of an SRv6 SID map, passing each key/value pair to the cb callback.

type SIDValue

type SIDValue struct {
	VRFID uint32
}

SIDValue is a value for the SIDMap. Implements bpf.MapValue.

func (*SIDValue) New added in v1.16.0

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

func (*SIDValue) String added in v1.16.0

func (v *SIDValue) String() string

type SRv6PolicyIterateCallback

type SRv6PolicyIterateCallback func(*PolicyKey, *PolicyValue)

SRv6PolicyIterateCallback represents the signature of the callback function expected by the IterateWithCallback method, which in turn is used to iterate all the keys/values of an SRv6 policy map.

type SRv6SIDIterateCallback

type SRv6SIDIterateCallback func(*SIDKey, *SIDValue)

SRv6SIDIterateCallback represents the signature of the callback function expected by the IterateWithCallback method, which in turn is used to iterate all the keys/values of an SRv6 SID map.

type SRv6VRFIterateCallback

type SRv6VRFIterateCallback func(*VRFKey, *VRFValue)

SRv6VRFIterateCallback represents the signature of the callback function expected by the IterateWithCallback method, which in turn is used to iterate all the keys/values of policy maps.

type VRFKey

type VRFKey struct {
	SourceIP netip.Addr
	DestCIDR netip.Prefix
}

VRFKey abstracts away the differences between VRFKey4 and VRFKey6.

type VRFKey4

type VRFKey4 struct {
	// PrefixLen is full 32 bits of VRF ID + DestCIDR's mask bits
	PrefixLen uint32     `align:"lpm"`
	SourceIP  types.IPv4 `align:"src_ip"`
	DestCIDR  types.IPv4 `align:"dst_cidr"`
}

VRFKey4 is a key for the VRFMap4. Implements bpf.MapKey.

func (*VRFKey4) New added in v1.16.0

func (v *VRFKey4) New() bpf.MapKey

func (*VRFKey4) String added in v1.16.0

func (v *VRFKey4) String() string

type VRFKey6

type VRFKey6 struct {
	// PrefixLen is full 32 bits of VRF ID + DestCIDR's mask bits
	PrefixLen uint32     `align:"lpm"`
	SourceIP  types.IPv6 `align:"src_ip"`
	DestCIDR  types.IPv6 `align:"dst_cidr"`
}

VRFKey6 is a key for the VRFMap6. Implements bpf.MapKey.

func (*VRFKey6) New added in v1.16.0

func (v *VRFKey6) New() bpf.MapKey

func (*VRFKey6) String added in v1.16.0

func (v *VRFKey6) String() string

type VRFMap4 added in v1.16.0

type VRFMap4 srv6VRFMap

Define different types for IPv4 and IPv6 maps for DI

func (*VRFMap4) IterateWithCallback added in v1.16.0

func (m *VRFMap4) IterateWithCallback(cb SRv6VRFIterateCallback) error

IterateWithCallback iterates through the IPv4 keys/values of a VRF mapping map, passing each key/value pair to the cb callback.

type VRFMap6 added in v1.16.0

type VRFMap6 srv6VRFMap

func (*VRFMap6) IterateWithCallback added in v1.16.0

func (m *VRFMap6) IterateWithCallback(cb SRv6VRFIterateCallback) error

IterateWithCallback iterates through the IPv6 keys/values of a VRF mapping map, passing each key/value pair to the cb callback.

type VRFValue

type VRFValue struct {
	ID uint32
}

VRFValue is a value for the VRFMap4/6. Implements bpf.MapValue.

func (*VRFValue) New added in v1.16.0

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

func (*VRFValue) String

func (v *VRFValue) String() string

Jump to

Keyboard shortcuts

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