Documentation
¶
Index ¶
- Constants
- Variables
- func BPFFileName(id uint8) string
- func DecodeDropNotify(data []byte, dn *DropNotify) error
- func DecodeTraceNotify(data []byte, tn *TraceNotify) error
- func DropReason(reason uint8) string
- func DropReasonExt(reason uint8, extError uint32) string
- func GetLostEventsCount() (uint64, error)
- func MetricDirection(dir uint8) string
- func New(cfg *kcfg.Config) registry.Plugin
- type DatapathContext
- type DecodedPacket
- type DropNotify
- type EndpointResolver
- type EventsMap
- type IterateCallback
- type MetricsKey
- type MetricsMap
- type MetricsValue
- type Parser
- type Plugin
- type TraceNotify
- func (tn *TraceNotify) DataOffset() uint
- func (tn *TraceNotify) IsEncrypted() bool
- func (tn *TraceNotify) IsIPv6() bool
- func (tn *TraceNotify) IsL3Device() bool
- func (tn *TraceNotify) OriginalIP() net.IP
- func (tn *TraceNotify) TraceReason() uint8
- func (tn *TraceNotify) TraceReasonIsDecap() bool
- func (tn *TraceNotify) TraceReasonIsEncap() bool
- func (tn *TraceNotify) TraceReasonIsKnown() bool
- func (tn *TraceNotify) TraceReasonIsReply() bool
Constants ¶
const ( DropNotifyVersion0 = iota DropNotifyVersion1 DropNotifyVersion2 )
const ( // TraceNotifyFlagIsIPv6 is set in TraceNotify.Flags when the // notification refers to an IPv6 flow TraceNotifyFlagIsIPv6 uint8 = 1 << iota // TraceNotifyFlagIsL3Device is set in TraceNotify.Flags when the // notification refers to a L3 device. TraceNotifyFlagIsL3Device )
const ( TraceNotifyVersion0 = iota TraceNotifyVersion1 )
const ( TraceReasonPolicy = iota TraceReasonCtEstablished TraceReasonCtReply TraceReasonCtRelated TraceReasonCtDeprecatedReopened TraceReasonUnknown TraceReasonSRv6Encap TraceReasonSRv6Decap TraceReasonEncryptOverlay // TraceReasonEncryptMask is the bit used to indicate encryption or not. TraceReasonEncryptMask = uint8(0x80) )
Reasons for forwarding a packet, keep in sync with api/v1/flow/flow.proto
const MaxInt = int(^uint(0) >> 1)
Variables ¶
var DropInvalid uint8 = 2
DropInvalid is the Invalid packet reason.
var DropMin uint8 = 130
DropMin numbers less than this are non-drop reason codes
var DropPacketMonitor uint8 = 220
Packet Monitor drop reason
Functions ¶
func BPFFileName ¶
BPFFileName returns the file name for the given BPF file id.
func DecodeDropNotify ¶
func DecodeDropNotify(data []byte, dn *DropNotify) error
DecodeDropNotify will decode 'data' into the provided DropNotify structure
func DecodeTraceNotify ¶
func DecodeTraceNotify(data []byte, tn *TraceNotify) error
DecodeTraceNotify will decode 'data' into the provided TraceNotify structure
func DropReason ¶
DropReason prints the drop reason in a human readable string
func DropReasonExt ¶
func GetLostEventsCount ¶
func MetricDirection ¶
MetricDirection gets the direction in human readable string format
Types ¶
type DatapathContext ¶
type DecodedPacket ¶
type DropNotify ¶
type DropNotify struct {
Type uint8
SubType uint8
Source uint16
Hash uint32
OrigLen uint32
CapLen uint16
Version uint16
SrcLabel identity.NumericIdentity
DstLabel identity.NumericIdentity
DstID uint32
Line uint16
File uint8
ExtError int8
Ifindex uint32
}
DropNotify is the message format of a drop notification in the BPF ring buffer
func (*DropNotify) DataOffset ¶
func (n *DropNotify) DataOffset() uint
DataOffset returns the offset from the beginning of DropNotify where the notification data begins.
Returns zero for invalid or unknown DropNotify messages.
func (*DropNotify) IsIPv6 ¶
func (n *DropNotify) IsIPv6() bool
IsIPv6 returns true if the trace refers to an IPv6 packet.
func (*DropNotify) IsL3Device ¶
func (n *DropNotify) IsL3Device() bool
IsL3Device returns true if the trace comes from an L3 device.
type EndpointResolver ¶
type EndpointResolver struct {
// contains filtered or unexported fields
}
func NewEndpointResolver ¶
func NewEndpointResolver( log *slog.Logger, ) *EndpointResolver
func (*EndpointResolver) ResolveEndpoint ¶
func (r *EndpointResolver) ResolveEndpoint(_ netip.Addr, datapathSecurityIdentity uint32, _ DatapathContext) *pb.Endpoint
type EventsMap ¶
type EventsMap interface {
RegisterForCallback(*log.ZapLogger, eventsMapCallback) error
UnregisterForCallback() error
}
EventsMap interface represents a events map
type IterateCallback ¶
type IterateCallback func(*MetricsKey, *MetricsValue)
IterateCallback represents the signature of the callback function expected by the IterateWithCallback method, which in turn is used to iterate all the keys/values of a metrics map.
type MetricsKey ¶
func (*MetricsKey) DirectionString ¶
func (k *MetricsKey) DirectionString() string
DirectionString gets the direction in human readable string format
func (*MetricsKey) DropForwardReason ¶
func (k *MetricsKey) DropForwardReason() string
DropForwardReason gets the forwarded/dropped reason in human readable string format
func (*MetricsKey) DropPacketMonitorReason ¶
func (k *MetricsKey) DropPacketMonitorReason() string
DropPacketMonitorReason gets the Packer Monitor dropped reason in human readable string format
func (*MetricsKey) IsDrop ¶
func (k *MetricsKey) IsDrop() bool
IsDrop checks if the reason is drop or not.
func (*MetricsKey) IsEgress ¶
func (k *MetricsKey) IsEgress() bool
IsEgress checks if the direction is egress or not.
func (*MetricsKey) IsIngress ¶
func (k *MetricsKey) IsIngress() bool
IsIngress checks if the direction is ingress or not.
func (*MetricsKey) String ¶
func (k *MetricsKey) String() string
String returns the key in human readable string format
type MetricsMap ¶
type MetricsMap interface {
IterateWithCallback(*log.ZapLogger, IterateCallback) error
}
MetricsMap interface represents a metrics map, and can be reused to implement mock maps for unit tests.
type MetricsValue ¶
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser is a parser for L3/L4 payloads
func (*Parser) Decode ¶
func (p *Parser) Decode(monitorEvent *observerTypes.MonitorEvent) (*v1.Event, error)
Decode decodes a cilium monitor 'payload' and returns a v1.Event with the Event field populated.
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin is the ebpfwindows plugin
func (*Plugin) SetupChannel ¶
SetupChannel saves the external channel to which the plugin will send events.
type TraceNotify ¶
type TraceNotify struct {
Type uint8
ObsPoint uint8
Source uint16
Hash uint32
OrigLen uint32
CapLen uint16
Version uint16
SrcLabel identity.NumericIdentity
DstLabel identity.NumericIdentity
DstID uint16
Reason uint8
Flags uint8
Ifindex uint32
OrigIP types.IPv6
}
TraceNotify is the message format of a trace notification in the BPF ring buffer
func (*TraceNotify) DataOffset ¶
func (tn *TraceNotify) DataOffset() uint
DataOffset returns the offset from the beginning of TraceNotify where the trace notify data begins.
Returns zero for invalid or unknown TraceNotify messages.
func (*TraceNotify) IsEncrypted ¶
func (tn *TraceNotify) IsEncrypted() bool
IsEncrypted returns true when the notification has the encrypt flag set, false otherwise.
func (*TraceNotify) IsIPv6 ¶
func (tn *TraceNotify) IsIPv6() bool
IsIPv6 returns true if the trace refers to an IPv6 packet.
func (*TraceNotify) IsL3Device ¶
func (tn *TraceNotify) IsL3Device() bool
IsL3Device returns true if the trace comes from an L3 device.
func (*TraceNotify) OriginalIP ¶
func (tn *TraceNotify) OriginalIP() net.IP
OriginalIP returns the original source IP if reverse NAT was performed on the flow
func (*TraceNotify) TraceReason ¶
func (tn *TraceNotify) TraceReason() uint8
TraceReason returns the trace reason for this notification, see the TraceReason* constants.
func (*TraceNotify) TraceReasonIsDecap ¶
func (tn *TraceNotify) TraceReasonIsDecap() bool
TraceReasonIsDecap returns true when the trace reason is decapsulation related, false otherwise.
func (*TraceNotify) TraceReasonIsEncap ¶
func (tn *TraceNotify) TraceReasonIsEncap() bool
TraceReasonIsEncap returns true when the trace reason is encapsulation related, false otherwise.
func (*TraceNotify) TraceReasonIsKnown ¶
func (tn *TraceNotify) TraceReasonIsKnown() bool
TraceReasonIsKnown returns false when the trace reason is unknown, true otherwise.
func (*TraceNotify) TraceReasonIsReply ¶
func (tn *TraceNotify) TraceReasonIsReply() bool
TraceReasonIsReply returns true when the trace reason is TraceReasonCtReply, false otherwise.