batctl: Fix parsing of optional debug table command parameters
[feed/routing.git] / batctl / patches / 0001-batctl-Fix-parsing-of-optional-debug-table-command-p.patch
1 From: Sven Eckelmann <sven@narfation.org>
2 Date: Thu, 6 Dec 2018 07:31:59 +0100
3 Subject: [PATCH] batctl: Fix parsing of optional debug table command parameters
4
5 The commands which should have no support for -t/-u/-m/-i were allowed to
6 accept these parameters but commands which should have accepted them were
7 denying them.
8
9 Fixes: cd2b4047ead9 ("batctl: Convert debug table to command infrastructure")
10 Reported-by: Andreas Ziegler <dev@andreas-ziegler.de>
11 Signed-off-by: Sven Eckelmann <sven@narfation.org>
12
13 Forwarded: https://patchwork.open-mesh.org/patch/17667/
14 ---
15 debug.c | 8 ++++----
16 1 file changed, 4 insertions(+), 4 deletions(-)
17
18 diff --git a/debug.c b/debug.c
19 index 2979dff99af0b1c98f56931e8650e298dd9eac9b..316312f7162dbe0dc38ced2df1444887482e7bad 100644
20 --- a/debug.c
21 +++ b/debug.c
22 @@ -89,7 +89,7 @@ int handle_debug_table(struct state *state, int argc, char **argv)
23 }
24 break;
25 case 't':
26 - if (debug_table->option_watch_interval) {
27 + if (!debug_table->option_watch_interval) {
28 fprintf(stderr, "Error - unrecognised option '-%c'\n", optchar);
29 debug_table_usage(state);
30 return EXIT_FAILURE;
31 @@ -105,7 +105,7 @@ int handle_debug_table(struct state *state, int argc, char **argv)
32 read_opt |= SKIP_HEADER;
33 break;
34 case 'u':
35 - if (debug_table->option_unicast_only) {
36 + if (!debug_table->option_unicast_only) {
37 fprintf(stderr, "Error - unrecognised option '-%c'\n", optchar);
38 debug_table_usage(state);
39 return EXIT_FAILURE;
40 @@ -114,7 +114,7 @@ int handle_debug_table(struct state *state, int argc, char **argv)
41 read_opt |= UNICAST_ONLY;
42 break;
43 case 'm':
44 - if (debug_table->option_multicast_only) {
45 + if (!debug_table->option_multicast_only) {
46 fprintf(stderr, "Error - unrecognised option '-%c'\n", optchar);
47 debug_table_usage(state);
48 return EXIT_FAILURE;
49 @@ -123,7 +123,7 @@ int handle_debug_table(struct state *state, int argc, char **argv)
50 read_opt |= MULTICAST_ONLY;
51 break;
52 case 'i':
53 - if (debug_table->option_orig_iface) {
54 + if (!debug_table->option_orig_iface) {
55 fprintf(stderr, "Error - unrecognised option '-%c'\n", optchar);
56 debug_table_usage(state);
57 return EXIT_FAILURE;