From a214dd016f9d9fe46fde844fd563c842ac97dd88 Mon Sep 17 00:00:00 2001 From: Gaurav Ghildiyal Date: Thu, 14 Aug 2025 22:17:42 -0700 Subject: [PATCH] fix: eBPF attribute should be false when there are no programs Currently, eBPF attribute is always set to true since `link.QueryPrograms` mostly returns a successful call. This leads to the program thinking that is has "some" BPF programs since the code does not check for an empty value. This eventually trickles down to failures in "validate bpf filter attributes". The attribute is always true so we never wait and continue checking for the existence of `tcFilterNames` which may not yet have been updated by the driver. --- pkg/inventory/net.go | 2 +- tests/e2e.bats | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/inventory/net.go b/pkg/inventory/net.go index f2f14d9a..8b137742 100644 --- a/pkg/inventory/net.go +++ b/pkg/inventory/net.go @@ -97,7 +97,7 @@ func getTcxFilters(device netlink.Link) ([]string, bool) { Target: int(device.Attrs().Index), Attach: attach, }) - if err != nil { + if err != nil || result == nil || len(result.Programs) == 0 { continue } diff --git a/tests/e2e.bats b/tests/e2e.bats index f4675a05..cf8e3af1 100644 --- a/tests/e2e.bats +++ b/tests/e2e.bats @@ -14,9 +14,9 @@ teardown() { setup_bpf_device() { docker cp "$BATS_TEST_DIRNAME"/dummy_bpf.o "$CLUSTER_NAME"-worker2:/dummy_bpf.o docker exec "$CLUSTER_NAME"-worker2 bash -c "ip link add dummy0 type dummy" - docker exec "$CLUSTER_NAME"-worker2 bash -c "ip link set up dev dummy0" docker exec "$CLUSTER_NAME"-worker2 bash -c "tc qdisc add dev dummy0 clsact" docker exec "$CLUSTER_NAME"-worker2 bash -c "tc filter add dev dummy0 ingress bpf direct-action obj dummy_bpf.o sec classifier" + docker exec "$CLUSTER_NAME"-worker2 bash -c "ip link set up dev dummy0" } setup_tcx_filter() {