Skip to content

Commit 756101c

Browse files
committed
xdp-trafficgen: Exit non-zero if interface probing fails
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 <[email protected]>
1 parent cf7ed01 commit 756101c

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

xdp-trafficgen/xdp-trafficgen.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,15 +1037,16 @@ static struct prog_option probe_options[] = {
10371037
int do_probe(const void *opt, __unused const char *pin_root_path)
10381038
{
10391039
const struct probeopt *cfg = opt;
1040-
int err;
1040+
int err1 = 0, err2;
10411041

10421042
if (cfg->iface.ifindex)
1043-
check_iface_support(&cfg->iface);
1043+
err1 = check_iface_support(&cfg->iface);
10441044

1045-
err = probe_kernel_support();
1046-
if (!err)
1045+
err2 = probe_kernel_support();
1046+
if (!err2)
10471047
pr_info("Kernel supports live packet mode for XDP BPF_PROG_RUN.\n");
1048-
return err;
1048+
1049+
return !(!err1 && !err2);
10491050
}
10501051

10511052
int do_help(__unused const void *cfg, __unused const char *pin_root_path)

0 commit comments

Comments
 (0)