ipsets

package
v1.11.0-cni-plu...-ddfc3b1 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: Apache-2.0, Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const IPSetEntrySize = 20

WARNING: must be kept in sync with the definitions in bpf/polprog/pol_prog_builder.go. WARNING: must be kept in sync with the definitions in bpf/include/policy.h. uint32 prefixLen HE 4 uint64 set_id BE +8 = 12 uint32 addr BE +4 = 16 uint16 port HE +2 = 18 uint8 proto +1 = 19 uint8 pad +1 = 20

View Source
const IPSetEntryV6Size = 32

WARNING: must be kept in sync with the definitions in bpf/polprog/pol_prog_builder.go. WARNING: must be kept in sync with the definitions in bpf/include/policy.h. uint32 prefixLen HE 4 uint64 set_id BE +8 = 12 4*uint32 addr BE +16 = 28 uint16 port HE +2 = 30 uint8 proto +1 = 31 uint8 pad +1 = 32

Variables

View Source
var DummyValue = []byte{1, 0, 0, 0}
View Source
var MapParameters = maps.MapParameters{
	Type:       "lpm_trie",
	KeySize:    IPSetEntrySize,
	ValueSize:  4,
	MaxEntries: 1024 * 1024,
	Name:       "cali_v4_ip_sets",
	Flags:      unix.BPF_F_NO_PREALLOC,
}
View Source
var MapV6Parameters = maps.MapParameters{
	Type:       "lpm_trie",
	KeySize:    IPSetEntryV6Size,
	ValueSize:  4,
	MaxEntries: 1024 * 1024,
	Name:       "cali_v6_ip_sets",
	Flags:      unix.BPF_F_NO_PREALLOC,
}

Functions

func Map

func Map() maps.Map

func MapV6

func MapV6() maps.Map

func NewBPFIPSets

func NewBPFIPSets(
	ipVersionConfig *ipsets.IPVersionConfig,
	ipSetIDAllocator *idalloc.IDAllocator,
	ipSetsMap maps.Map,
	entryFromBytes func([]byte) IPSetEntryInterface,
	protoIPSetMemberToBPFEntry func(uint64, string) IPSetEntryInterface,
	opRecorder logutils.OpRecorder,
) *bpfIPSets

func SetMapSize

func SetMapSize(size int)

func SetMapV6Size

func SetMapV6Size(size int)

Types

type IPSetEntry

type IPSetEntry [IPSetEntrySize]byte

func (IPSetEntry) Addr

func (e IPSetEntry) Addr() net.IP

func (IPSetEntry) AsBytes

func (e IPSetEntry) AsBytes() []byte

func (IPSetEntry) Port

func (e IPSetEntry) Port() uint16

func (IPSetEntry) PrefixLen

func (e IPSetEntry) PrefixLen() uint32

func (IPSetEntry) Protocol

func (e IPSetEntry) Protocol() uint8

func (IPSetEntry) SetID

func (e IPSetEntry) SetID() uint64

type IPSetEntryInterface

type IPSetEntryInterface interface {
	SetID() uint64
	Addr() net.IP
	PrefixLen() uint32
	Protocol() uint8
	Port() uint16
	AsBytes() []byte
}

func IPSetEntryFromBytes

func IPSetEntryFromBytes(b []byte) IPSetEntryInterface

func IPSetEntryV6FromBytes

func IPSetEntryV6FromBytes(b []byte) IPSetEntryInterface

func MakeBPFIPSetEntry

func MakeBPFIPSetEntry(setID uint64, cidr ip.V4CIDR, port uint16, proto uint8) IPSetEntryInterface

func MakeBPFIPSetEntryV6

func MakeBPFIPSetEntryV6(setID uint64, cidr ip.V6CIDR, port uint16, proto uint8) IPSetEntryInterface

func ProtoIPSetMemberToBPFEntry

func ProtoIPSetMemberToBPFEntry(id uint64, member string) IPSetEntryInterface

func ProtoIPSetMemberToBPFEntryV6

func ProtoIPSetMemberToBPFEntryV6(id uint64, member string) IPSetEntryInterface

type IPSetEntryV6

type IPSetEntryV6 [IPSetEntryV6Size]byte

func (IPSetEntryV6) Addr

func (e IPSetEntryV6) Addr() net.IP

func (IPSetEntryV6) AsBytes

func (e IPSetEntryV6) AsBytes() []byte

func (IPSetEntryV6) Port

func (e IPSetEntryV6) Port() uint16

func (IPSetEntryV6) PrefixLen

func (e IPSetEntryV6) PrefixLen() uint32

func (IPSetEntryV6) Protocol

func (e IPSetEntryV6) Protocol() uint8

func (IPSetEntryV6) SetID

func (e IPSetEntryV6) SetID() uint64

Jump to

Keyboard shortcuts

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