Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-v3.27] Auto pick #8884: Cleanup bpfin/out.cali when BPF is turned off #8891

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions felix/dataplane/linux/bpf_ep_mgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -3387,3 +3387,19 @@ func (pa *jumpMapAlloc) checkFreeLockHeld(idx int) {
}).Panic("jumpMapAlloc: Free set and free stack got out of sync")
}
}

func removeBPFSpecialDevices() {
bpfin, err := netlink.LinkByName(bpfInDev)
if err != nil {
if errors.Is(err, netlink.LinkNotFoundError{}) {
return
}
log.WithError(err).Warnf("Failed to make sure that %s/%s device is (not) present.", bpfInDev, bpfOutDev)
return
}

err = netlink.LinkDel(bpfin)
if err != nil {
log.WithError(err).Warnf("Failed to remove %s/%s device.", bpfInDev, bpfOutDev)
}
}
1 change: 1 addition & 0 deletions felix/dataplane/linux/int_dataplane.go
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,7 @@ func NewIntDataplaneDriver(config Config) *InternalDataplane {
log.WithError(err).Info("Failed to remove BPF connect-time load balancer, ignoring.")
}
tc.CleanUpProgramsAndPins()
removeBPFSpecialDevices()
} else {
// In BPF mode we still use iptables for raw egress policy.
dp.RegisterManager(newRawEgressPolicyManager(rawTableV4, ruleRenderer, 4, ipSetsV4.SetFilter))
Expand Down
7 changes: 6 additions & 1 deletion felix/fv/bpf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1088,7 +1088,7 @@ func describeBPFTests(opts ...bpfTestOpt) bool {
It("should cleanup after we disable eBPF", func() {
By("Waiting for dp to get setup up")

ensureAllNodesBPFProgramsAttached(tc.Felixes)
ensureBPFProgramsAttached(tc.Felixes[0], "bpfout.cali")

By("Changing env and restarting felix")

Expand All @@ -1110,6 +1110,11 @@ func describeBPFTests(opts ...bpfTestOpt) bool {
out, _ := tc.Felixes[0].ExecOutput("bpftool", "-jp", "map", "show")
return out
}, "15s", "1s").ShouldNot(Or(ContainSubstring("cali_"), ContainSubstring("xdp_cali_")))

out, _ := tc.Felixes[0].ExecCombinedOutput("ip", "link", "show", "dev", "bpfin.cali")
Expect(out).To(Equal("Device \"bpfin.cali\" does not exist.\n"))
out, _ = tc.Felixes[0].ExecCombinedOutput("ip", "link", "show", "dev", "bpfout.cali")
Expect(out).To(Equal("Device \"bpfout.cali\" does not exist.\n"))
})
}
})
Expand Down