From 937d067f8bd8237032347ed2ec442f35f4835cd1 Mon Sep 17 00:00:00 2001 From: Tomas Hruby Date: Thu, 19 Dec 2024 15:02:52 -0800 Subject: [PATCH] [BPF] clean up the right progs when ebpf is disabled --- felix/bpf/nat/connecttime.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/felix/bpf/nat/connecttime.go b/felix/bpf/nat/connecttime.go index eafbf8efe36..5426e4eb39f 100644 --- a/felix/bpf/nat/connecttime.go +++ b/felix/bpf/nat/connecttime.go @@ -47,6 +47,8 @@ const ( ProgIndexCTLBConnectV6 = iota ProgIndexCTLBSendV6 ProgIndexCTLBRecvV6 + + ProgNamePrefix = "calico_" ) var ctlbProgToIndex = map[string]int{ @@ -96,7 +98,7 @@ func RemoveConnectTimeLoadBalancer(cgroupv2 string) error { } for _, p := range progs { - if !strings.HasPrefix(p.Name, "cali_") { + if !strings.HasPrefix(p.Name, ProgNamePrefix) { continue } @@ -164,7 +166,7 @@ func attachProgram(name, ipver, bpfMount, cgroupPath string, udpNotSeen time.Dur progPinDir := path.Join(bpfMount, "calico_connect4") _ = os.RemoveAll(progPinDir) - progName := "calico_" + name + "_v" + ipver + progName := ProgNamePrefix + name + "_v" + ipver // N.B. no need to remember the link since we are never going to detach // these programs unless Felix restarts.