]> git.feebdaed.xyz Git - 0xmirror/xdp-tools.git/commitdiff
xdp-trafficgen: Exit non-zero if interface probing fails
authorToke Høiland-Jørgensen <toke@redhat.com>
Fri, 8 Aug 2025 16:13:59 +0000 (18:13 +0200)
committerToke Høiland-Jørgensen <toke@redhat.com>
Fri, 8 Aug 2025 16:13:59 +0000 (18:13 +0200)
The per-interface probing in the 'probe' command did not affect the exit
code of the program. Fix this to exit non-zero if any of the probes fail.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
xdp-trafficgen/xdp-trafficgen.c

index 5fef9180c2f7395565b04249b617353134a1d5bd..b9b25ed1b809aa58bddca789c355d2b187500a89 100644 (file)
@@ -1037,15 +1037,16 @@ static struct prog_option probe_options[] = {
 int do_probe(const void *opt, __unused const char *pin_root_path)
 {
        const struct probeopt *cfg = opt;
-       int err;
+       int err1 = 0, err2;
 
        if (cfg->iface.ifindex)
-               check_iface_support(&cfg->iface);
+               err1 = check_iface_support(&cfg->iface);
 
-       err = probe_kernel_support();
-       if (!err)
+       err2 = probe_kernel_support();
+       if (!err2)
                pr_info("Kernel supports live packet mode for XDP BPF_PROG_RUN.\n");
-       return err;
+
+       return !(!err1 && !err2);
 }
 
 int do_help(__unused const void *cfg, __unused const char *pin_root_path)