diff mbox series

[PATCHv2,iproute2,2/2] tc: m_action: fix parsing of TCA_EXT_WARN_MSG by using different enum

Message ID 20230316035242.2321915-3-liuhangbin@gmail.com (mailing list archive)
State Accepted
Delegated to: Stephen Hemminger
Headers show
Series tc: fix parsing of TCA_EXT_WARN_MSG | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Hangbin Liu March 16, 2023, 3:52 a.m. UTC
We can't use TCA_EXT_WARN_MSG directly in tc action as it's using different
enum with filter. Let's use a new TCA_ROOT_EXT_WARN_MSG for tc action
specifically.

Fixes: 6035995665b7 ("tc: add new attr TCA_EXT_WARN_MSG")
Reviewed-by: Andrea Claudi <aclaudi@redhat.com>
Reported-and-tested-by: Davide Caratti <dcaratti@redhat.com>
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
---
v2: rename TCA_ACT_EXT_ to TCA_ROOT_EXT_
---
 include/uapi/linux/rtnetlink.h | 1 +
 tc/m_action.c                  | 8 +++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

Comments

Stephen Hemminger March 19, 2023, 2:26 a.m. UTC | #1
On Thu, 16 Mar 2023 11:52:42 +0800
Hangbin Liu <liuhangbin@gmail.com> wrote:

> We can't use TCA_EXT_WARN_MSG directly in tc action as it's using different
> enum with filter. Let's use a new TCA_ROOT_EXT_WARN_MSG for tc action
> specifically.
> 
> Fixes: 6035995665b7 ("tc: add new attr TCA_EXT_WARN_MSG")
> Reviewed-by: Andrea Claudi <aclaudi@redhat.com>
> Reported-and-tested-by: Davide Caratti <dcaratti@redhat.com>
> Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
> ---

Applied but all headers files get done separately by a script
that uses sanitized kernel headers.
Hangbin Liu March 20, 2023, 9:18 a.m. UTC | #2
On Sat, Mar 18, 2023 at 07:26:51PM -0700, Stephen Hemminger wrote:
> Applied but all headers files get done separately by a script
> that uses sanitized kernel headers.

Got it, I will drop the header file changes in future.

Thanks
Hangbin
diff mbox series

Patch

diff --git a/include/uapi/linux/rtnetlink.h b/include/uapi/linux/rtnetlink.h
index 217b25b9..2132e941 100644
--- a/include/uapi/linux/rtnetlink.h
+++ b/include/uapi/linux/rtnetlink.h
@@ -787,6 +787,7 @@  enum {
 	TCA_ROOT_FLAGS,
 	TCA_ROOT_COUNT,
 	TCA_ROOT_TIME_DELTA, /* in msecs */
+	TCA_ROOT_EXT_WARN_MSG,
 	__TCA_ROOT_MAX,
 #define	TCA_ROOT_MAX (__TCA_ROOT_MAX - 1)
 };
diff --git a/tc/m_action.c b/tc/m_action.c
index 0400132c..a446cabd 100644
--- a/tc/m_action.c
+++ b/tc/m_action.c
@@ -586,7 +586,13 @@  int print_action(struct nlmsghdr *n, void *arg)
 
 	open_json_object(NULL);
 	tc_dump_action(fp, tb[TCA_ACT_TAB], tot_acts ? *tot_acts:0, false);
-	print_ext_msg(tb);
+
+	if (tb[TCA_ROOT_EXT_WARN_MSG]) {
+		print_string(PRINT_ANY, "warn", "%s",
+			     rta_getattr_str(tb[TCA_ROOT_EXT_WARN_MSG]));
+		print_nl();
+	}
+
 	close_json_object();
 
 	return 0;