OVN is setting ct drop rule with a ct clear action.
OVS datapath behavior is if there is no forward action
the default is drop.
TC behavior is to continue with next match.
Fix to match tc to ovs behavior by setting last action
attribute as drop instead of pipe.
Also update lastused when parsing ct action.

example rule
recirc_id(0x1),in_port(2),ct_state(+trk),eth(),eth_type(0x0800),ipv4(frag=no),
packets:82, bytes:8036, used:2.108s, actions:ct_clear

Reviewed-by: Maor Dickman <[email protected]>
Signed-off-by: Roi Dayan <[email protected]>
---
 lib/tc.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/lib/tc.c b/lib/tc.c
index f8fbe44bf244..180e6bda870c 100644
--- a/lib/tc.c
+++ b/lib/tc.c
@@ -1551,6 +1551,7 @@ nl_parse_act_ct(struct nlattr *options, struct tc_flower 
*flower)
     struct tc_action *action;
     const struct tc_ct *ct;
     uint16_t ct_action = 0;
+    struct tcf_t tm;
 
     if (!nl_parse_nested(options, ct_policy, ct_attrs,
                          ARRAY_SIZE(ct_policy))) {
@@ -1636,6 +1637,11 @@ nl_parse_act_ct(struct nlattr *options, struct tc_flower 
*flower)
     }
     action->type = TC_ACT_CT;
 
+    if (ct_attrs[TCA_CT_TM]) {
+        memcpy(&tm, nl_attr_get_unspec(ct_attrs[TCA_CT_TM], sizeof tm),
+               sizeof tm);
+        nl_parse_tcf(&tm, flower);
+    }
     nl_parse_action_pc(ct->action, action);
     return 0;
 }
@@ -3115,7 +3121,11 @@ nl_msg_put_flower_acts(struct ofpbuf *request, struct 
tc_flower *flower)
             uint32_t action_pc; /* Programmatic Control */
 
             if (!action->jump_action) {
-                action_pc = TC_ACT_PIPE;
+                if (i == flower->action_count - 1) {
+                    action_pc = TC_ACT_SHOT;
+                } else {
+                    action_pc = TC_ACT_PIPE;
+                }
             } else if (action->jump_action == JUMP_ACTION_STOP) {
                 action_pc = TC_ACT_STOLEN;
             } else {
-- 
2.8.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to