Merge pull request #624 from ecsv/batadv-for-18.06
[feed/routing.git] / batctl / patches / 0001-batctl-Return-EXIT_FAILURE-when-throughputmeter-fail.patch
1 From: Leonardo Mörlein <me@irrelefant.net>
2 Date: Wed, 8 Apr 2020 23:49:03 +0200
3 Subject: batctl: Return EXIT_FAILURE when throughputmeter failed
4
5 The command returned a success even an error was shown during the
6 execution.
7
8 $ (sudo batctl tp 77:77:77:77:77:77 && echo true) || echo false
9 Destination unreachable
10 true
11
12 Instead it should indicate a failure when the kernel replied with a
13 non-success return_value:
14
15 $ (sudo ./batctl tp 77:77:77:77:77:77 && echo true) || echo false
16 Destination unreachable
17 false
18
19 Fixes: f109b3473f86 ("batctl: introduce throughput meter support")
20 Signed-off-by: Leonardo Mörlein <me@irrelefant.net>
21 [sven@narfation.org: adjusted commit message]
22 Signed-off-by: Sven Eckelmann <sven@narfation.org>
23
24 Origin: upstream, https://git.open-mesh.org/batctl.git/commit/df8bf5164b6904f61ae0b0db090fb5bb41b4f06d
25
26 diff --git a/tp_meter.c b/tp_meter.c
27 index c7904857865c5b2a51cf30e7963394dd9b6c029c..403c88452b4ad56f4049f64829c6d2bdd015810a 100644
28 --- a/tp_meter.c
29 +++ b/tp_meter.c
30 @@ -480,6 +480,7 @@ int tp_meter(char *mesh_iface, int argc, char **argv)
31 goto out;
32 }
33
34 + ret = EXIT_FAILURE;
35 switch (result.return_value) {
36 case BATADV_TP_REASON_DST_UNREACHABLE:
37 fprintf(stderr, "Destination unreachable\n");