Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/cloudflare/xdpcap
/ functions
Functions
93 in github.com/cloudflare/xdpcap
⨍
Functions
93
◇
Types & classes
19
↓ 19 callers
Function
checkOffsets
(tb testing.TB, filter []bpf.Instruction, offsets []uint32, expected bool, packet ...gopacket.SerializableLaye
cmd/bpfoff/main_test.go:213
↓ 17 callers
Function
parseFlags
parseFlags creates the flags, and attempts to parse args. On error, the returned flags is fully setup, but will not hold values for all the arguments.
cmd/xdpcap/flags.go:188
↓ 16 callers
Method
Close
Close releases any resources held It does not Rm()
hook.go:39
↓ 10 callers
Function
defaultFlags
(mapPath string)
cmd/xdpcap/flags_test.go:254
↓ 10 callers
Function
requireFlags
(tb testing.TB, output string, expected, actual flags)
cmd/xdpcap/flags_test.go:270
↓ 9 callers
Method
close
()
cmd/xdpcap/filter.go:152
↓ 8 callers
Function
tempOutput
(t *testing.T)
cmd/xdpcap/flags_test.go:240
↓ 8 callers
Function
withOffsets
withOffsets generates a new filter from filter, using a fixed set of offsets into the packet
cmd/bpfoff/main.go:107
↓ 7 callers
Function
testOpts
(filter ...bpf.Instruction)
cmd/xdpcap/filter_test.go:16
↓ 6 callers
Method
String
()
cmd/xdpcap/flags.go:37
↓ 5 callers
Function
addOffsets
(offsets []uint32, expr string)
cmd/bpfoff/main.go:92
↓ 5 callers
Function
newFilterWithMap
newFilterWithMap creates a filter from a tcpdump / libpcap filter expression
cmd/xdpcap/filter.go:57
↓ 5 callers
Function
parseAction
(action string)
cmd/xdpcap/xdpaction.go:47
↓ 4 callers
Method
Usage
()
cmd/xdpcap/flags.go:241
↓ 4 callers
Function
checkActions
checkActions checks that all programs return their expected action, and the packet isn't modified Packet is 0 padded to min ethernet length actions sh
cmd/xdpcap/filter_test.go:233
↓ 4 callers
Method
metrics
()
cmd/xdpcap/filter.go:205
↓ 4 callers
Function
mustNew
(t *testing.T, opts filterOpts)
cmd/xdpcap/filter_test.go:298
↓ 3 callers
Function
CheckHookMap
CheckHookMap checks the given map against HookMapABI to have appropriate values Only checks Type, KeySize, ValueSize
internal/abi.go:18
↓ 3 callers
Function
TcpdumpExprToBPF
tcpdumpExprToBPF converts a tcpdump / libpcap filter expression to cBPF using libpcap
internal/tcpdump.go:12
↓ 3 callers
Function
addOffset
addOffset adds an offset, checking for overflow
cmd/bpfoff/main.go:191
↓ 3 callers
Function
hookMap
(t *testing.T, entries int)
cmd/xdpcap/filter_test.go:284
↓ 3 callers
Function
matchByte
(offset, val uint32)
cmd/xdpcap/filter_test.go:24
↓ 3 callers
Function
parsecBPF
parsecBPF parses a string of cBPF 4 tuple instructions, formatted as: <length>,<opcode> <jt> <jf> <k>,...
cmd/xdpcap/flags.go:103
↓ 3 callers
Method
read
Returns errFilterClosed if the filter has been closed
cmd/xdpcap/filter.go:170
↓ 2 callers
Function
NewHook
NewHook creates a new Hook, that can be Pin()'d to fileName. fileName must be inside a bpffs
hook.go:22
↓ 2 callers
Function
attachProg
no good way to check if a program is already attached, as Create() doesn't work on prog array maps We could check if values are present for keys, but
cmd/xdpcap/filter.go:143
↓ 2 callers
Function
checkAction
(t *testing.T, action xdpAction, filter *filter, in []byte)
cmd/xdpcap/filter_test.go:246
↓ 2 callers
Function
linkTypes
All valid LinkTypes
cmd/xdpcap/flags.go:74
↓ 2 callers
Function
mustPatchSpec
(tb testing.TB, hook *Hook)
hook_test.go:78
↓ 2 callers
Function
newProgram
newProgram builds an eBPF program that copies packets matching a cBPF program to userspace via perf
cmd/xdpcap/program.go:46
↓ 2 callers
Function
unlimitLockedMemory
unlimitLockedMemory removes any locked memory limits
cmd/xdpcap/memory.go:9
↓ 1 callers
Method
Patch
Patch edits all programs in the spec that refer to hookMapSymbol to use this hook. This function is a no-op if called on a nil Hook.
hook.go:58
↓ 1 callers
Method
Rm
Rm deletes files created by Pin()
hook.go:51
↓ 1 callers
Method
String
()
cmd/xdpcap/xdpaction.go:30
↓ 1 callers
Function
allActions
allActions returns every action exposed by the map
cmd/xdpcap/filter.go:131
↓ 1 callers
Function
capture
(flags flags)
cmd/xdpcap/main.go:56
↓ 1 callers
Function
isBigEndian
()
cmd/xdpcap/endian.go:18
↓ 1 callers
Function
newFilter
newFilter creates a filter from a tcpdump / libpcap filter expression
cmd/xdpcap/filter.go:47
↓ 1 callers
Function
newPcapWriter
newPcapWriter creates a pcapWriter with an pcap interface (metadata) per xdp action
cmd/xdpcap/main.go:145
↓ 1 callers
Function
parseFilter
(expr string, linkType layers.LinkType)
cmd/xdpcap/flags.go:90
↓ 1 callers
Function
parseInstruction
parseInstruction parses a cBPF instruction, formatted as: <opcode> <jt> <jf> <k>
cmd/xdpcap/flags.go:134
↓ 1 callers
Function
parseOffsets
(offsets string)
cmd/bpfoff/main.go:60
↓ 1 callers
Function
pcapInsnToX
(insns []pcap.BPFInstruction)
internal/tcpdump.go:22
↓ 1 callers
Function
printFilter
printFilter prints a filter in the standard / linux form to stdout
cmd/bpfoff/main.go:76
↓ 1 callers
Function
withOffset
withOffset rewrites filter to use a fixed offset into the packet new filter will return on match, fall through on no match
cmd/bpfoff/main.go:132
↓ 1 callers
Function
xdpcap_exit
* Return action, exposing the action and input packet to xdpcap hook. * * return xdpcap_exit(ctx, &hook, XDP_PASS) * * is equivalent to: * *
hook.h:28
Method
Pin
Pin persists the underlying map to a file, overwriting it if it already exists
hook.go:44
Method
Set
(val string)
cmd/xdpcap/flags.go:21
Method
Set
(val string)
cmd/xdpcap/flags.go:48
Method
String
()
cmd/xdpcap/flags.go:69
Function
TestActionParsing
(t *testing.T)
cmd/xdpcap/xdpaction_test.go:7
Function
TestActionsFlagBad
(t *testing.T)
cmd/xdpcap/flags_test.go:194
Function
TestActionsFlagUnknown
(t *testing.T)
cmd/xdpcap/flags_test.go:155
Function
TestActionsFlagWhitespace
(t *testing.T)
cmd/xdpcap/flags_test.go:180
Function
TestAllActions
(t *testing.T)
cmd/xdpcap/filter_test.go:114
Function
TestCheckHookMap
Test CheckHookMap with valid and invalid HookMap ABI
internal/abi_test.go:10
Function
TestClose
(t *testing.T)
cmd/xdpcap/filter_test.go:216
Function
TestFilterLibpcap
(t *testing.T)
cmd/xdpcap/flags_test.go:64
Function
TestFilterProgramForAllModes
(t *testing.T)
cmd/xdpcap/filter_test.go:49
Function
TestFilterRaw
(t *testing.T)
cmd/xdpcap/flags_test.go:86
Function
TestFilterRawInvalid
(t *testing.T)
cmd/xdpcap/flags_test.go:124
Function
TestHookLoadAndReplace
Test loading an elf with a hook map using ebpf.CollectionSpec.LoadAndReplace(), which didn't always work: https://github.com/cilium/ebpf/commit/04b5c2
hook_test.go:33
Function
TestHookNewCollection
Test loading an elf with a hook map using ebpf.NewCollection().
hook_test.go:15
Function
TestLinkTypeUnknown
(t *testing.T)
cmd/xdpcap/flags_test.go:203
Function
TestLoadAbsolute
(t *testing.T)
cmd/bpfoff/main_test.go:148
Function
TestLoadIndirect
(t *testing.T)
cmd/bpfoff/main_test.go:168
Function
TestLoadMemShift
(t *testing.T)
cmd/bpfoff/main_test.go:191
Function
TestMain
(m *testing.M)
cmd/xdpcap/filter_test.go:33
Function
TestMetrics
(t *testing.T)
cmd/xdpcap/filter_test.go:139
Function
TestMissingFilter
(t *testing.T)
cmd/xdpcap/filter_test.go:42
Function
TestNegativeAction
(t *testing.T)
cmd/xdpcap/xdpaction_test.go:21
Function
TestNoHook
Test loading an elf that uses a hook without an explicit hook map
hook_test.go:65
Function
TestOffsetOrder
(t *testing.T)
cmd/bpfoff/main_test.go:51
Function
TestOffsetOverflow
(t *testing.T)
cmd/bpfoff/main_test.go:79
Function
TestOffsets
(t *testing.T)
cmd/bpfoff/main_test.go:13
Function
TestOptions
(t *testing.T)
cmd/xdpcap/flags_test.go:136
Function
TestOutputInvalid
(t *testing.T)
cmd/xdpcap/flags_test.go:38
Function
TestOutputStdout
(t *testing.T)
cmd/xdpcap/flags_test.go:45
Function
TestPerf
(t *testing.T)
cmd/xdpcap/filter_test.go:187
Function
TestRequiredArgs
(t *testing.T)
cmd/xdpcap/flags_test.go:17
Function
TestRetA
(t *testing.T)
cmd/bpfoff/main_test.go:132
Function
TestRetConstant
(t *testing.T)
cmd/bpfoff/main_test.go:114
Function
TestUnknownAction
(t *testing.T)
cmd/xdpcap/filter_test.go:100
Function
TestUnknownActionParsing
(t *testing.T)
cmd/xdpcap/xdpaction_test.go:28
Function
TestUnsupportedInsn
(t *testing.T)
cmd/bpfoff/main_test.go:95
Function
TestUsage
(t *testing.T)
cmd/xdpcap/flags_test.go:228
Method
close
()
cmd/xdpcap/program.go:186
Function
init
()
cmd/xdpcap/endian.go:10
Function
main
()
cmd/bpfoff/main.go:21
Function
main
()
cmd/xdpcap/main.go:36
Method
metrics
()
cmd/xdpcap/program.go:191
Function
xdp_hook
testdata/xdp_hook.c:28
Function
xdp_nohook
testdata/xdp_hook.c:35