[PATCH 2/5] batctl: genl_json: reject unknown options in handle_json_query

Sven Eckelmann <[email protected]> Sun, 05 Jul 2026 17:53:36 +0200
Newsgroups org.open-mesh.lists.batman
Message-ID <[email protected]>
Print the usage and return a failure for unknown options.

Fixes: 57cc3c472a7d ("batctl: Introduce handler for JSON_* command types")
Signed-off-by: Sven Eckelmann <[email protected]>
---
 genl_json.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/genl_json.c b/genl_json.c
index ee83ab2..356c5d7 100644
--- a/genl_json.c
+++ b/genl_json.c
@@ -593,6 +593,9 @@ int handle_json_query(struct state *state, int argc, char **argv)
 		case 'h':
 			json_query_usage(state);
 			return EXIT_SUCCESS;
+		default:
+			json_query_usage(state);
+			return EXIT_FAILURE;
 		}
 	}
 

-- 
2.47.3