Skip to content

Commit

Permalink
sk skb ongoing
Browse files Browse the repository at this point in the history
  • Loading branch information
vitkyrka committed Jun 21, 2024
1 parent f1cd7d9 commit 7e5ac31
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
6 changes: 5 additions & 1 deletion probe.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ type Probe struct {
bypassIndex uint32
bypassMap *Map

SockMap *ebpf.Map

// lastError - stores the last error that the probe encountered, it is used to surface a more useful error message
// when one of the validators (see Options.ActivatedProbes) fails.
lastError error
Expand Down Expand Up @@ -546,7 +548,7 @@ func (p *Probe) attach() error {
err = p.attachTracepoint()
case ebpf.RawTracepoint, ebpf.RawTracepointWritable:
err = p.attachRawTracepoint()
case ebpf.CGroupDevice, ebpf.CGroupSKB, ebpf.CGroupSock, ebpf.CGroupSockAddr, ebpf.CGroupSockopt, ebpf.CGroupSysctl:
case ebpf.CGroupDevice, ebpf.CGroupSKB, ebpf.CGroupSock, ebpf.CGroupSockAddr, ebpf.CGroupSockopt, ebpf.CGroupSysctl, ebpf.SockOps:
err = p.attachCGroup()
case ebpf.SocketFilter:
err = p.attachSocket()
Expand All @@ -560,6 +562,8 @@ func (p *Probe) attach() error {
err = p.attachPerfEvent()
case ebpf.Tracing:
err = p.attachTracing()
case ebpf.SkSKB, ebpf.SkMsg:
err = p.attachSkSKB()
default:
err = fmt.Errorf("program type %s not implemented yet", p.programSpec.Type)
}
Expand Down
8 changes: 8 additions & 0 deletions tracing.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,11 @@ func (p *Probe) attachTracing() error {
}
return nil
}

func (p *Probe) attachSkSKB() error {
return link.RawAttachProgram(link.RawAttachProgramOptions{
Target: p.SockMap.FD(),
Program: p.program,
Attach: p.programSpec.AttachType,
})
}

0 comments on commit 7e5ac31

Please sign in to comment.