Documentation ¶
Overview ¶
Package bpf provides primitives to manage Calico-specific XDP programs attached to network interfaces, along with the blocklist LPM map and the failsafe map.
It does not call the bpf() syscall itself but executes external programs like bpftool and ip.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- func AlreadyAttachedProg(a AttachPointInfo, object string, id int) (bool, error)
- func CidrToHex(cidr string) ([]string, error)
- func CleanAttachedProgDir()
- func CleanUpCalicoPins(dir string)
- func ForgetAttachedProg(iface string, hook hook.Hook) error
- func ForgetIfaceAttachedProg(iface string) error
- func GetMinKernelVersionForDistro(distName string) *environment.Version
- func GetMockXDPTag(bytes []byte) string
- func IterMapCmdOutput(output []byte, f func(k, v []byte)) error
- func IterPerCpuMapCmdOutput(output []byte, f func(k, v []byte)) error
- func KTimeNanos() int64
- func ListCalicoAttached() (map[string]EPAttachInfo, error)
- func ListTcXDPAttachedProgs(dev ...string) (TcList, XDPList, error)
- func MapPinDir(typ int, name, iface string, h hook.Hook) string
- func MemberToIPMask(member string) (*net.IP, int, error)
- func PinBPFProgram(fd ProgFD, filename string) error
- func PolicyDebugJSONFileName(iface, polDir string, ipFamily proto.IPVersion) string
- func RememberAttachedProg(a AttachPointInfo, object string, id int) error
- func RuntimeJSONFilename(iface string, hook hook.Hook) string
- func SupportsBPFDataplane() error
- func SupportsSockmap() error
- func SupportsXDP() error
- func SyscallSupport() bool
- type AttachPoint
- type AttachPointInfo
- type AttachResult
- type AttachedProgInfo
- type BPFDataplane
- type BPFLib
- func (b *BPFLib) AttachToCgroup() error
- func (b *BPFLib) AttachToSockmap() error
- func (b *BPFLib) DetachFromCgroup(mode FindObjectMode) error
- func (b *BPFLib) DetachFromSockmap(mode FindObjectMode) error
- func (b *BPFLib) DumpCIDRMap(ifName string, family IPFamily) (map[CIDRMapKey]uint32, error)
- func (b *BPFLib) DumpFailsafeMap() ([]ProtoPort, error)
- func (b *BPFLib) DumpSockmapEndpointsMap(family IPFamily) ([]CIDRMapKey, error)
- func (b *BPFLib) GetBPFCalicoDir() string
- func (b *BPFLib) GetCIDRMapID(ifName string, family IPFamily) (int, error)
- func (b *BPFLib) GetFailsafeMapID() (int, error)
- func (b *BPFLib) GetMapsFromXDP(ifName string) ([]int, error)
- func (b *BPFLib) GetXDPID(ifName string) (int, error)
- func (b *BPFLib) GetXDPIfaces() ([]string, error)
- func (b *BPFLib) GetXDPMode(ifName string) (XDPMode, error)
- func (b *BPFLib) GetXDPObjTag(objPath string) (tag string, err error)
- func (b *BPFLib) GetXDPObjTagAuto() (string, error)
- func (b *BPFLib) GetXDPTag(ifName string) (string, error)
- func (b *BPFLib) IsValidMap(ifName string, family IPFamily) (bool, error)
- func (b *BPFLib) ListCIDRMaps(family IPFamily) ([]string, error)
- func (b *BPFLib) LoadSkMsg(objPath string) error
- func (b *BPFLib) LoadSkMsgAuto() error
- func (b *BPFLib) LoadSockops(objPath string) error
- func (b *BPFLib) LoadSockopsAuto() error
- func (b *BPFLib) LoadXDP(objPath, ifName string, mode XDPMode) error
- func (b *BPFLib) LoadXDPAuto(ifName string, mode XDPMode) error
- func (b *BPFLib) LookupCIDRMap(ifName string, family IPFamily, ip net.IP, mask int) (uint32, error)
- func (b *BPFLib) LookupFailsafeMap(proto uint8, port uint16) (bool, error)
- func (b *BPFLib) LookupSockmapEndpointsMap(ip net.IP, mask int) (bool, error)
- func (b *BPFLib) NewCIDRMap(ifName string, family IPFamily) (string, error)
- func (b *BPFLib) NewFailsafeMap() (string, error)
- func (b *BPFLib) NewSockmap() (string, error)
- func (b *BPFLib) NewSockmapEndpointsMap() (string, error)
- func (b *BPFLib) RemoveCIDRMap(ifName string, family IPFamily) error
- func (b *BPFLib) RemoveFailsafeMap() error
- func (b *BPFLib) RemoveItemCIDRMap(ifName string, family IPFamily, ip net.IP, mask int) error
- func (b *BPFLib) RemoveItemFailsafeMap(proto uint8, port uint16) error
- func (b *BPFLib) RemoveItemSockmapEndpointsMap(ip net.IP, mask int) error
- func (b *BPFLib) RemoveSkMsg() error
- func (b *BPFLib) RemoveSockmap(mode FindObjectMode) error
- func (b *BPFLib) RemoveSockmapEndpointsMap() error
- func (b *BPFLib) RemoveSockops() error
- func (b *BPFLib) RemoveXDP(ifName string, mode XDPMode) error
- func (b *BPFLib) UpdateCIDRMap(ifName string, family IPFamily, ip net.IP, mask int, refCount uint32) error
- func (b *BPFLib) UpdateFailsafeMap(proto uint8, port uint16) error
- func (b *BPFLib) UpdateSockmapEndpoints(ip net.IP, mask int) error
- type BPFProgType
- type Binary
- type CIDRMap
- type CIDRMapInfo
- type CIDRMapKey
- type CIDRMapsKey
- type CommonMapInfo
- type EPAttachInfo
- type FailsafeMap
- type FailsafeMapInfo
- type FindObjectMode
- type IPFamily
- type IPv4Mask
- type MockBPFLib
- func (b *MockBPFLib) AttachToCgroup() error
- func (b *MockBPFLib) AttachToSockmap() error
- func (b *MockBPFLib) DetachFromCgroup(mode FindObjectMode) error
- func (b *MockBPFLib) DetachFromSockmap(mode FindObjectMode) error
- func (b *MockBPFLib) DumpCIDRMap(ifName string, family IPFamily) (map[CIDRMapKey]uint32, error)
- func (b *MockBPFLib) DumpFailsafeMap() ([]ProtoPort, error)
- func (b *MockBPFLib) DumpSockmapEndpointsMap(family IPFamily) ([]CIDRMapKey, error)
- func (b *MockBPFLib) GetBPFCalicoDir() string
- func (b *MockBPFLib) GetCIDRMapID(ifName string, family IPFamily) (int, error)
- func (b *MockBPFLib) GetFailsafeMapID() (int, error)
- func (b *MockBPFLib) GetMapsFromXDP(ifName string) ([]int, error)
- func (b *MockBPFLib) GetXDPID(ifName string) (int, error)
- func (b *MockBPFLib) GetXDPIfaces() ([]string, error)
- func (b *MockBPFLib) GetXDPMode(ifName string) (XDPMode, error)
- func (b *MockBPFLib) GetXDPObjTag(objPath string) (tag string, err error)
- func (b *MockBPFLib) GetXDPObjTagAuto() (string, error)
- func (b *MockBPFLib) GetXDPTag(ifName string) (string, error)
- func (b *MockBPFLib) IsValidMap(ifName string, family IPFamily) (bool, error)
- func (b *MockBPFLib) ListCIDRMaps(family IPFamily) ([]string, error)
- func (b *MockBPFLib) LoadSkMsg(objPath string) error
- func (b *MockBPFLib) LoadSkMsgAuto() error
- func (b *MockBPFLib) LoadSockops(objPath string) error
- func (b *MockBPFLib) LoadSockopsAuto() error
- func (b *MockBPFLib) LoadXDP(objPath, ifName string, mode XDPMode) error
- func (b *MockBPFLib) LoadXDPAuto(ifName string, mode XDPMode) error
- func (b *MockBPFLib) LookupCIDRMap(ifName string, family IPFamily, ip net.IP, mask int) (uint32, error)
- func (b *MockBPFLib) LookupFailsafeMap(proto uint8, port uint16) (bool, error)
- func (b *MockBPFLib) LookupSockmapEndpointsMap(ip net.IP, mask int) (bool, error)
- func (b *MockBPFLib) NewCIDRMap(ifName string, family IPFamily) (string, error)
- func (b *MockBPFLib) NewFailsafeMap() (string, error)
- func (b *MockBPFLib) NewSockmap() (string, error)
- func (b *MockBPFLib) NewSockmapEndpointsMap() (string, error)
- func (b *MockBPFLib) RemoveCIDRMap(ifName string, family IPFamily) error
- func (b *MockBPFLib) RemoveFailsafeMap() error
- func (b *MockBPFLib) RemoveItemCIDRMap(ifName string, family IPFamily, ip net.IP, mask int) error
- func (b *MockBPFLib) RemoveItemFailsafeMap(proto uint8, port uint16) error
- func (b *MockBPFLib) RemoveItemSockmapEndpointsMap(ip net.IP, mask int) error
- func (b *MockBPFLib) RemoveSkMsg() error
- func (b *MockBPFLib) RemoveSockmap(mode FindObjectMode) error
- func (b *MockBPFLib) RemoveSockmapEndpointsMap() error
- func (b *MockBPFLib) RemoveSockops() error
- func (b *MockBPFLib) RemoveXDP(ifName string, mode XDPMode) error
- func (b *MockBPFLib) UpdateCIDRMap(ifName string, family IPFamily, ip net.IP, mask int, refCount uint32) error
- func (b *MockBPFLib) UpdateFailsafeMap(proto uint8, port uint16) error
- func (b *MockBPFLib) UpdateSockmapEndpoints(ip net.IP, mask int) error
- type PolicyDebugInfo
- type ProgFD
- type ProgInfo
- type ProgResult
- type ProtoPort
- type SkMsgInfo
- type SockMap
- type SockMapInfo
- type SockopsInfo
- type TcList
- type XDPInfo
- type XDPList
- type XDPMode
Constants ¶
const ( RuntimeProgDir = "/var/run/calico/bpf/prog" RuntimePolDir = "/var/run/calico/bpf/policy" )
Variables ¶
This section is empty.
Functions ¶
func AlreadyAttachedProg ¶
func AlreadyAttachedProg(a AttachPointInfo, object string, id int) (bool, error)
AlreadyAttachedProg checks that the program we are going to attach has the same parameters as what we remembered about the currently attached.
func CidrToHex ¶
CidrToHex takes a CIDR in string form (e.g. "192.168.0.0/16") and outputs a string slice of hex-encoded bytes ready to be passed to bpftool.
For example, for "192.168.0.0/16":
[
10, 00, 00, 00, mask in little endian order C0, A8, 00, 00 IP address
]
func CleanAttachedProgDir ¶
func CleanAttachedProgDir()
CleanAttachedProgDir makes sure /var/run/calico/bpf/prog exists and removes json files related to interfaces that do not exist.
func CleanUpCalicoPins ¶
func CleanUpCalicoPins(dir string)
func ForgetAttachedProg ¶
ForgetAttachedProg removes what we store about the iface/hook program.
func ForgetIfaceAttachedProg ¶
ForgetIfaceAttachedProg removes information we store about any programs associated with an iface.
func GetMinKernelVersionForDistro ¶
func GetMinKernelVersionForDistro(distName string) *environment.Version
func GetMockXDPTag ¶
func IterMapCmdOutput ¶
IterMapCmdOutput iterates over the output of a command obtained by DumpMapCmd
func IterPerCpuMapCmdOutput ¶
IterPerCpuMapCmdOutput iterates over the output of the dump of per-cpu map
func KTimeNanos ¶
func KTimeNanos() int64
KTimeNanos returns a nanosecond timestamp that is comparable with the ones generated by BPF.
func ListCalicoAttached ¶
func ListCalicoAttached() (map[string]EPAttachInfo, error)
ListCalicoAttached list all programs that are attached to TC or XDP and are related to Calico. That is, they have jumpmap pinned in our dir hierarchy.
func ListTcXDPAttachedProgs ¶
ListTcXDPAttachedProgs returns all programs attached to TC or XDP hooks.
func PinBPFProgram ¶
func PolicyDebugJSONFileName ¶
func RememberAttachedProg ¶
func RememberAttachedProg(a AttachPointInfo, object string, id int) error
RememberAttachedProg stores the attached programs parameters in a file.
func RuntimeJSONFilename ¶
RuntimeJSONFilename returns filename where we store information about attached program. The filename is [iface name]_hook.json, for example, eth0_egress.json
func SupportsBPFDataplane ¶
func SupportsBPFDataplane() error
func SupportsSockmap ¶
func SupportsSockmap() error
func SupportsXDP ¶
func SupportsXDP() error
func SyscallSupport ¶
func SyscallSupport() bool
Types ¶
type AttachPoint ¶
type AttachPoint struct { Hook hook.Hook PolicyIdxV4 int PolicyIdxV6 int Iface string LogLevel string }
func (*AttachPoint) HookName ¶
func (ap *AttachPoint) HookName() hook.Hook
func (*AttachPoint) IfaceName ¶
func (ap *AttachPoint) IfaceName() string
func (*AttachPoint) LogVal ¶
func (ap *AttachPoint) LogVal() string
type AttachPointInfo ¶
AttachPointInfo describes what we need to know about an attach point
type AttachResult ¶
type AttachResult interface {
ProgID() int
}
type AttachedProgInfo ¶
type AttachedProgInfo struct { Object string `json:"object"` Hash string `json:"hash"` ID int `json:"id"` Config string `json:"config"` }
AttachedProgInfo describes what we store about an attached program.
type BPFDataplane ¶
type BPFDataplane interface { DumpCIDRMap(ifName string, family IPFamily) (map[CIDRMapKey]uint32, error) DumpFailsafeMap() ([]ProtoPort, error) GetCIDRMapID(ifName string, family IPFamily) (int, error) GetFailsafeMapID() (int, error) GetMapsFromXDP(ifName string) ([]int, error) GetXDPID(ifName string) (int, error) GetXDPMode(ifName string) (XDPMode, error) GetXDPIfaces() ([]string, error) GetXDPObjTag(objPath string) (string, error) GetXDPObjTagAuto() (string, error) GetXDPTag(ifName string) (string, error) IsValidMap(ifName string, family IPFamily) (bool, error) ListCIDRMaps(family IPFamily) ([]string, error) LoadXDP(objPath, ifName string, mode XDPMode) error LoadXDPAuto(ifName string, mode XDPMode) error LookupCIDRMap(ifName string, family IPFamily, ip net.IP, mask int) (uint32, error) LookupFailsafeMap(proto uint8, port uint16) (bool, error) NewCIDRMap(ifName string, family IPFamily) (string, error) NewFailsafeMap() (string, error) RemoveCIDRMap(ifName string, family IPFamily) error RemoveFailsafeMap() error RemoveItemCIDRMap(ifName string, family IPFamily, ip net.IP, mask int) error RemoveItemFailsafeMap(proto uint8, port uint16) error RemoveXDP(ifName string, mode XDPMode) error UpdateCIDRMap(ifName string, family IPFamily, ip net.IP, mask int, refCount uint32) error UpdateFailsafeMap(proto uint8, port uint16) error GetBPFCalicoDir() string AttachToSockmap() error DetachFromSockmap(mode FindObjectMode) error RemoveSockmap(mode FindObjectMode) error LoadSockops(objPath string) error LoadSockopsAuto() error RemoveSockops() error LoadSkMsg(objPath string) error LoadSkMsgAuto() error RemoveSkMsg() error AttachToCgroup() error DetachFromCgroup(mode FindObjectMode) error NewSockmapEndpointsMap() (string, error) NewSockmap() (string, error) UpdateSockmapEndpoints(ip net.IP, mask int) error DumpSockmapEndpointsMap(family IPFamily) ([]CIDRMapKey, error) LookupSockmapEndpointsMap(ip net.IP, mask int) (bool, error) RemoveItemSockmapEndpointsMap(ip net.IP, mask int) error RemoveSockmapEndpointsMap() error // contains filtered or unexported methods }
type BPFLib ¶
type BPFLib struct {
// contains filtered or unexported fields
}
func (*BPFLib) AttachToCgroup ¶
func (*BPFLib) AttachToSockmap ¶
func (*BPFLib) DetachFromCgroup ¶
func (b *BPFLib) DetachFromCgroup(mode FindObjectMode) error
func (*BPFLib) DetachFromSockmap ¶
func (b *BPFLib) DetachFromSockmap(mode FindObjectMode) error
func (*BPFLib) DumpCIDRMap ¶
func (*BPFLib) DumpFailsafeMap ¶
func (*BPFLib) DumpSockmapEndpointsMap ¶
func (b *BPFLib) DumpSockmapEndpointsMap(family IPFamily) ([]CIDRMapKey, error)
func (*BPFLib) GetBPFCalicoDir ¶
func (*BPFLib) GetCIDRMapID ¶
func (*BPFLib) GetFailsafeMapID ¶
func (*BPFLib) GetXDPIfaces ¶
func (*BPFLib) GetXDPObjTagAuto ¶
func (*BPFLib) IsValidMap ¶
func (*BPFLib) LoadSkMsgAuto ¶
func (*BPFLib) LoadSockops ¶
func (*BPFLib) LoadSockopsAuto ¶
func (*BPFLib) LookupCIDRMap ¶
func (*BPFLib) LookupFailsafeMap ¶
func (*BPFLib) LookupSockmapEndpointsMap ¶
func (*BPFLib) NewCIDRMap ¶
func (*BPFLib) NewFailsafeMap ¶
func (*BPFLib) NewSockmap ¶
func (*BPFLib) NewSockmapEndpointsMap ¶
func (*BPFLib) RemoveFailsafeMap ¶
func (*BPFLib) RemoveItemCIDRMap ¶
func (*BPFLib) RemoveItemFailsafeMap ¶
func (*BPFLib) RemoveItemSockmapEndpointsMap ¶
func (*BPFLib) RemoveSkMsg ¶
func (*BPFLib) RemoveSockmap ¶
func (b *BPFLib) RemoveSockmap(mode FindObjectMode) error
func (*BPFLib) RemoveSockmapEndpointsMap ¶
func (*BPFLib) RemoveSockops ¶
func (*BPFLib) UpdateCIDRMap ¶
func (*BPFLib) UpdateFailsafeMap ¶
type BPFProgType ¶
type BPFProgType string
BPFProgType is usually a string, but if the type is not known to bpftool, it would be represented by an int. We do not care about those, but we must not fail on parsing them.
func (*BPFProgType) UnmarshalJSON ¶
func (t *BPFProgType) UnmarshalJSON(data []byte) error
type Binary ¶
type Binary struct {
// contains filtered or unexported fields
}
Binary is an in memory representation of a BPF binary
func BinaryFromFile ¶
BinaryFromFile reads a binary from a file
func (*Binary) PatchSkbMark ¶
PatchSkbMark replaces SKBM with the expected mark - for tests.
func (*Binary) ReplaceAll ¶
ReplaceAll replaces all non-overlapping instance of orig with replacements.
func (*Binary) WriteToFile ¶
WriteToFile writes the binary to a file
type CIDRMapInfo ¶
type CIDRMapInfo struct { CommonMapInfo Family IPFamily }
type CIDRMapKey ¶
type CIDRMapKey struct {
// contains filtered or unexported fields
}
func NewCIDRMapKey ¶
func NewCIDRMapKey(n *net.IPNet) CIDRMapKey
func (*CIDRMapKey) ToIPNet ¶
func (k *CIDRMapKey) ToIPNet() *net.IPNet
type CIDRMapsKey ¶
type EPAttachInfo ¶
EPAttachInfo tells what programs are attached to an endpoint.
type FailsafeMap ¶
type FailsafeMap struct { Info FailsafeMapInfo M map[ProtoPort]struct{} // (protocol, port) set }
func NewMockFailsafeMap ¶
func NewMockFailsafeMap(mapID int) FailsafeMap
type FailsafeMapInfo ¶
type FailsafeMapInfo struct {
CommonMapInfo
}
type FindObjectMode ¶
type FindObjectMode uint32
const ( FindInBPFFSOnly FindObjectMode = 1 << iota FindByID )
type MockBPFLib ¶
type MockBPFLib struct { XDPProgs map[string]XDPInfo // iface -> []maps CIDRMaps map[CIDRMapsKey]CIDRMap // iface -> map[ip]refCount SockopsProg *SockopsInfo SockMap *SockMap SkMsgProg *SkMsgInfo SockmapEndpointsMap *CIDRMap FailsafeMap FailsafeMap CgroupV2Dir string // contains filtered or unexported fields }
func NewMockBPFLib ¶
func NewMockBPFLib(binDir string) *MockBPFLib
func (*MockBPFLib) AttachToCgroup ¶
func (b *MockBPFLib) AttachToCgroup() error
func (*MockBPFLib) AttachToSockmap ¶
func (b *MockBPFLib) AttachToSockmap() error
func (*MockBPFLib) DetachFromCgroup ¶
func (b *MockBPFLib) DetachFromCgroup(mode FindObjectMode) error
func (*MockBPFLib) DetachFromSockmap ¶
func (b *MockBPFLib) DetachFromSockmap(mode FindObjectMode) error
func (*MockBPFLib) DumpCIDRMap ¶
func (b *MockBPFLib) DumpCIDRMap(ifName string, family IPFamily) (map[CIDRMapKey]uint32, error)
func (*MockBPFLib) DumpFailsafeMap ¶
func (b *MockBPFLib) DumpFailsafeMap() ([]ProtoPort, error)
func (*MockBPFLib) DumpSockmapEndpointsMap ¶
func (b *MockBPFLib) DumpSockmapEndpointsMap(family IPFamily) ([]CIDRMapKey, error)
func (*MockBPFLib) GetBPFCalicoDir ¶
func (b *MockBPFLib) GetBPFCalicoDir() string
func (*MockBPFLib) GetCIDRMapID ¶
func (b *MockBPFLib) GetCIDRMapID(ifName string, family IPFamily) (int, error)
func (*MockBPFLib) GetFailsafeMapID ¶
func (b *MockBPFLib) GetFailsafeMapID() (int, error)
func (*MockBPFLib) GetMapsFromXDP ¶
func (b *MockBPFLib) GetMapsFromXDP(ifName string) ([]int, error)
func (*MockBPFLib) GetXDPIfaces ¶
func (b *MockBPFLib) GetXDPIfaces() ([]string, error)
func (*MockBPFLib) GetXDPMode ¶
func (b *MockBPFLib) GetXDPMode(ifName string) (XDPMode, error)
func (*MockBPFLib) GetXDPObjTag ¶
func (b *MockBPFLib) GetXDPObjTag(objPath string) (tag string, err error)
func (*MockBPFLib) GetXDPObjTagAuto ¶
func (b *MockBPFLib) GetXDPObjTagAuto() (string, error)
func (*MockBPFLib) IsValidMap ¶
func (b *MockBPFLib) IsValidMap(ifName string, family IPFamily) (bool, error)
func (*MockBPFLib) ListCIDRMaps ¶
func (b *MockBPFLib) ListCIDRMaps(family IPFamily) ([]string, error)
func (*MockBPFLib) LoadSkMsg ¶
func (b *MockBPFLib) LoadSkMsg(objPath string) error
func (*MockBPFLib) LoadSkMsgAuto ¶
func (b *MockBPFLib) LoadSkMsgAuto() error
func (*MockBPFLib) LoadSockops ¶
func (b *MockBPFLib) LoadSockops(objPath string) error
func (*MockBPFLib) LoadSockopsAuto ¶
func (b *MockBPFLib) LoadSockopsAuto() error
func (*MockBPFLib) LoadXDP ¶
func (b *MockBPFLib) LoadXDP(objPath, ifName string, mode XDPMode) error
func (*MockBPFLib) LoadXDPAuto ¶
func (b *MockBPFLib) LoadXDPAuto(ifName string, mode XDPMode) error
func (*MockBPFLib) LookupCIDRMap ¶
func (*MockBPFLib) LookupFailsafeMap ¶
func (b *MockBPFLib) LookupFailsafeMap(proto uint8, port uint16) (bool, error)
func (*MockBPFLib) LookupSockmapEndpointsMap ¶
func (*MockBPFLib) NewCIDRMap ¶
func (b *MockBPFLib) NewCIDRMap(ifName string, family IPFamily) (string, error)
func (*MockBPFLib) NewFailsafeMap ¶
func (b *MockBPFLib) NewFailsafeMap() (string, error)
func (*MockBPFLib) NewSockmap ¶
func (b *MockBPFLib) NewSockmap() (string, error)
func (*MockBPFLib) NewSockmapEndpointsMap ¶
func (b *MockBPFLib) NewSockmapEndpointsMap() (string, error)
func (*MockBPFLib) RemoveCIDRMap ¶
func (b *MockBPFLib) RemoveCIDRMap(ifName string, family IPFamily) error
func (*MockBPFLib) RemoveFailsafeMap ¶
func (b *MockBPFLib) RemoveFailsafeMap() error
func (*MockBPFLib) RemoveItemCIDRMap ¶
func (*MockBPFLib) RemoveItemFailsafeMap ¶
func (b *MockBPFLib) RemoveItemFailsafeMap(proto uint8, port uint16) error
func (*MockBPFLib) RemoveItemSockmapEndpointsMap ¶
func (b *MockBPFLib) RemoveItemSockmapEndpointsMap(ip net.IP, mask int) error
func (*MockBPFLib) RemoveSkMsg ¶
func (b *MockBPFLib) RemoveSkMsg() error
func (*MockBPFLib) RemoveSockmap ¶
func (b *MockBPFLib) RemoveSockmap(mode FindObjectMode) error
func (*MockBPFLib) RemoveSockmapEndpointsMap ¶
func (b *MockBPFLib) RemoveSockmapEndpointsMap() error
func (*MockBPFLib) RemoveSockops ¶
func (b *MockBPFLib) RemoveSockops() error
func (*MockBPFLib) UpdateCIDRMap ¶
func (*MockBPFLib) UpdateFailsafeMap ¶
func (b *MockBPFLib) UpdateFailsafeMap(proto uint8, port uint16) error
func (*MockBPFLib) UpdateSockmapEndpoints ¶
func (b *MockBPFLib) UpdateSockmapEndpoints(ip net.IP, mask int) error
type PolicyDebugInfo ¶
type PolicyDebugInfo struct { IfaceName string `json:"ifacename"` Hook string `json:"hook"` PolicyInfo asm.Insns `json:"policyInfo"` Error string `json:"error"` }
PolicyDebugInfo describes policy debug info
type ProgInfo ¶
type ProgInfo struct { Name string `json:"name"` Id int `json:"id"` Type BPFProgType `json:"type"` Tag string `json:"tag"` MapIds []int `json:"map_ids"` Err string `json:"error"` }
func GetAllProgs ¶
func GetProgByID ¶
type ProgResult ¶
func RunBPFProgram ¶
func RunBPFProgram(fd ProgFD, dataIn []byte, repeat int) (pr ProgResult, err error)
type ProtoPort ¶
type ProtoPort struct { Proto labelindex.IPSetPortProtocol Port uint16 }
type SockMapInfo ¶
type SockMapInfo struct { CommonMapInfo SkMsg *SkMsgInfo }
type SockopsInfo ¶
type SockopsInfo struct {
CgroupPath string
}
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package asm contains a basic eBPF bytecode assembler.
|
Package asm contains a basic eBPF bytecode assembler. |