From 393fa596f82157fe4707c955be911c0632b9fc56 Mon Sep 17 00:00:00 2001 From: mrproliu <741550557@qq.com> Date: Thu, 13 Jun 2024 04:54:04 +0000 Subject: [PATCH] Fixed `ip_list_rcv` probe is not exist in older linux kernel (#130) --- CHANGES.md | 1 + pkg/accesslog/collector/l24.go | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 13b3b37b..3c1fa836 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -11,6 +11,7 @@ Release Notes. #### Bug Fixes * Fixed the issue where `conntrack` could not find the Reply IP in the access log module. * Fix errors when compiling C source files into eBPF bytecode on a system with Linux headers version 6.2 or higher. +* Fixed `ip_list_rcv` probe is not exist in older linux kernel. #### Documentation diff --git a/pkg/accesslog/collector/l24.go b/pkg/accesslog/collector/l24.go index aaf4182f..ef0aeb57 100644 --- a/pkg/accesslog/collector/l24.go +++ b/pkg/accesslog/collector/l24.go @@ -45,13 +45,13 @@ func (c *L24Collector) startRead(_ *module.Manager, context *common.AccessLogCon context.BPF.AddTracePoint("net", "netif_receive_skb", context.BPF.TracepointNetifReceiveSkb) // l3 - context.BPF.AddLink(link.Kprobe, map[string]*ebpf.Program{"ip_list_rcv": context.BPF.IpListRcv}) - context.BPF.AddLink(link.Kretprobe, map[string]*ebpf.Program{"ip_list_rcv": context.BPF.IpListRcvRet}) context.BPF.AddLink(link.Kprobe, map[string]*ebpf.Program{"ip_rcv": context.BPF.IpRcv}) context.BPF.AddLink(link.Kretprobe, map[string]*ebpf.Program{"ip_rcv": context.BPF.IpRcvRet}) context.BPF.AddLink(link.Kprobe, map[string]*ebpf.Program{"ip_rcv_finish": context.BPF.IpRcvFinish}) context.BPF.AddLink(link.Kprobe, map[string]*ebpf.Program{"ip_local_deliver": context.BPF.IpLocalDeliver}) // it's not exist in old kernel versions + _ = context.BPF.AddLinkOrError(link.Kprobe, map[string]*ebpf.Program{"ip_list_rcv": context.BPF.IpListRcv}) + _ = context.BPF.AddLinkOrError(link.Kretprobe, map[string]*ebpf.Program{"ip_list_rcv": context.BPF.IpListRcvRet}) _ = context.BPF.AddLinkOrError(link.Kprobe, map[string]*ebpf.Program{"ip_sublist_rcv_finish": context.BPF.IpSublistRcvFinish}) _ = context.BPF.AddLinkOrError(link.Kprobe, map[string]*ebpf.Program{"ip_local_deliver_finish": context.BPF.IpLocalDeliverFinish})