From patchwork Thu Dec 6 06:31:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 17667 X-Patchwork-Delegate: sw@simonwunderlich.de Return-Path: X-Original-To: patchwork@open-mesh.org Delivered-To: patchwork@open-mesh.org Received: from open-mesh.org (localhost [IPv6:::1]) by open-mesh.org (Postfix) with ESMTP id 6254880781; Thu, 6 Dec 2018 07:32:07 +0100 (CET) Authentication-Results: open-mesh.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=narfation.org header.i=@narfation.org header.b="v75ubPwS"; dkim-atps=neutral Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2001:4d88:2000:7::2; helo=v3-1039.vlinux.de; envelope-from=sven@narfation.org; receiver= Received: from v3-1039.vlinux.de (narfation.org [IPv6:2001:4d88:2000:7::2]) by open-mesh.org (Postfix) with ESMTPS id 4FF3580531 for ; Thu, 6 Dec 2018 07:32:04 +0100 (CET) Received: from sven-desktop.home.narfation.org (p200300C5970CE6FD0000000000004065.dip0.t-ipconnect.de [IPv6:2003:c5:970c:e6fd::4065]) by v3-1039.vlinux.de (Postfix) with ESMTPSA id 443CE1100DC; Thu, 6 Dec 2018 07:32:03 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=narfation.org; s=20121; t=1544077923; bh=8yx5W/QEceFBKKt5Ulf9Qc7oYTk2//nlQDBPDDQDcgQ=; h=From:To:Cc:Subject:Date:From; b=v75ubPwSuzbgfQ6/ftgYv7yRmG+ncSPs0hCLGyw5iafwEdQt9vGXePbiY4gQGUp5d zuLLxNVs9mA2/+zBQDAN+fs8VZhWXj9UEcuys9X/Pi+VdYqgLh6IV6K0eU/hy28ofQ bjA7YR7ZeL9wRW5cqzPsqHL0aNM/xOVpe+xUH3nk= From: Sven Eckelmann To: b.a.t.m.a.n@lists.open-mesh.org Date: Thu, 6 Dec 2018 07:31:59 +0100 Message-Id: <20181206063159.4070-1-sven@narfation.org> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 Subject: [B.A.T.M.A.N.] [PATCH maint] batctl: Fix parsing of optional debug table command parameters X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking Errors-To: b.a.t.m.a.n-bounces@lists.open-mesh.org Sender: "B.A.T.M.A.N" The commands which should have no support for -t/-u/-m/-i were allowed to accept these parameters but commands which should have accepted them were denying them. Fixes: cd2b4047ead9 ("batctl: Convert debug table to command infrastructure") Reported-by: Andreas Ziegler Signed-off-by: Sven Eckelmann --- debug.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/debug.c b/debug.c index 2979dff..316312f 100644 --- a/debug.c +++ b/debug.c @@ -89,7 +89,7 @@ int handle_debug_table(struct state *state, int argc, char **argv) } break; case 't': - if (debug_table->option_watch_interval) { + if (!debug_table->option_watch_interval) { fprintf(stderr, "Error - unrecognised option '-%c'\n", optchar); debug_table_usage(state); return EXIT_FAILURE; @@ -105,7 +105,7 @@ int handle_debug_table(struct state *state, int argc, char **argv) read_opt |= SKIP_HEADER; break; case 'u': - if (debug_table->option_unicast_only) { + if (!debug_table->option_unicast_only) { fprintf(stderr, "Error - unrecognised option '-%c'\n", optchar); debug_table_usage(state); return EXIT_FAILURE; @@ -114,7 +114,7 @@ int handle_debug_table(struct state *state, int argc, char **argv) read_opt |= UNICAST_ONLY; break; case 'm': - if (debug_table->option_multicast_only) { + if (!debug_table->option_multicast_only) { fprintf(stderr, "Error - unrecognised option '-%c'\n", optchar); debug_table_usage(state); return EXIT_FAILURE; @@ -123,7 +123,7 @@ int handle_debug_table(struct state *state, int argc, char **argv) read_opt |= MULTICAST_ONLY; break; case 'i': - if (debug_table->option_orig_iface) { + if (!debug_table->option_orig_iface) { fprintf(stderr, "Error - unrecognised option '-%c'\n", optchar); debug_table_usage(state); return EXIT_FAILURE;