Documentation ¶
Index ¶
- Constants
- Variables
- type Address
- type AddressStringer
- type Adj
- type AdjGetCounterHandler
- type Adjacency
- type AdjacencyFinalizer
- type Checksum
- func (c Checksum) AddBytes(b []byte) (d Checksum)
- func (c Checksum) AddEven(x Checksum) (d Checksum)
- func (c Checksum) AddRef(first *vnet.Ref, o_first uint) (d Checksum)
- func (sum Checksum) AddWithCarry(x Checksum) (t Checksum)
- func (c Checksum) Fold() vnet.Uint16
- func (c Checksum) SubEven(x Checksum) Checksum
- type Family
- type FamilyConfig
- type FibId
- type FibIndex
- type FibIndexVec
- func (p FibIndexVec) Len() uint
- func (p *FibIndexVec) ResetLen()
- func (p *FibIndexVec) Resize(n uint)
- func (p *FibIndexVec) Validate(i uint) *FibIndex
- func (p *FibIndexVec) ValidateInit(i uint, zero FibIndex) *FibIndex
- func (p *FibIndexVec) ValidateLen(l uint) (v *FibIndex)
- func (p *FibIndexVec) ValidateLenInit(l uint, zero FibIndex) (v *FibIndex)
- type FibName
- type IfAddr
- type IfAddrVec
- func (p IfAddrVec) Len() uint
- func (p *IfAddrVec) ResetLen()
- func (p *IfAddrVec) Resize(n uint)
- func (p *IfAddrVec) Validate(i uint) *IfAddr
- func (p *IfAddrVec) ValidateInit(i uint, zero IfAddr) *IfAddr
- func (p *IfAddrVec) ValidateLen(l uint) (v *IfAddr)
- func (p *IfAddrVec) ValidateLenInit(l uint, zero IfAddr) (v *IfAddr)
- type IfAddress
- type LookupNext
- type Main
- func (m *Main) AddDelInterfaceAddress(si vnet.Si, p *net.IPNet, isDel bool) (ai IfAddr, exists bool, err error)
- func (m *Main) AddDelNextHop(oldAdj Adj, nextHopAdj Adj, nextHopWeight NextHopWeight, af AdjacencyFinalizer, ...) (newAdj Adj, ok bool)
- func (m *Main) AddNextHopsAdj(nhs NextHopVec) (newAdj Adj, ok bool)
- func (m *Main) CallAdjAddHooks(a Adj)
- func (m *Main) CallAdjDelHooks(a Adj)
- func (m *Main) CallAdjGetCounterHooks(adj Adj, f AdjGetCounterHandler, clear bool)
- func (m *Main) CallAdjSyncCounterHooks()
- func (m *Main) ClearAdjCounters()
- func (m *Main) DelAdj(a Adj)
- func (m *Main) DelNextHopsAdj(oldAdj Adj) (ok bool)
- func (m *Main) EqualAdj(ai0, ai1 Adj) (same bool)
- func (f *Main) FibIndexForId(id FibId) (i FibIndex, ok bool)
- func (f *Main) FibIndexForSi(si vnet.Si) FibIndex
- func (f *Main) FibNameForIndex(i FibIndex) string
- func (m *Main) ForeachAdjCounter(a Adj, f AdjGetCounterHandler)
- func (m *Main) ForeachIfAddress(si vnet.Si, f func(ia IfAddr, i *IfAddress) error) error
- func (m *Main) FreeAdj(a Adj) bool
- func (m *Main) GetAdj(a Adj) (as []Adjacency)
- func (m *Main) GetAdjRewriteSi(a Adj) (si vnet.Si, ok bool)
- func (m *Main) GetAdjacencyUsage() elib.HeapUsage
- func (m *Main) GetIfAddr(i IfAddr) *IfAddress
- func (m *Main) GetIfAddress(a net.IP, i FibIndex) (ia *IfAddress)
- func (m *Main) GetLayer(t Protocol) (l vnet.Layer, ok bool)
- func (m *Main) IfAddrForPrefix(p *net.IPNet, si vnet.Si) (ai IfAddr, exists bool)
- func (m *Main) IfFirstAddr(i vnet.Si) IfAddr
- func (m *Main) IfFirstAddress(i vnet.Si) (ifa *IfAddress)
- func (m *Main) Init(v *vnet.Vnet)
- func (m *Main) InterfaceAddressReset(v *vnet.Vnet)
- func (m *Main) IsAdjFree(a Adj) bool
- func (m *Main) IsMpAdj(a Adj) bool
- func (m *Main) NewAdj(n uint) (Adj, []Adjacency)
- func (m *Main) NewAdjWithTemplate(n uint, template *Adjacency) (ai Adj, as []Adjacency)
- func (m *Main) NextHopsForAdj(a Adj) (nhs nextHopVec)
- func (m *Main) PackageInit(v *vnet.Vnet, c FamilyConfig)
- func (m *Main) PoisonAdj(a Adj)
- func (m *Main) RegisterAdjAddDelHook(f adjAddDelHook, dep ...*dep.Dep)
- func (m *Main) RegisterAdjGetCounterHook(f adjGetCounterHook, dep ...*dep.Dep)
- func (m *Main) RegisterAdjSyncCounterHook(f adjSyncCounterHook, dep ...*dep.Dep)
- func (m *Main) RegisterLayer(v *vnet.Vnet, t Protocol, l vnet.Layer)
- func (m *Main) ReplaceNextHop(ai, fromNextHopAdj, toNextHopAdj Adj, af AdjacencyFinalizer) (newAdj Adj, err error)
- func (f *Main) SetFibIndexForId(id FibId, i FibIndex)
- func (m *Main) SetFibIndexForSi(si vnet.Si, fi FibIndex)
- func (f *Main) SetFibNameForIndex(name string, i FibIndex)
- func (m *Main) UnregisterLayer(v *vnet.Vnet, t Protocol) (ok bool)
- func (f *Main) ValidateFibIndexForSi(si vnet.Si) FibIndex
- type NextHop
- type NextHopVec
- type NextHopWeight
- type Prefix
- type Protocol
Constants ¶
View Source
const IfAddrNil = ^IfAddr(0)
Variables ¶
View Source
var ( ErrNotRewrite = errors.New("replacment adjacenty is not rewrite") ErrNotFound = errors.New("adjacency not found") )
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Address [16]uint8
Generic ip4/ip6 address: big enough for either.
func AddressUint32 ¶
func AddressUint64 ¶
type AddressStringer ¶
type Adj ¶
type Adj uint32
Index into adjacency table.
const ( AdjMiss Adj = 0 AdjDrop Adj = 1 AdjPunt Adj = 2 AdjNil Adj = (^Adj(0) - 1) // so AdjNil + 1 is non-zero for remaps. )
Miss adjacency is always first in adjacency table.
func (Adj) IsViaRoute ¶
type AdjGetCounterHandler ¶
type AdjGetCounterHandler func(tag string, v vnet.CombinedCounter)
type Adjacency ¶
type Adjacency struct { // Next hop after ip4-lookup. LookupNextIndex LookupNext // Number of adjecencies in block. Greater than 1 means multipath; otherwise equal to 1. NAdj uint16 // not used for Local and Glean // Destination index for rewrite. Index uint32 vnet.Rewrite }
type AdjacencyFinalizer ¶
type AdjacencyFinalizer interface {
FinalizeAdjacency(a *Adjacency)
}
type Checksum ¶
type Checksum uint64
Incremental checksum update.
func (Checksum) AddWithCarry ¶
type FamilyConfig ¶
type FamilyConfig struct { AddressStringer AddressStringer Family Family RewriteNode vnet.Noder PacketType vnet.PacketType GetRoute func(p *net.IPNet, si vnet.Si) (ai Adj, as []Adjacency, ok bool) GetReachable func(p *net.IPNet, si vnet.Si) (ai Adj, as []Adjacency, ok bool) GetRouteFibIndex func(p *net.IPNet, fi FibIndex) (ai Adj, ok bool) AddDelRoute func(p *net.IPNet, fi FibIndex, newAdj Adj, isDel bool) (oldAdj Adj, err error) }
type FibIndexVec ¶
type FibIndexVec []FibIndex
func (FibIndexVec) Len ¶
func (p FibIndexVec) Len() uint
func (*FibIndexVec) ResetLen ¶
func (p *FibIndexVec) ResetLen()
func (*FibIndexVec) Resize ¶
func (p *FibIndexVec) Resize(n uint)
func (*FibIndexVec) Validate ¶
func (p *FibIndexVec) Validate(i uint) *FibIndex
func (*FibIndexVec) ValidateInit ¶
func (p *FibIndexVec) ValidateInit(i uint, zero FibIndex) *FibIndex
func (*FibIndexVec) ValidateLen ¶
func (p *FibIndexVec) ValidateLen(l uint) (v *FibIndex)
func (*FibIndexVec) ValidateLenInit ¶
func (p *FibIndexVec) ValidateLenInit(l uint, zero FibIndex) (v *FibIndex)
type LookupNext ¶
type LookupNext uint16
Next node index stored in ip adjacencies.
const ( // Packet does not match any route in table. LookupNextMiss LookupNext = iota // Adjacency says to drop or punt this packet. LookupNextDrop LookupNextPunt // This packet matches an IP address of one of our interfaces. LookupNextLocal // Glean node. // This packet matches an "interface route" and packets need to be passed to ip4 ARP (or ip6 neighbor discovery) // to find rewrite string for this destination. LookupNextGlean // This packet is to be rewritten and forwarded to the next // processing node. This is typically the output interface but // might be another node for further output processing. LookupNextRewrite LookupNNext )
func (*LookupNext) Parse ¶
func (n *LookupNext) Parse(in *parse.Input)
func (LookupNext) String ¶
func (n LookupNext) String() string
type Main ¶
type Main struct { FamilyConfig // contains filtered or unexported fields }
func (*Main) AddDelInterfaceAddress ¶
func (*Main) AddDelNextHop ¶
func (m *Main) AddDelNextHop(oldAdj Adj, nextHopAdj Adj, nextHopWeight NextHopWeight, af AdjacencyFinalizer, isDel bool) (newAdj Adj, ok bool)
func (*Main) AddNextHopsAdj ¶
func (m *Main) AddNextHopsAdj(nhs NextHopVec) (newAdj Adj, ok bool)
func (*Main) CallAdjAddHooks ¶
func (*Main) CallAdjDelHooks ¶
func (*Main) CallAdjGetCounterHooks ¶
func (m *Main) CallAdjGetCounterHooks(adj Adj, f AdjGetCounterHandler, clear bool)
func (*Main) CallAdjSyncCounterHooks ¶
func (m *Main) CallAdjSyncCounterHooks()
func (*Main) ClearAdjCounters ¶
func (m *Main) ClearAdjCounters()
func (*Main) DelNextHopsAdj ¶
func (*Main) FibIndexForId ¶
func (*Main) FibIndexForSi ¶
func (*Main) FibNameForIndex ¶
func (*Main) ForeachAdjCounter ¶
func (m *Main) ForeachAdjCounter(a Adj, f AdjGetCounterHandler)
func (*Main) ForeachIfAddress ¶
func (*Main) GetAdjacencyUsage ¶
func (*Main) IfAddrForPrefix ¶
func (*Main) IfFirstAddr ¶
func (*Main) IfFirstAddress ¶
func (*Main) InterfaceAddressReset ¶
deletes ALL interface addresses
func (*Main) NewAdjWithTemplate ¶
func (*Main) NextHopsForAdj ¶
func (m *Main) NextHopsForAdj(a Adj) (nhs nextHopVec)
func (*Main) PackageInit ¶
func (m *Main) PackageInit(v *vnet.Vnet, c FamilyConfig)
func (*Main) RegisterAdjAddDelHook ¶
func (*Main) RegisterAdjGetCounterHook ¶
func (*Main) RegisterAdjSyncCounterHook ¶
func (*Main) ReplaceNextHop ¶
func (m *Main) ReplaceNextHop(ai, fromNextHopAdj, toNextHopAdj Adj, af AdjacencyFinalizer) (newAdj Adj, err error)
func (*Main) SetFibIndexForId ¶
func (*Main) SetFibNameForIndex ¶
func (*Main) ValidateFibIndexForSi ¶
type NextHop ¶
func (*NextHop) FinalizeAdjacency ¶
func (*NextHop) NextHopFibIndex ¶
func (*NextHop) NextHopWeight ¶
func (n *NextHop) NextHopWeight() NextHopWeight
type NextHopVec ¶
type NextHopVec []NextHop
func (NextHopVec) ListNhs ¶
func (nhs NextHopVec) ListNhs(m *Main) string
func (NextHopVec) Match ¶
func (nhs NextHopVec) Match(nhs2 []NextHop) bool
type NextHopWeight ¶
type NextHopWeight uint32
type Prefix ¶
func NewPrefix ¶
NewPrefix returns prefix with given length and address. Address will be masked so that only length bits may be non-zero.
func (*Prefix) IsMoreSpecific ¶
Returns whether p matches q and is more specific.
func (*Prefix) IsMoreSpecificMatch ¶
Like IsMoreSpecific but qualify by returning if prefix matches
type Protocol ¶
type Protocol uint8
8-bit protocol field from IP 4/6 headers.
const ( IP6_HOP_BY_HOP_OPTIONS Protocol = 0 ICMP Protocol = 1 IGMP Protocol = 2 GGP Protocol = 3 IP_IN_IP Protocol = 4 ST Protocol = 5 TCP Protocol = 6 CBT Protocol = 7 EGP Protocol = 8 IGP Protocol = 9 BBN_RCC_MON Protocol = 10 NVP2 Protocol = 11 PUP Protocol = 12 ARGUS Protocol = 13 EMCON Protocol = 14 XNET Protocol = 15 CHAOS Protocol = 16 UDP Protocol = 17 MUX Protocol = 18 DCN_MEAS Protocol = 19 HMP Protocol = 20 PRM Protocol = 21 XNS_IDP Protocol = 22 TRUNK1 Protocol = 23 TRUNK2 Protocol = 24 LEAF1 Protocol = 25 LEAF2 Protocol = 26 RDP Protocol = 27 IRTP Protocol = 28 ISO_TP4 Protocol = 29 NETBLT Protocol = 30 MFE_NSP Protocol = 31 MERIT_INP Protocol = 32 SEP Protocol = 33 THREE_PC Protocol = 34 IDPR Protocol = 35 XTP Protocol = 36 DDP Protocol = 37 IDPR_CMTP Protocol = 38 TP Protocol = 39 IL Protocol = 40 IP6_IN_IP Protocol = 41 SDRP Protocol = 42 IP6_ROUTE Protocol = 43 IP6_FRAG Protocol = 44 IDRP Protocol = 45 RSVP Protocol = 46 GRE Protocol = 47 MHRP Protocol = 48 BNA Protocol = 49 IPSEC_ESP Protocol = 50 IPSEC_AH Protocol = 51 I_NLSP Protocol = 52 SWIPE Protocol = 53 NARP Protocol = 54 MOBILE Protocol = 55 TLSP Protocol = 56 SKIP Protocol = 57 ICMP6 Protocol = 58 IP6_NONXT Protocol = 59 IP6_DST_OPTIONS Protocol = 60 CFTP Protocol = 62 SAT_EXPAK Protocol = 64 KRYPTOLAN Protocol = 65 RVD Protocol = 66 IPPC Protocol = 67 SAT_MON Protocol = 69 VISA Protocol = 70 IPCV Protocol = 71 CPNX Protocol = 72 CPHB Protocol = 73 WSN Protocol = 74 PVP Protocol = 75 BR_SAT_MON Protocol = 76 SUN_ND Protocol = 77 WB_MON Protocol = 78 WB_EXPAK Protocol = 79 ISO_IP Protocol = 80 VMTP Protocol = 81 SECURE_VMTP Protocol = 82 VINES Protocol = 83 TTP Protocol = 84 NSFNET_IGP Protocol = 85 DGP Protocol = 86 TCF Protocol = 87 EIGRP Protocol = 88 OSPF Protocol = 89 SPRITE_RPC Protocol = 90 LARP Protocol = 91 MTP Protocol = 92 AX Protocol = 93 IPIP Protocol = 94 MICP Protocol = 95 SCC_SP Protocol = 96 ETHERIP Protocol = 97 ENCAP Protocol = 98 GMTP Protocol = 100 IFMP Protocol = 101 PNNI Protocol = 102 PIM Protocol = 103 ARIS Protocol = 104 SCPS Protocol = 105 QNX Protocol = 106 A Protocol = 107 IPCOMP Protocol = 108 SNP Protocol = 109 COMPAQ_PEER Protocol = 110 IPX_IN_IP Protocol = 111 VRRP Protocol = 112 PGM Protocol = 113 L2TP Protocol = 115 DDX Protocol = 116 IATP Protocol = 117 STP Protocol = 118 SRP Protocol = 119 UTI Protocol = 120 SMP Protocol = 121 SM Protocol = 122 PTP Protocol = 123 ISIS Protocol = 124 FIRE Protocol = 125 CRTP Protocol = 126 CRUDP Protocol = 127 SSCOPMCE Protocol = 128 IPLT Protocol = 129 SPS Protocol = 130 PIPE Protocol = 131 SCTP Protocol = 132 FC Protocol = 133 RSVP_E2E_IGNORE Protocol = 134 MOBILITY Protocol = 135 UDP_LITE Protocol = 136 MPLS_IN_IP Protocol = 137 RESERVED Protocol = 255 )
func (Protocol) MaskedString ¶
func (v Protocol) MaskedString(r vnet.MaskedStringer) (s string)
Source Files ¶
- adjacency.go
- checksum.go
- fib.go
- gentemplate_dep_adjadddelhook.go
- gentemplate_dep_adjgetcounterhook.go
- gentemplate_dep_adjsynchook.go
- gentemplate_heap_adjacencyheap.go
- gentemplate_heap_nexthopheap.go
- gentemplate_pool_ifaddress.go
- gentemplate_pool_multipathadjacencypool.go
- gentemplate_vec_fibindex.go
- gentemplate_vec_ifaddr.go
- gentemplate_vec_nexthopvec.go
- interface.go
- ip.go
- main.go
- packet.go
Click to show internal directories.
Click to hide internal directories.