routes

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

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

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

Documentation

Index

Constants

View Source
const (
	FlagInIPAMPool      Flags = 0x01
	FlagNATOutgoing     Flags = 0x02
	FlagWorkload        Flags = 0x04
	FlagLocal           Flags = 0x08
	FlagHost            Flags = 0x10
	FlagSameSubnet      Flags = 0x20
	FlagTunneled        Flags = 0x40
	FlagNoDSR           Flags = 0x80
	FlagBlackHoleDrop   Flags = 0x100
	FlagBlackHoleReject Flags = 0x200

	FlagsUnknown            Flags = 0
	FlagsRemoteWorkload           = FlagWorkload
	FlagsRemoteHost               = FlagHost
	FlagsLocalHost                = FlagLocal | FlagHost
	FlagsLocalWorkload            = FlagLocal | FlagWorkload
	FlagsRemoteTunneledHost       = FlagsRemoteHost | FlagTunneled
	FlagsLocalTunneledHost        = FlagsLocalHost | FlagTunneled
)
View Source
const KeySize = 8

struct cali_rt_key { __u32 mask; __be32 addr; // NBO };

View Source
const KeyV6Size = 20
View Source
const ValueSize = 8
struct cali_rt_value {
  __u32 flags;
  union {
    __u32 next_hop;
    __u32 ifIndex;
  };
};
View Source
const ValueV6Size = 20

Variables

View Source
var MapParameters = maps.MapParameters{
	Type:       "lpm_trie",
	KeySize:    KeySize,
	ValueSize:  ValueSize,
	MaxEntries: 256 * 1024,
	Name:       "cali_v4_routes",
	Flags:      unix.BPF_F_NO_PREALLOC,
}
View Source
var MapV6Parameters = maps.MapParameters{
	Type:       "lpm_trie",
	KeySize:    KeyV6Size,
	ValueSize:  ValueV6Size,
	MaxEntries: 256 * 1024,
	Name:       "cali_v6_routes",
	Flags:      unix.BPF_F_NO_PREALLOC,
}

Functions

func Map

func Map() maps.Map

func MapV6

func MapV6() maps.Map

func SetMapSize

func SetMapSize(size int)

Types

type Flags

type Flags uint32

type Key

type Key [KeySize]byte

func NewKey

func NewKey(cidr ip.CIDR) Key

func (Key) Addr

func (k Key) Addr() ip.Addr

func (Key) AsBytes

func (k Key) AsBytes() []byte

func (Key) Dest

func (k Key) Dest() ip.CIDR

func (Key) PrefixLen

func (k Key) PrefixLen() int

type KeyInterface

type KeyInterface interface {
	Addr() ip.Addr
	Dest() ip.CIDR
	PrefixLen() int
	AsBytes() []byte
}

func KeyInftFromBytes

func KeyInftFromBytes(b []byte) KeyInterface

func KeyV6InftFromBytes

func KeyV6InftFromBytes(b []byte) KeyInterface

func NewKeyIntf

func NewKeyIntf(cidr ip.CIDR) KeyInterface

func NewKeyV6Intf

func NewKeyV6Intf(cidr ip.CIDR) KeyInterface

type KeyV6

type KeyV6 [KeyV6Size]byte

func NewKeyV6

func NewKeyV6(cidr ip.CIDR) KeyV6

func (KeyV6) Addr

func (k KeyV6) Addr() ip.Addr

func (KeyV6) AsBytes

func (k KeyV6) AsBytes() []byte

func (KeyV6) Dest

func (k KeyV6) Dest() ip.CIDR

func (KeyV6) PrefixLen

func (k KeyV6) PrefixLen() int

type LPM

type LPM struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewLPM

func NewLPM() *LPM

func (*LPM) Delete

func (lpm *LPM) Delete(k KeyInterface)

func (*LPM) Lookup

func (lpm *LPM) Lookup(addr ip.Addr) (ValueInterface, bool)

func (*LPM) Update

func (lpm *LPM) Update(k KeyInterface, v ValueInterface)

type MapMem

type MapMem map[Key]Value

func LoadMap

func LoadMap(rtm maps.Map) (MapMem, error)

LoadMap loads a routes.Map into memory

type MapMemV6

type MapMemV6 map[KeyV6]ValueV6

func LoadMapV6

func LoadMapV6(rtm maps.Map) (MapMemV6, error)

LoadMap loads a routes.Map into memory

type Value

type Value [ValueSize]byte

func NewValue

func NewValue(flags Flags) Value

func NewValueWithIfIndex

func NewValueWithIfIndex(flags Flags, ifIndex int) Value

func NewValueWithNextHop

func NewValueWithNextHop(flags Flags, nextHop ip.Addr) Value

func (Value) AsBytes

func (v Value) AsBytes() []byte

func (Value) Equal

func (v Value) Equal(x ValueInterface) bool

func (Value) Flags

func (v Value) Flags() Flags

func (Value) IfaceIndex

func (v Value) IfaceIndex() uint32

func (Value) NextHop

func (v Value) NextHop() ip.Addr

func (Value) String

func (v Value) String() string

type ValueInterface

type ValueInterface interface {
	Flags() Flags
	NextHop() ip.Addr
	IfaceIndex() uint32
	AsBytes() []byte
	Equal(ValueInterface) bool
}

func NewValueIntf

func NewValueIntf(flags Flags) ValueInterface

func NewValueIntfWithIfIndex

func NewValueIntfWithIfIndex(flags Flags, ifIndex int) ValueInterface

func NewValueIntfWithNextHop

func NewValueIntfWithNextHop(flags Flags, nextHop ip.Addr) ValueInterface

func NewValueV6Intf

func NewValueV6Intf(flags Flags) ValueInterface

func NewValueV6IntfWithIfIndex

func NewValueV6IntfWithIfIndex(flags Flags, ifIndex int) ValueInterface

func NewValueV6IntfWithNextHop

func NewValueV6IntfWithNextHop(flags Flags, nextHop ip.Addr) ValueInterface

func ValueInftFromBytes

func ValueInftFromBytes(b []byte) ValueInterface

func ValueV6InftFromBytes

func ValueV6InftFromBytes(b []byte) ValueInterface

type ValueV6

type ValueV6 [ValueV6Size]byte

func NewValueV6

func NewValueV6(flags Flags) ValueV6

func NewValueV6WithIfIndex

func NewValueV6WithIfIndex(flags Flags, ifIndex int) ValueV6

func NewValueV6WithNextHop

func NewValueV6WithNextHop(flags Flags, nextHop ip.Addr) ValueV6

func (ValueV6) AsBytes

func (v ValueV6) AsBytes() []byte

func (ValueV6) Equal

func (v ValueV6) Equal(x ValueInterface) bool

func (ValueV6) Flags

func (v ValueV6) Flags() Flags

func (ValueV6) IfaceIndex

func (v ValueV6) IfaceIndex() uint32

func (ValueV6) NextHop

func (v ValueV6) NextHop() ip.Addr

func (ValueV6) String

func (v ValueV6) String() string

Jump to

Keyboard shortcuts

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