Documentation ¶
Index ¶
- Constants
- func AddNeighbors(ns []Neighbor) error
- func AddRoutes(rs []Route) error
- func Ensure(bgpState *BgpState, baselayerState *BaselayerState)
- func EnsureTableRules()
- func RemoveNeighbors(ns []Neighbor) error
- func RemoveRoutes(rs []Route) error
- type BaselayerState
- type BgpState
- type Config
- type Link
- type NbrMsg
- type NdMsg
- type Neighbor
- type Route
- type RtMsg
- type Type2EvpnRoute
- type Type3EvpnRoute
Constants ¶
const ( NDAUnspec uint16 = iota NDADst NDALLAddr NDACacheInfo NDAProbes NDAVLAN NDAPort NDAVNI NDAIfIndex NDAMaster NDALinkNetnsID NDASrcVNI )
attribute types
const ( NTFUse = 0x01 NTFSelf = 0x02 NTFMaster = 0x04 NTFProxy = 0x08 NTFExtLearned = 0x10 NTFOffloaded = 0x20 NTFRouter = 0x80 )
neighbor cache entry flags
const ( NUDIncomplete = 0x01 NUDReachable = 0x02 NUDStale = 0x04 NUDDelay = 0x08 NUDProbe = 0x10 NUDFailed = 0x20 NUDNoarp = 0x40 NUDPermanent = 0x80 NUDNone = 0x00 )
neighbor cache entry states
const ( IFLAInfoUnspec uint16 = iota IFLAInfoKind IFLAInfoData )
interface link address attribute types
const ( IFLAVXLANUnspec uint16 = iota IFLAVXLANID )
vxlan attribute types
Variables ¶
This section is empty.
Functions ¶
func AddNeighbors ¶ added in v0.1.2
AddNeighbors adds the provided set of neighbors to the Linux kernel
func AddRoutes ¶ added in v0.1.2
AddRoutes adds the supplied set of routes to the Linux routing tables
func Ensure ¶
func Ensure(bgpState *BgpState, baselayerState *BaselayerState)
Ensure that the baselayer satisfies bgp's view of the world
func EnsureTableRules ¶
func EnsureTableRules()
EnsureTableRules ensures that the IP routing policy rules are set up for the routing table Gobble presides over.
func RemoveNeighbors ¶ added in v0.1.2
RemoveNeighbors removes the provided set of neighbors from the Linux kernel
func RemoveRoutes ¶ added in v0.1.2
RemoveRoutes removes the supplied set of routes from the Linux routing tables
Types ¶
type BaselayerState ¶
type BaselayerState struct { DestRT map[string]Route // Destination keyed routing table Fib []Neighbor Neighborhood []Neighbor Links map[uint32]*Link }
BaselayerState keeps track of state in the Linux packet layer
func ReadBaselayer ¶
func ReadBaselayer() (*BaselayerState, error)
ReadBaselayer reads the underlying routing, neighbor and forwarding tables from the Linux kernel.
func (*BaselayerState) GetPeerMac ¶
func (b *BaselayerState) GetPeerMac() (net.HardwareAddr, error)
GetPeerMac finds the MAC address of our link level peer router. TODO Right now we assume there is only 1.
func (*BaselayerState) GetPeerOif ¶
func (b *BaselayerState) GetPeerOif() uint32
GetPeerOif finds the interface our link level peer router is on. TODO right now assume there is only 1.
func (BaselayerState) IsLocalIP ¶
func (b BaselayerState) IsLocalIP(ip string) bool
IsLocalIP determines whether or not an IP address is local to the machine Gobble is running on.
type BgpState ¶
type BgpState struct { Type2Routes []Type2EvpnRoute Type3Routes []Type3EvpnRoute }
BgpState collects Type2Routes and Type3Routes in one place
type Config ¶ added in v0.1.3
type Config struct { Oif uint32 `yaml:"oif"` Quantum int `yaml:"quantum"` GobgpdPort int `yaml:"gobgpd_port"` PeerIfx string `yaml:"peer_ifx"` PeerGw string `yaml:"peer_gw"` BgpSubnet string `yaml:"bgp_subnet"` Trace bool `yaml:"trace"` Table uint `yaml:"table"` }
Config contains all the configuration information needed for Gobble to run.
var Cfg Config
Cfg is the global gobble config
type NbrMsg ¶
NbrMsg encapsulates a netlink NdMsg, providing Marshal/Unmarshal support and Gobble-salient property extraction.
type NdMsg ¶
NdMsg is a Netlink message for communicating with the kernel about neighbors. The unix library does not have this one
type Neighbor ¶
type Neighbor struct { Mac net.HardwareAddr Vlan uint32 Port uint32 Master uint32 If uint32 Ifx string Dst net.IP Vni uint32 SrcVni uint32 Router bool Family uint8 Nsid uint32 }
Neighbor encapsulates information about neighbors that is important to Gobble
type Route ¶
type Route struct { Dest net.IP Src net.IP Gateway net.IP PrefSrc net.IP Oif uint32 Iif uint32 Priority uint32 Metrics uint32 Family uint8 }
Route encapsulates information about a route that is important to Gobble
type RtMsg ¶
type RtMsg struct { Msg unix.RtMsg RawAttributes []netlink.Attribute // extracted attribures Route }
RtMsg encapsulates a unix.RtMsg providing marshal/unmarshal operations and Gobble-salient property extraction.
type Type2EvpnRoute ¶
type Type2EvpnRoute struct { Route *api.EVPNMACIPAdvertisementRoute NextHops []string }
Type2EvpnRoute encapsulates a MAC advertisement route with a set of next-hops
type Type3EvpnRoute ¶
type Type3EvpnRoute struct { Route *api.EVPNInclusiveMulticastEthernetTagRoute CommunityLocalAdmin uint32 }
Type3EvpnRoute encapsulates a multicast Ethernet tag route with a community local admin tag