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 3/4] tc: actions: fail list and flush of an unknown action kind
Date: Sun, 29 Nov 2026 15:21:15 -0800	[thread overview]
Message-ID: <20261129232116.3399352-4-dave.seddon.ca@gmail.com> (raw)
In-Reply-To: <20261129232116.3399352-1-dave.seddon.ca@gmail.com>

Set ret to -1 on the "bad action" paths of tc_act_list_or_flush(),
which exit 0 today:

  # tc actions ls action nosuch
  bad action nosuch
  # echo $?
  0

Signed-off-by: Dave Seddon <dave.seddon.ca@gmail.com>
---
 tc/m_action.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tc/m_action.c b/tc/m_action.c
index bbc8e6a6..ee6d2aac 100644
--- a/tc/m_action.c
+++ b/tc/m_action.c
@@ -791,10 +791,12 @@ static int tc_act_list_or_flush(int *argc_p, char ***argv_p, int event)
 	a = get_action_kind(k);
 	if (a == NULL) {
 		fprintf(stderr, "bad action %s\n", k);
+		ret = -1;
 		goto bad_val;
 	}
 	if (strcmp(a->id, k) != 0) {
 		fprintf(stderr, "bad action %s\n", k);
+		ret = -1;
 		goto bad_val;
 	}
 	strncpy(k, *argv, sizeof(k) - 1);
-- 
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 ` Dave Seddon [this message]
2026-11-29 23:21 ` [PATCH iproute2 4/4] tc: return after usage() for help Dave Seddon

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-4-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