naccyde / rpms / iproute

Forked from rpms/iproute 7 months ago
Clone

Blame 0004-u32-fix-TC_U32_TERMINAL-printing.patch

3ec91e
From 80e59389e93bf3f45204a38536f3f228adf153c7 Mon Sep 17 00:00:00 2001
3ec91e
Message-Id: <80e59389e93bf3f45204a38536f3f228adf153c7.1686076455.git.aclaudi@redhat.com>
3ec91e
In-Reply-To: <d60a7ac3c0f6aa2a933f48a69ab31e3637f6906c.1686076455.git.aclaudi@redhat.com>
3ec91e
References: <d60a7ac3c0f6aa2a933f48a69ab31e3637f6906c.1686076455.git.aclaudi@redhat.com>
3ec91e
From: Andrea Claudi <aclaudi@redhat.com>
3ec91e
Date: Tue, 6 Jun 2023 20:05:15 +0200
3ec91e
Subject: [PATCH] u32: fix TC_U32_TERMINAL printing
3ec91e
3ec91e
Jira: https://issues.redhat.com/browse/RHEL-337
3ec91e
Upstream Status: iproute2-next.git commit 2854d69a
3ec91e
3ec91e
commit 2854d69a99f6e38d0d2426bd641a56d7a85bc61b
3ec91e
Author: Hangbin Liu <liuhangbin@gmail.com>
3ec91e
Date:   Wed Mar 1 22:21:00 2023 +0800
3ec91e
3ec91e
    u32: fix TC_U32_TERMINAL printing
3ec91e
3ec91e
    We previously printed an asterisk if there was no 'sel' or
3ec91e
    'TC_U32_TERMINAL' flag. However,
3ec91e
     commit 1ff227545ce1 ("u32: fix json formatting of flowid")
3ec91e
    changed the logic to print an asterisk only if there is a
3ec91e
    'TC_U32_TERMINAL' flag. Therefore, we need to fix this
3ec91e
    regression.
3ec91e
3ec91e
    Before the fix, the tdc u32 test failed:
3ec91e
3ec91e
    1..11
3ec91e
    not ok 1 afa9 - Add u32 with source match
3ec91e
            Could not match regex pattern. Verify command output:
3ec91e
    filter protocol ip pref 1 u32 chain 0
3ec91e
    filter protocol ip pref 1 u32 chain 0 fh 800: ht divisor 1
3ec91e
    filter protocol ip pref 1 u32 chain 0 fh 800::800 order 2048 key ht 800 bkt 0 *flowid 1:1 not_in_hw
3ec91e
      match 7f000001/ffffffff at 12
3ec91e
            action order 1: gact action pass
3ec91e
             random type none pass val 0
3ec91e
             index 1 ref 1 bind 1
3ec91e
3ec91e
    After fix, the test passed:
3ec91e
    1..11
3ec91e
    ok 1 afa9 - Add u32 with source match
3ec91e
3ec91e
    Fixes: 1ff227545ce1 ("u32: fix json formatting of flowid")
3ec91e
    Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
3ec91e
    Reviewed-by: Victor Nogueira <victor@mojatatu.com>
3ec91e
    Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
3ec91e
---
3ec91e
 tc/f_u32.c | 2 +-
3ec91e
 1 file changed, 1 insertion(+), 1 deletion(-)
3ec91e
3ec91e
diff --git a/tc/f_u32.c b/tc/f_u32.c
3ec91e
index bfe9e5f9..de2d0c9e 100644
3ec91e
--- a/tc/f_u32.c
3ec91e
+++ b/tc/f_u32.c
3ec91e
@@ -1273,7 +1273,7 @@ static int u32_print_opt(struct filter_util *qu, FILE *f, struct rtattr *opt,
3ec91e
 	if (tb[TCA_U32_CLASSID]) {
3ec91e
 		__u32 classid = rta_getattr_u32(tb[TCA_U32_CLASSID]);
3ec91e
 		SPRINT_BUF(b1);
3ec91e
-		if (sel && (sel->flags & TC_U32_TERMINAL))
3ec91e
+		if (!sel || !(sel->flags & TC_U32_TERMINAL))
3ec91e
 			print_string(PRINT_FP, NULL, "*", NULL);
3ec91e
 
3ec91e
 		print_string(PRINT_ANY, "flowid", "flowid %s ",
3ec91e
-- 
3ec91e
2.40.1
3ec91e