ovstrace

package
v0.0.0-...-1e2d87c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 5, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IPPROTO_TCP = 6
	IPPROTO_UDP = 17
)
View Source
const (
	TCPHDR_FIN = 0x01
	TCPHDR_SYN = 0x02
	TCPHDR_RST = 0x04
	TCPHDR_PSH = 0x08
	TCPHDR_ACK = 0x10
	TCPHDR_URG = 0x20
	TCPHDR_ECE = 0x40
	TCPHDR_CWR = 0x80
)
View Source
const DevNameMaxSize = 64

Variables

This section is empty.

Functions

func HandleEvent

func HandleEvent(event *Event) error

Types

type ActionType

type ActionType uint8
const (
	Unspec ActionType = iota
	Output
	Userspace
	Set
	PushVlan
	PopVlan
	Sample
	Recirc
	Hash
	PushMpls
	PopMpls
	SetMasked
	Ct
	Trunc
	PushEth
	PopEth
	CtClear
	PushNsh
	PopNsh
	Meter
	Clone
	CheckPktLen
	AddMpls
	DecTTL
	Max
	SetToMasked
)

func (ActionType) String

func (a ActionType) String() string

type Ethhdr

type Ethhdr struct {
	Dest   [6]byte
	Source [6]byte
	Proto  [2]byte
}

type Event

type Event struct {
	Timestamp uint64     `json:"timestamp"`
	Type      EventType  `json:"type"`
	SubAction ActionType `json:"subaction,omitempty"`
	DevName   string     `json:"devname,omitempty"`
	Hash      uint32     `json:"hash,omitempty"`
	TCP       *TCPInfo   `json:"tcp,omitempty"`
	UDP       *UDPInfo   `json:"udp,omitempty"`
	Protocol  uint8      `json:"protocol,omitempty"`
}

func EventFromBytes

func EventFromBytes(buffer *bytes.Buffer) (*Event, error)

func (*Event) String

func (e *Event) String() string

type EventBytes

type EventBytes struct {
	Timestamp uint64
	Type      uint8
	SubAction uint8
	DevName   [DevNameMaxSize]byte
	Hash      uint32
	Sport     uint16
	Dport     uint16
	Seq       uint32
	AckSeq    uint32
	TCPFlags  uint8
	Protocol  uint8
	IPVersion uint8
}

Event from eBPF program.

type EventType

type EventType uint8
const (
	EventUpcall EventType = iota
	EventAction
)

type Filter

type Filter struct {
	//Mark     uint32
	Eth      Ethhdr
	EthMask  Ethhdr
	IPv4     IPv4hdr
	IPv4Mask IPv4hdr
	IPv6     IPv6hdr
	IPv6Mask IPv6hdr
	Tcp      Tcphdr
	TcpMask  Tcphdr
	Udp      Udphdr
	UdpMask  Udphdr
	DevName  [DevNameMaxSize]byte
}

func ParseFilter

func ParseFilter(expr string) (*Filter, error)

type IPv4hdr

type IPv4hdr struct {
	IhlVersion byte
	Tos        byte
	TotLen     [2]byte
	Id         [2]byte
	FragOff    [2]byte
	Ttl        byte
	Protocol   byte
	Check      [2]byte
	Saddr      [4]byte
	Daddr      [4]byte
}

type IPv6hdr

type IPv6hdr struct {
	PrioVersion byte
	FlowLbl     [3]byte
	PayloadLen  [2]byte
	NextHdr     byte
	HopLimit    byte
	Saddr       [16]byte
	Daddr       [16]byte
}

type TCPFlags

type TCPFlags uint8

func (TCPFlags) String

func (f TCPFlags) String() string

type TCPInfo

type TCPInfo struct {
	Sport  uint16   `json:"sport,omitempty"`
	Dport  uint16   `json:"dport,omitempty"`
	Seq    uint32   `json:"seq,omitempty"`
	AckSeq uint32   `json:"ack_seq,omitempty"`
	Flags  TCPFlags `json:"flags,omitempty"`
}

func (*TCPInfo) String

func (t *TCPInfo) String() string

type Tcphdr

type Tcphdr struct {
	Source [2]byte
	Dest   [2]byte
	Seq    [4]byte
	AckSeq [4]byte
	Flags  [2]byte
	Window [2]byte
	Check  [2]byte
	UrgPtr [2]byte
}

type UDPInfo

type UDPInfo struct {
	Sport uint16 `json:"sport,omitempty"`
	Dport uint16 `json:"dport,omitempty"`
}

func (*UDPInfo) String

func (u *UDPInfo) String() string

type Udphdr

type Udphdr struct {
	Source [2]byte
	Dest   [2]byte
	Len    [2]byte
	Check  [2]byte
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL