linuxcalls

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LinuxArpDetails added in v1.8.1

type LinuxArpDetails struct {
	Arp  *l3.LinuxStaticArpEntries_ArpEntry `json:"linux_arp"`
	Meta *LinuxArpMeta                      `json:"linux_arp_meta"`
}

LinuxArpDetails is the wrapper structure for the linux ARP northbound API structure.

type LinuxArpMeta added in v1.8.1

type LinuxArpMeta struct {
	LinkIndex int `json:"link_index"`
	Family    int `json:"family"`
	State     int `json:"state"`
	Type      int `json:"type"`
	Flags     int `json:"flags"`
	Vlan      int `json:"vlan"`
	VNI       int `json:"vni"`
}

LinuxArpMeta is combination of proto-modelled ARP data and linux provided metadata

type LinuxRouteDetails added in v1.8.1

type LinuxRouteDetails struct {
	Route *l3.LinuxStaticRoutes_Route `json:"linux_route"`
	Meta  *LinuxRouteMeta             `json:"linux_route_meta"`
}

LinuxRouteDetails is the wrapper structure for the linux route northbound API structure.

type LinuxRouteMeta added in v1.8.1

type LinuxRouteMeta struct {
	LinkIndex  int        `json:"link_index"`
	ILinkIndex int        `json:"ilink_index"`
	Scope      int        `json:"scope"`
	Protocol   int        `json:"protocol"`
	Priority   int        `json:"priority"`
	Table      int        `json:"table"`
	Type       int        `json:"type"`
	Tos        int        `json:"tos"`
	Flags      int        `json:"flags"`
	MTU        int        `json:"mtu"`
	AdvMSS     int        `json:"adv_mss"`
	NextHops   []*nextHop `json:"next_hops"`
}

LinuxRouteMeta is combination of proto-modelled route data and linux provided metadata

type NetLinkHandler added in v1.8.1

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

NetLinkHandler is accessor for netlink methods

func NewNetLinkHandler

func NewNetLinkHandler(nsHandler nsplugin.NamespaceAPI, ifIndexes ifaceidx.LinuxIfIndex, arpIndexes l3idx.LinuxARPIndex, routeIndexes l3idx.LinuxRouteIndex,
	log logging.Logger) *NetLinkHandler

NewNetLinkHandler creates new instance of netlink handler

func (*NetLinkHandler) AddArpEntry added in v1.8.1

func (handler *NetLinkHandler) AddArpEntry(name string, arpEntry *netlink.Neigh) error

AddArpEntry creates a new static ARP entry

func (*NetLinkHandler) AddStaticRoute added in v1.8.1

func (h *NetLinkHandler) AddStaticRoute(name string, route *netlink.Route) error

AddStaticRoute creates the new static route

func (*NetLinkHandler) DelArpEntry added in v1.8.1

func (handler *NetLinkHandler) DelArpEntry(name string, arpEntry *netlink.Neigh) error

DelArpEntry removes an static ARP entry

func (*NetLinkHandler) DelStaticRoute added in v1.8.1

func (h *NetLinkHandler) DelStaticRoute(name string, route *netlink.Route) error

DelStaticRoute removes the static route

func (*NetLinkHandler) DumpArpEntries added in v1.8.1

func (h *NetLinkHandler) DumpArpEntries() ([]*LinuxArpDetails, error)

DumpArpEntries is an implementation of linux L3 handler

func (*NetLinkHandler) DumpRoutes added in v1.8.1

func (h *NetLinkHandler) DumpRoutes() ([]*LinuxRouteDetails, error)

DumpRoutes is an implementation of linux route handler

func (*NetLinkHandler) GetArpEntries added in v1.8.1

func (handler *NetLinkHandler) GetArpEntries(interfaceIdx int, family int) ([]netlink.Neigh, error)

GetArpEntries reads all configured static ARP entries for given interface <interfaceIdx> and <family> parameters works as filters, if they are set to zero, all arp entries are returned

func (*NetLinkHandler) GetStaticRoutes added in v1.8.1

func (h *NetLinkHandler) GetStaticRoutes(link netlink.Link, family int) ([]netlink.Route, error)

GetStaticRoutes reads linux routes. Possible to filter by interface and IP family.

func (*NetLinkHandler) ReplaceStaticRoute added in v1.8.1

func (h *NetLinkHandler) ReplaceStaticRoute(name string, route *netlink.Route) error

ReplaceStaticRoute removes the static route

func (*NetLinkHandler) SetArpEntry added in v1.8.1

func (handler *NetLinkHandler) SetArpEntry(name string, arpEntry *netlink.Neigh) error

SetArpEntry updates existing arp entry

type NetlinkAPI

type NetlinkAPI interface {
	NetlinkAPIWrite
	NetlinkAPIRead
}

NetlinkAPI interface covers all methods inside linux calls package needed to manage linux ARP entries and routes.

type NetlinkAPIRead added in v1.8.1

type NetlinkAPIRead interface {
	/* ARP */
	// GetArpEntries returns all configured ARP entries from current namespace in raw netlink format. Possible to
	// filter by interface and IP family.
	GetArpEntries(interfaceIdx int, family int) ([]netlink.Neigh, error)
	// DumpArpEntries returns all configured ARP entries known to VPP agent from all known namespaces
	// in proto-modelled format
	DumpArpEntries() ([]*LinuxArpDetails, error)
	/* Routes */
	// GetStaticRoutes reads all linux routes from current namespace. Possible to filter by interface and IP family.
	GetStaticRoutes(link netlink.Link, family int) ([]netlink.Route, error)
	// DumpRoutes returns all configured routes entries known to VPP agent from all known namespaces
	// in proto-modelled format
	DumpRoutes() ([]*LinuxRouteDetails, error)
}

NetlinkAPIRead interface covers read methods inside linux calls package needed to manage linux ARP entries and routes.

type NetlinkAPIWrite added in v1.8.1

type NetlinkAPIWrite interface {
	/* ARP */
	// AddArpEntry configures new linux ARP entry
	AddArpEntry(name string, arpEntry *netlink.Neigh) error
	// SetArpEntry modifies existing linux ARP entry
	SetArpEntry(name string, arpEntry *netlink.Neigh) error
	// DelArpEntry removes linux ARP entry
	DelArpEntry(name string, arpEntry *netlink.Neigh) error
	/* Routes */
	// AddStaticRoute adds new linux static route
	AddStaticRoute(name string, route *netlink.Route) error
	// ReplaceStaticRoute changes existing linux static route
	ReplaceStaticRoute(name string, route *netlink.Route) error
	// DelStaticRoute removes linux static route
	DelStaticRoute(name string, route *netlink.Route) error
}

NetlinkAPIWrite interface covers write methods inside linux calls package needed to manage linux ARP entries and routes.

Jump to

Keyboard shortcuts

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