naccyde / rpms / iproute

Forked from rpms/iproute 8 months ago
Clone

Blame SOURCES/0001-tc-f_flower-Add-option-to-match-on-related-ct-state.patch

955418
From d9bcc70051d23c62cc802a356dc7e4324398765e Mon Sep 17 00:00:00 2001
955418
Message-Id: <d9bcc70051d23c62cc802a356dc7e4324398765e.1624894546.git.aclaudi@redhat.com>
955418
From: Andrea Claudi <aclaudi@redhat.com>
955418
Date: Mon, 28 Jun 2021 15:22:17 +0200
955418
Subject: [PATCH] tc: f_flower: Add option to match on related ct state
955418
955418
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1957243
955418
Upstream Status: unknown commit 7fda6c58
955418
955418
commit 7fda6c588a295ad381fdf0b9b9971169b2f9d9dc
955418
Author: Ariel Levkovich <lariel@nvidia.com>
955418
Date:   Fri May 21 20:07:06 2021 +0300
955418
955418
    tc: f_flower: Add option to match on related ct state
955418
955418
    Add support for matching on ct_state flag related.
955418
    The related state indicates a packet is associated with an existing
955418
    connection.
955418
955418
    Example:
955418
    $ tc filter add dev ens1f0_0 ingress prio 1 chain 1 proto ip flower \
955418
      ct_state -est-rel+trk \
955418
      action mirred egress redirect dev ens1f0_1
955418
955418
    $ tc filter add dev ens1f0_0 ingress prio 1 chain 1 proto ip flower \
955418
      ct_state +rel+trk \
955418
      action mirred egress redirect dev ens1f0_1
955418
955418
    Signed-off-by: Ariel Levkovich <lariel@nvidia.com>
955418
    Reviewed-by: Jiri Pirko <jiri@nvidia.com>
955418
    Signed-off-by: David Ahern <dsahern@kernel.org>
955418
---
955418
 man/man8/tc-flower.8 | 2 ++
955418
 tc/f_flower.c        | 3 ++-
955418
 2 files changed, 4 insertions(+), 1 deletion(-)
955418
955418
diff --git a/man/man8/tc-flower.8 b/man/man8/tc-flower.8
955418
index f7336b62..4541d937 100644
955418
--- a/man/man8/tc-flower.8
955418
+++ b/man/man8/tc-flower.8
955418
@@ -391,6 +391,8 @@ rpl - The packet is in the reply direction, meaning that it is in the opposite d
955418
 .TP
955418
 inv - The state is invalid. The packet couldn't be associated to a connection.
955418
 .TP
955418
+rel - The packet is related to an existing connection.
955418
+.TP
955418
 Example: +trk+est
955418
 .RE
955418
 .TP
955418
diff --git a/tc/f_flower.c b/tc/f_flower.c
955418
index 53822a95..29db2e23 100644
955418
--- a/tc/f_flower.c
955418
+++ b/tc/f_flower.c
955418
@@ -94,7 +94,7 @@ static void explain(void)
955418
 		"	LSE := lse depth DEPTH { label LABEL | tc TC | bos BOS | ttl TTL }\n"
955418
 		"	FILTERID := X:Y:Z\n"
955418
 		"	MASKED_LLADDR := { LLADDR | LLADDR/MASK | LLADDR/BITS }\n"
955418
-		"	MASKED_CT_STATE := combination of {+|-} and flags trk,est,new\n"
955418
+		"	MASKED_CT_STATE := combination of {+|-} and flags trk,est,new,rel\n"
955418
 		"	ACTION-SPEC := ... look at individual actions\n"
955418
 		"\n"
955418
 		"NOTE:	CLASSID, IP-PROTO are parsed as hexadecimal input.\n"
955418
@@ -345,6 +345,7 @@ static struct flower_ct_states {
955418
 	{ "trk", TCA_FLOWER_KEY_CT_FLAGS_TRACKED },
955418
 	{ "new", TCA_FLOWER_KEY_CT_FLAGS_NEW },
955418
 	{ "est", TCA_FLOWER_KEY_CT_FLAGS_ESTABLISHED },
955418
+	{ "rel", TCA_FLOWER_KEY_CT_FLAGS_RELATED },
955418
 	{ "inv", TCA_FLOWER_KEY_CT_FLAGS_INVALID },
955418
 	{ "rpl", TCA_FLOWER_KEY_CT_FLAGS_REPLY },
955418
 };
955418
-- 
955418
2.31.1
955418