netlink

package
v8.56.1709838579-SHA-e... Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

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

func New

func New(config Config) *Backend

New is a constructor function which allows you to supply the Config as well as a map of any already implemented FlowRules\ Before it starts managing routes, it flushes the route table <rtTableID> which is dedicated to Spacetime activities

func (*Backend) Apply

func (*Backend) Close

func (b *Backend) Close() error

func (*Backend) Init

func (b *Backend) Init(ctx context.Context) error

func (*Backend) Stats

func (b *Backend) Stats() interface{}

type ClassifierError

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

func (ClassifierError) Error

func (e ClassifierError) Error() string

func (ClassifierError) Is

func (e ClassifierError) Is(err error) bool

type ClassifierField

type ClassifierField string

ClassifierError indicates an erroneously supplied outbound network interface

const (
	IpHeader_Field   ClassifierField = "IpHeader"
	Protocol_Field   ClassifierField = "Protocol"
	SrcIpRange_Field ClassifierField = "SrcIpRange"
	DstIpRange_Field ClassifierField = "DstIpRange"
)

type Config

type Config struct {
	// Clock to support repeatable unit or container testing
	Clock clockwork.Clock

	// The route table number in which destination routes will be managed.
	RtTableID int

	// The Linux PBR priority to use for the lookup into |RtTableID|.
	RtTableLookupPriority int

	// GetLinkIDByName returns the ID of the provided interface.
	GetLinkIDByName func(interfaceID string) (int, error)

	// RouteList fetches a list of installed routes.
	// TODO: Evaluate whether this is still needed
	RouteList func() ([]vnl.Route, error)

	// RouteListFiltered fetches a list of installed routes matching a filter.
	RouteListFiltered func(int, *vnl.Route, uint64) ([]vnl.Route, error)

	// RouteAdd inserts new routes.
	RouteAdd func(*vnl.Route) error

	// RouteDel removes the provided route.
	RouteDel func(*vnl.Route) error

	// RuleAdd is called during the backend Init() process.
	RuleAdd func(*vnl.Rule) error
}

Config provides configuration and dependency injection parameters for backend

func DefaultConfig

func DefaultConfig(ctx context.Context, nlHandle *vnl.Handle, rtTableID int, rtTableLookupPriority int) Config

DefaultConfig generates a nominal Config for New(). Pass in a Netlink *Handle with the specified namespace, like so: nlHandle, err := vnl.NewHandle(vnl.FAMILY_V4) config := DefaultConfig(nlHandle)

type FlowRuleMatchError

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

FlowRuleMatchError indicates a case where the supplied FlowRule src/dstIpRange and those implemented by Netlink don't match

func (FlowRuleMatchError) Error

func (e FlowRuleMatchError) Error() string

func (FlowRuleMatchError) Is

func (e FlowRuleMatchError) Is(err error) bool

type IPv4Entry

type IPv4Entry string

IPv4FormattingError indicates an erroneously formatted IPv4 address was passed

const (
	SrcIpRange_Ip IPv4Entry = "SrcIpRange"
	DstIpRange_Ip IPv4Entry = "DstIpRange"
	NextHopIp_Ip  IPv4Entry = "NextHopIp"
)

type IPv4FormattingError

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

func (IPv4FormattingError) Error

func (e IPv4FormattingError) Error() string

func (IPv4FormattingError) Is

func (e IPv4FormattingError) Is(err error) bool

type NoChangeSpecifiedError

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

NoChangeSpecifiedError indicates that there is no Change supplied in the apipb.SCU

func (*NoChangeSpecifiedError) Error

func (e *NoChangeSpecifiedError) Error() string

func (*NoChangeSpecifiedError) Is

func (e *NoChangeSpecifiedError) Is(err error) bool

type OutInterfaceIdxError

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

OutInterfaceIdxError indicates an erroneously supplied outbound network interface

func (OutInterfaceIdxError) Error

func (e OutInterfaceIdxError) Error() string

func (OutInterfaceIdxError) Is

func (e OutInterfaceIdxError) Is(err error) bool

func (OutInterfaceIdxError) Unwrap

func (e OutInterfaceIdxError) Unwrap() error

type UnknownFlowRuleDeleteError

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

UnknownFlowRuleDeleteError indicates an unknown FlowRule is attempted to be deleted

func (*UnknownFlowRuleDeleteError) Error

func (*UnknownFlowRuleDeleteError) Is

type UnrecognizedFlowUpdateOperationError

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

UnrecognizedFlowUpdateOperationError indicates an unrecognized FlowUpdate Operation is attempted to be applied Dec7: apipb.FlowUpdate_ADD and apipb.FlowUpdate_DELETE are supported

func (*UnrecognizedFlowUpdateOperationError) Error

func (*UnrecognizedFlowUpdateOperationError) Is

type UnsupportedActionTypeError

type UnsupportedActionTypeError struct{}

UnsupportedActionTypeError indicates an unsupported ActionType is attempted to be applied Dec7: FlowRule_ActionBucket_Action_Forward_ is supported

TO DO: Expand error and code in netlink.go to return errors if unsupported Action Types such as PopHeader are passed

func (*UnsupportedActionTypeError) Error

func (*UnsupportedActionTypeError) Is

type UnsupportedUpdateError

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

UnsupportedUpdateError indicates the UpdateType specified in the apipb.SCU is unsupported Dec7: apipb.ControlPlaneUpdate_FlowUpdate is supported

func (*UnsupportedUpdateError) Error

func (e *UnsupportedUpdateError) Error() string

func (*UnsupportedUpdateError) Is

func (e *UnsupportedUpdateError) Is(err error) bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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