Skip to contentSkip to conversation

tc: flower: Add support for ct_state reply flag

PATCH Applied Paul Blakey 3 participants 4 messages Feb 2, 2021 – Feb 5, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tc: flower: Add support for ct_state reply flag

Matches on conntrack rpl ct_state.

Example:

$ tc filter add dev ens1f0_0 ingress prio 1 chain 1 proto ip flower \
  ct_state +trk+est+rpl \
  action mirred egress redirect dev ens1f0_1
$ tc filter add dev ens1f0_1 ingress prio 1 chain 1 proto ip flower \
  ct_state +trk+est-rpl \
  action mirred egress redirect dev ens1f0_0
---
 man/man8/tc-flower.8 | 2 ++
 tc/f_flower.c        | 1 +
 2 files changed, 3 insertions(+)
man/man8/tc-flower.8 +2 -0
index 226d1cc..f7336b6 100644
@@ -387,6 +387,8 @@ new - New connection.
 .TP
 est - Established connection.
 .TP
+rpl - The packet is in the reply direction, meaning that it is in the opposite direction from the packet that initiated the connection.
+.TP
 inv - The state is invalid. The packet couldn't be associated to a connection.
 .TP
 Example: +trk+est
tc/f_flower.c +1 -0
index 85c1043..53822a9 100644
@@ -346,6 +346,7 @@ static struct flower_ct_states {
 	{ "new", TCA_FLOWER_KEY_CT_FLAGS_NEW },
 	{ "est", TCA_FLOWER_KEY_CT_FLAGS_ESTABLISHED },
 	{ "inv", TCA_FLOWER_KEY_CT_FLAGS_INVALID },
+	{ "rpl", TCA_FLOWER_KEY_CT_FLAGS_REPLY },
 };
 
 static int flower_parse_ct_state(char *str, struct nlmsghdr *n)
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 10 lines · Paul Blakey

Matches on conntrack rpl ct_state.

Example:

$ tc filter add dev ens1f0_0 ingress prio 1 chain 1 proto ip flower \
  ct_state +trk+est+rpl \
  action mirred egress redirect dev ens1f0_1
$ tc filter add dev ens1f0_1 ingress prio 1 chain 1 proto ip flower \
  ct_state +trk+est-rpl \
  action mirred egress redirect dev ens1f0_0
Quoted 5 lines
---
 man/man8/tc-flower.8 | 2 ++
 tc/f_flower.c        | 1 +
 2 files changed, 3 insertions(+)

iproute has a header copy, include/uapi/linux/pkt_cls.h. I think it needs updating as well.

Marcelo

#2 lore raw
Quoted 17 lines · Marcelo Ricardo Leitner
Quoted 10 lines · Paul Blakey

Matches on conntrack rpl ct_state.

Example:

$ tc filter add dev ens1f0_0 ingress prio 1 chain 1 proto ip flower \
  ct_state +trk+est+rpl \
  action mirred egress redirect dev ens1f0_1
$ tc filter add dev ens1f0_1 ingress prio 1 chain 1 proto ip flower \
  ct_state +trk+est-rpl \
  action mirred egress redirect dev ens1f0_0
Quoted 5 lines
---
 man/man8/tc-flower.8 | 2 ++
 tc/f_flower.c        | 1 +
 2 files changed, 3 insertions(+)
Quoted 5 lines

iproute has a header copy, include/uapi/linux/pkt_cls.h. I think it needs updating as well.

Marcelo

Hi,

Commit 1e6190218050 ("Update kernel headers") from 02/02/2021 updated the headers to include the relevant flag.

Thanks,
Paul.

Applied
#3 lore raw
In reply to Paul Blakey
Quoted 10 lines · Paul Blakey

Matches on conntrack rpl ct_state.

Example:

$ tc filter add dev ens1f0_0 ingress prio 1 chain 1 proto ip flower \
  ct_state +trk+est+rpl \
  action mirred egress redirect dev ens1f0_1
$ tc filter add dev ens1f0_1 ingress prio 1 chain 1 proto ip flower \
  ct_state +trk+est-rpl \
  action mirred egress redirect dev ens1f0_0
Quoted 6 lines
---
 man/man8/tc-flower.8 | 2 ++
 tc/f_flower.c        | 1 +
 2 files changed, 3 insertions(+)

applied to iproute2-next. Thanks