Netdev List
 help / color / mirror / Atom feed
From: Dave Seddon <dave.seddon.ca@gmail.com>
To: netdev@vger.kernel.org
Cc: Dave Seddon <dave.seddon.ca@gmail.com>,
	Stephen Hemminger <stephen@networkplumber.org>,
	David Ahern <dsahern@kernel.org>,
	Jamal Hadi Salim <jhs@mojatatu.com>
Subject: [PATCH iproute2 4/4] tc: return after usage() for help
Date: Sun, 29 Nov 2026 15:21:16 -0800	[thread overview]
Message-ID: <20261129232116.3399352-5-dave.seddon.ca@gmail.com> (raw)
In-Reply-To: <20261129232116.3399352-1-dave.seddon.ca@gmail.com>

Return after usage() for "help" in the qdisc and class add paths and in
the qdisc, class and filter show paths, as tc_filter_modify() does. Today

  # tc qdisc add dev lo root handle 1: help pfifo

prints the usage and then adds the pfifo, and

  # tc qdisc show dev lo help

prints the usage and then the qdiscs.

Signed-off-by: Dave Seddon <dave.seddon.ca@gmail.com>
---
 tc/tc_class.c  | 2 ++
 tc/tc_filter.c | 1 +
 tc/tc_qdisc.c  | 2 ++
 3 files changed, 5 insertions(+)

diff --git a/tc/tc_class.c b/tc/tc_class.c
index 82f0f85e..7f9c961d 100644
--- a/tc/tc_class.c
+++ b/tc/tc_class.c
@@ -104,6 +104,7 @@ static int tc_class_modify(int cmd, unsigned int flags, int argc, char **argv)
 				return -1;
 		} else if (matches(*argv, "help") == 0) {
 			usage();
+			return 0;
 		} else {
 			strncpy(k, *argv, sizeof(k)-1);
 
@@ -435,6 +436,7 @@ static int tc_class_list(int argc, char **argv)
 			req.t.tcm_parent = handle;
 		} else if (matches(*argv, "help") == 0) {
 			usage();
+			return 0;
 		} else {
 			fprintf(stderr, "What is \"%s\"? Try \"tc class help\".\n", *argv);
 			return -1;
diff --git a/tc/tc_filter.c b/tc/tc_filter.c
index 7b504029..a67288e4 100644
--- a/tc/tc_filter.c
+++ b/tc/tc_filter.c
@@ -690,6 +690,7 @@ static int tc_filter_list(int cmd, int argc, char **argv)
 			filter_chain_index = chain_index;
 		} else if (matches(*argv, "help") == 0) {
 			usage();
+			return 0;
 		} else {
 			fprintf(stderr,
 				" What is \"%s\"? Try \"tc filter help\"\n",
diff --git a/tc/tc_qdisc.c b/tc/tc_qdisc.c
index 7c3e7cb3..18818fbf 100644
--- a/tc/tc_qdisc.c
+++ b/tc/tc_qdisc.c
@@ -132,6 +132,7 @@ static int tc_qdisc_modify(int cmd, unsigned int flags, int argc, char **argv)
 				invarg("invalid egress block index value", *argv);
 		} else if (matches(*argv, "help") == 0) {
 			usage();
+			return 0;
 		} else {
 			strncpy(k, *argv, sizeof(k)-1);
 
@@ -398,6 +399,7 @@ static int tc_qdisc_list(int argc, char **argv)
 			filter_handle = handle;
 		} else if (matches(*argv, "help") == 0) {
 			usage();
+			return 0;
 		} else if (strcmp(*argv, "invisible") == 0) {
 			dump_invisible = true;
 		} else {
-- 
2.56.0


      parent reply	other threads:[~2026-11-29 23:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-29 23:21 [PATCH iproute2 0/4] tc: four small fixes Dave Seddon
2026-11-29 23:21 ` [PATCH iproute2 1/4] tc: netem: mark TCA_NETEM_CORR present for duplicate Dave Seddon
2026-11-29 23:21 ` [PATCH iproute2 2/4] tc: sfq: reject avpkt 0 Dave Seddon
2026-11-29 23:21 ` [PATCH iproute2 3/4] tc: actions: fail list and flush of an unknown action kind Dave Seddon
2026-11-29 23:21 ` Dave Seddon [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261129232116.3399352-5-dave.seddon.ca@gmail.com \
    --to=dave.seddon.ca@gmail.com \
    --cc=dsahern@kernel.org \
    --cc=jhs@mojatatu.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox