]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
ucode-mod-bpf: fix error reporting in tc hook setup
authorFelix Fietkau <nbd@nbd.name>
Thu, 16 Jul 2026 18:07:21 +0000 (20:07 +0200)
committerFelix Fietkau <nbd@nbd.name>
Mon, 20 Jul 2026 08:43:36 +0000 (10:43 +0200)
Failures in the detach path returned NULL without recording any error
state, so error() reported a stale or empty error. Attach failures
reported a hardcoded ENOENT regardless of the actual cause. Record
errno for all failures; if_nametoindex, bpf_tc_attach and
bpf_tc_detach all set it.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
package/utils/ucode-mod-bpf/src/bpf.c

index 45cd7114dd2465360c574c108586a96c9265b14f..dba4ad8b99914664e1d8205be56dc6be8ac5c613 100644 (file)
@@ -680,9 +680,7 @@ out:
        return TRUE;
 
 error:
-       if (fd >= 0)
-               err_return(ENOENT, NULL);
-       return NULL;
+       err_return(errno, NULL);
 }
 
 static uc_value_t *