|
|
@@ -246,7 +246,7 @@ func (t *Tracer) ebpf(ch chan<- Event) error {
|
|
|
for _, spec := range collectionSpec.Maps {
|
|
|
fmt.Println("maps:", spec.Name) // maps: __protocol_filter|l7_request_heap
|
|
|
}
|
|
|
- tracer.MapInit(collectionSpec, opts) // TODO: 暂时忽略
|
|
|
+ tracer.MapInit(collectionSpec, opts) // TODO: 暂时忽略???
|
|
|
// TODO 多进程
|
|
|
tracer.SetConstants(collectionSpec) // TODO: 暂时忽略
|
|
|
c, err := ebpf.NewCollectionWithOptions(collectionSpec, *opts) // TODO: 后面t.collection = c....
|
|
|
@@ -257,7 +257,7 @@ func (t *Tracer) ebpf(ch chan<- Event) error {
|
|
|
}
|
|
|
return fmt.Errorf("failed to load collection: %w", err)
|
|
|
}
|
|
|
- tracer.Offset() // TODO: 作用是什么???????
|
|
|
+ tracer.Offset() // TODO: 暂时忽略???
|
|
|
|
|
|
t.collection = c
|
|
|
|
|
|
@@ -270,7 +270,7 @@ func (t *Tracer) ebpf(ch chan<- Event) error {
|
|
|
}
|
|
|
//fmt.Println(len(collectionSpec.Programs))
|
|
|
//fmt.Println(len(c.Programs))
|
|
|
- tracer.MapInsert(c)
|
|
|
+ tracer.MapInsert(c) // TODO: 暂时忽略???
|
|
|
if !t.disableL7Tracing {
|
|
|
perfMaps = append(perfMaps, perfMap{name: "l7_events", typ: perfMapTypeL7Events, perCPUBufferSizePages: 32})
|
|
|
}
|
|
|
@@ -308,14 +308,14 @@ func (t *Tracer) ebpf(ch chan<- Event) error {
|
|
|
var l link.Link // TODO: Link是什么?Link represents a Program attached to a BPF hook.
|
|
|
switch programSpec.Type {
|
|
|
case ebpf.TracePoint: // TODO: 默认将所有trace point和kprobe进行attach??? 是不是需要一个大的黑名单...
|
|
|
- fmt.Println("===========【tracepoint】: ", programSpec.Name, programSpec.SectionName, programSpec.Type)
|
|
|
+ // fmt.Println("===========【tracepoint】: ", programSpec.Name, programSpec.SectionName, programSpec.Type)
|
|
|
if strings.Contains(programSpec.SectionName, "prog") {
|
|
|
continue
|
|
|
}
|
|
|
parts := strings.SplitN(programSpec.AttachTo, "/", 2)
|
|
|
l, err = link.Tracepoint(parts[0], parts[1], program, nil) // TODO: attaches the given eBPF program to the tracepoint with the given group and name. example: tp, err := Tracepoint("syscalls", "sys_enter_fork", prog, nil)
|
|
|
case ebpf.Kprobe:
|
|
|
- fmt.Println("===========【kprobe】: ", programSpec.Name, programSpec.SectionName, programSpec.Type)
|
|
|
+ // fmt.Println("===========【kprobe】: ", programSpec.Name, programSpec.SectionName, programSpec.Type)
|
|
|
if strings.HasPrefix(programSpec.SectionName, "uprobe/") { // TODO: 直接过滤uprobe...
|
|
|
|
|
|
// fmt.Println("==============uprobe s")
|