Documentation ¶
Index ¶
- Constants
- func Init(v *vnet.Vnet) *ip.Main
- func RegisterLayer(v *vnet.Vnet, t ip.Protocol, l vnet.Layer)
- func UnregisterLayer(v *vnet.Vnet, t ip.Protocol) (ok bool)
- type Address
- func (a *Address) Add(x uint64)
- func (a Address) AsUint32() vnet.Uint32
- func (a *Address) Diff(b *Address) (v int)
- func (a *Address) FromUint32(x vnet.Uint32)
- func (a *Address) HexString() string
- func (a *Address) IsEqual(b *Address) bool
- func (a *Address) IsZero() bool
- func (a *Address) Mask(l uint) (v Address)
- func (a *Address) MaskLen() (l uint, ok bool)
- func (v *Address) MaskedString(r vnet.MaskedStringer) (s string)
- func (dst *Address) MatchesPrefix(p *Prefix) bool
- func (a *Address) Parse(in *parse.Input)
- func (a *Address) String() string
- func (a *Address) ToIp() (v ip.Address)
- func (a Address) ToNetIP() (ip net.IP)
- type Fib
- func (f *Fib) GetDrop(p *net.IPNet) (result *FibResult, ok bool)
- func (f *Fib) GetFib(p *net.IPNet, nhs ip.NextHopVec) (a ip.Adj, result *FibResult, ok bool)
- func (f *Fib) GetGlean(p *net.IPNet, si vnet.Si) (a ip.Adj, result *FibResult, ok bool)
- func (f *Fib) GetInstalled(p *net.IPNet) (result *FibResult, ok bool)
- func (f *Fib) GetLocal(p *net.IPNet, si vnet.Si) (a ip.Adj, result *FibResult, ok bool)
- func (f *Fib) GetPunt(p *net.IPNet) (result *FibResult, ok bool)
- func (f *Fib) GetReachable(p *net.IPNet, si vnet.Si) (a ip.Adj, result *FibResult, ok bool)
- func (f *Fib) GetUnreachable(p *net.IPNet, si vnet.Si) (a ip.Adj, result *FibResult, ok bool)
- func (f *Fib) Len() (n uint)
- func (f *Fib) Reset()
- type FibAddDelHook
- type FibAddDelHookVec
- type FibResult
- type FibResultVec
- type FibVec
- type Header
- type HeaderFlags
- type IfAddrAddDelHook
- type IfAddrAddDelHookVec
- type Main
- func (m *Main) AddDelInterfaceAddress(si vnet.Si, addr *net.IPNet, isDel bool) (err error)
- func (m *Main) AddDelInterfaceAddressRoute(p *net.IPNet, si vnet.Si, rt RouteType, isDel bool)
- func (m *Main) AddDelRouteNeighbor(p *net.IPNet, n *Neighbor, fi ip.FibIndex, isDel bool) (err error)
- func (m *Main) AddDelRouteNextHop(p *net.IPNet, nh *NextHop, isDel bool, isReplace bool) (err error)
- func (m *Main) AddDelRouteNextHops(fibIndex ip.FibIndex, p *net.IPNet, nhs ip.NextHopVec, isDel bool, ...) (err error)
- func (m *Main) FibReset(fi ip.FibIndex)
- func (m *Main) ForeachUnresolved(fn func(fi ip.FibIndex, p net.IPNet))
- func (m *Main) FormatLayer(b []byte) (lines []string)
- func (m *Main) Init() (err error)
- func (m *Main) Name() string
- func (m *Main) ParseLayer(b []byte, in *parse.Input) (n uint)
- func (m *Main) ParseStream(in *parse.Input) (r pg.Streamer, err error)
- func (m *Main) RegisterFibAddDelHook(f FibAddDelHook, dep ...*dep.Dep)
- type MapFib
- func (x *MapFib) GetByNhs(p *net.IPNet, nhs ip.NextHopVec) (a ip.Adj, result *FibResult, ok bool)
- func (x *MapFib) GetBySi(p *net.IPNet, si vnet.Si) (a ip.Adj, result *FibResult, ok bool)
- func (m *MapFib) Set(ma *Main, p *net.IPNet, newAdj ip.Adj, nhs ip.NextHopVec, rt RouteType) (oldAdj ip.Adj, result *FibResult, ok bool)
- func (m *MapFib) SetConn(ma *Main, p *net.IPNet, adj ip.Adj, si vnet.Si) (oldAdj ip.Adj, result *FibResult, ok bool)
- func (m *MapFib) Unset(p *net.IPNet, nhs ip.NextHopVec) (oldAdj ip.Adj, ok bool)
- func (m *MapFib) UnsetConn(p *net.IPNet, si vnet.Si) (oldAdj ip.Adj, ok bool)
- func (m *MapFib) UnsetFirst(p *net.IPNet) (oldAdj ip.Adj, ok bool)
- type Neighbor
- type NextHop
- type NextHopper
- type Prefix
- func (p *Prefix) Add(offset uint) (q Prefix)
- func (p *Prefix) ApplyMask() (q *Prefix)
- func (p *Prefix) IsEqual(q *Prefix) bool
- func (p *Prefix) LessThan(q *Prefix) bool
- func (p *Prefix) Mask() vnet.Uint32
- func (p *Prefix) MaskAsAddress() (a Address)
- func (p *Prefix) Matches(q *Prefix) bool
- func (p *Prefix) Parse(in *parse.Input)
- func (p *Prefix) SetLen(l uint)
- func (p *Prefix) String() string
- func (p Prefix) ToIPNet() (ipn net.IPNet)
- func (p *Prefix) ToIpPrefix() (i ip.Prefix)
- type RouteType
Constants ¶
const ( AddressBytes = 4 AddressBits = 8 * AddressBytes SizeofHeader = 20 MoreFragments HeaderFlags = 1 << 13 DontFragment HeaderFlags = 1 << 14 Congestion HeaderFlags = 1 << 15 )
const DefaultTtl = 64
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Address ¶
type Address [AddressBytes]uint8
func AddressMaskForLen ¶
func AddressUint32 ¶
func NetIPToV4Address ¶
func (*Address) FromUint32 ¶
func (*Address) MaskedString ¶
func (v *Address) MaskedString(r vnet.MaskedStringer) (s string)
func (*Address) MatchesPrefix ¶
True if given destination matches prefix.
type Fib ¶
func (*Fib) GetReachable ¶
func (*Fib) GetUnreachable ¶
type FibAddDelHookVec ¶
type FibAddDelHookVec struct {
// contains filtered or unexported fields
}
func (*FibAddDelHookVec) Add ¶
func (t *FibAddDelHookVec) Add(x FibAddDelHook, ds ...*dep.Dep)
func (*FibAddDelHookVec) Get ¶
func (t *FibAddDelHookVec) Get(i int) FibAddDelHook
func (*FibAddDelHookVec) Len ¶
func (t *FibAddDelHookVec) Len() int
type FibResult ¶
type FibResultVec ¶
type FibResultVec []FibResult
func (*FibResultVec) ForeachMatchingNhAddress ¶
func (FibResultVec) GetByNhs ¶
func (rs FibResultVec) GetByNhs(nhs ip.NextHopVec) (r FibResult, ri int, ok bool)
returns first match
type Header ¶
type Header struct { // 4 bit header length (in 32bit units) and version VVVVLLLL. // e.g. for packets w/ no options ip_version_and_header_length == 0x45. Ip_version_and_header_length uint8 // Type of service. Tos uint8 // Total layer 3 packet length including this header. Length vnet.Uint16 // 16-bit number such that Src, Dst, Protocol and Fragment ID together uniquely // identify packet for fragment re-assembly. Fragment_id vnet.Uint16 // 3 bits of flags and 13 bits of fragment offset (in units of 8 bytes). Flags_and_fragment_offset vnet.Uint16 // Time to live decremented by router at each hop. Ttl uint8 // Next layer protocol. Protocol ip.Protocol Checksum vnet.Uint16 // Source and destination address. Src, Dst net.IP }
func ParseHeader ¶
func (*Header) ComputeChecksum ¶
func (*Header) GetHeaderFlags ¶
func (h *Header) GetHeaderFlags() HeaderFlags
type HeaderFlags ¶
func (HeaderFlags) FromHost ¶
func (t HeaderFlags) FromHost() vnet.Uint16
type IfAddrAddDelHook ¶
type IfAddrAddDelHookVec ¶
type IfAddrAddDelHookVec struct {
// contains filtered or unexported fields
}
func (*IfAddrAddDelHookVec) Add ¶
func (t *IfAddrAddDelHookVec) Add(x IfAddrAddDelHook, ds ...*dep.Dep)
func (*IfAddrAddDelHookVec) Get ¶
func (t *IfAddrAddDelHookVec) Get(i int) IfAddrAddDelHook
func (*IfAddrAddDelHookVec) Len ¶
func (t *IfAddrAddDelHookVec) Len() int
type Main ¶
type Main struct { vnet.Package ip.Main FibShowUsageHooks fibShowUsageHookVec // contains filtered or unexported fields }
func (*Main) AddDelInterfaceAddress ¶
func (*Main) AddDelInterfaceAddressRoute ¶
In Linux, local route is added to table local when an address is assigned to interface. It stays there regardless of whether interface is admin up or down Glean route, on the other hand, is added to table main when an interface is admin up, and removed when admin down There will be explicit fdb messages to add or delete these routes, so no need to maintain state in vnet You can also have multiple local and glean per interface
func (*Main) AddDelRouteNeighbor ¶
func (*Main) AddDelRouteNextHop ¶
func (m *Main) AddDelRouteNextHop(p *net.IPNet, nh *NextHop, isDel bool, isReplace bool) (err error)
modified for legacy netlink and ip/cli use, where nexthop were added 1 at a time instead of a vector at at time
func (*Main) AddDelRouteNextHops ¶
func (m *Main) AddDelRouteNextHops(fibIndex ip.FibIndex, p *net.IPNet, nhs ip.NextHopVec, isDel bool, isReplace bool) (err error)
NextHops comes as a vector
func (*Main) ForeachUnresolved ¶
func (*Main) FormatLayer ¶
func (*Main) RegisterFibAddDelHook ¶
func (m *Main) RegisterFibAddDelHook(f FibAddDelHook, dep ...*dep.Dep)
type MapFib ¶
type MapFib [1 + 32]map[string]FibResultVec
string key is the string output of the net.IPNet stringer
type Neighbor ¶
type Neighbor struct { Header Header LocalSi vnet.Si FibIndex ip.FibIndex Weight ip.NextHopWeight // Header payload (for example, GRE header). Payload []byte // contains filtered or unexported fields }
func (*Neighbor) FinalizeAdjacency ¶
func (*Neighbor) NextHopWeight ¶
func (n *Neighbor) NextHopWeight() ip.NextHopWeight
type NextHop ¶
func (*NextHop) FinalizeAdjacency ¶
func (*NextHop) NextHopWeight ¶
func (n *NextHop) NextHopWeight() ip.NextHopWeight
type NextHopper ¶
type NextHopper interface { ip.AdjacencyFinalizer NextHopFibIndex(m *Main) ip.FibIndex NextHopWeight() ip.NextHopWeight }
type Prefix ¶
func FromIp4Prefix ¶
func IPNetToV4Prefix ¶
func (*Prefix) MaskAsAddress ¶
func (*Prefix) ToIpPrefix ¶
type RouteType ¶
type RouteType uint8