Skip to content

Commit

Permalink
ovn-trace: honor ct state in execute_ct_lb
Browse files Browse the repository at this point in the history
When performing CT_LB action in ovn-trace, take into account current
connection tracking state provided by the user.

Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=1980702
Fixes: 8accd26 ("OVN: add CT_LB action to ovn-trace")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Acked-by: Dumitru Ceara <dceara@redhat.com>
Signed-off-by: Numan Siddique <numans@ovn.org>
  • Loading branch information
LorenzoBianconi authored and numansiddique committed Dec 10, 2021
1 parent 187270c commit 8fd4cec
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 10 deletions.
58 changes: 49 additions & 9 deletions tests/ovn-northd.at
Original file line number Diff line number Diff line change
Expand Up @@ -2916,7 +2916,12 @@ AT_CHECK_UNQUOTED([ovn-trace --ct new --ct new --minimal ls "${flow}"], [0], [dn
# tcp,reg14=0x${lsp1_inport},vlan_tci=0x0000,dl_src=00:00:00:00:00:01,dl_dst=00:00:00:00:00:02,nw_src=42.42.42.1,nw_dst=66.66.66.66,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=0,tp_dst=80,tcp_flags=0
ct_lb {
ct_lb {
output("lsp2");
reg0[[6]] = 0;
*** chk_lb_hairpin_reply action not implemented;
reg0[[12]] = 0;
ct_lb /* default (use --ct to customize) */ {
output("lsp2");
};
};
};
])
Expand All @@ -2927,7 +2932,12 @@ AT_CHECK_UNQUOTED([ovn-trace --ct new --ct new --minimal ls "${flow}"], [0], [dn
# udp,reg14=0x${lsp1_inport},vlan_tci=0x0000,dl_src=00:00:00:00:00:01,dl_dst=00:00:00:00:00:02,nw_src=42.42.42.1,nw_dst=66.66.66.66,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=0,tp_dst=80
ct_lb {
ct_lb {
output("lsp2");
reg0[[6]] = 0;
*** chk_lb_hairpin_reply action not implemented;
reg0[[12]] = 0;
ct_lb /* default (use --ct to customize) */ {
output("lsp2");
};
};
};
])
Expand All @@ -2944,7 +2954,12 @@ AT_CHECK_UNQUOTED([ovn-trace --ct new --ct new --minimal ls "${flow}"], [0], [dn
# tcp,reg14=0x${lsp1_inport},vlan_tci=0x0000,dl_src=00:00:00:00:00:01,dl_dst=00:00:00:00:00:02,nw_src=42.42.42.1,nw_dst=66.66.66.66,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=0,tp_dst=80,tcp_flags=0
ct_lb {
ct_lb {
output("lsp2");
reg0[[6]] = 0;
*** chk_lb_hairpin_reply action not implemented;
reg0[[12]] = 0;
ct_lb /* default (use --ct to customize) */ {
output("lsp2");
};
};
};
])
Expand All @@ -2955,7 +2970,12 @@ AT_CHECK_UNQUOTED([ovn-trace --ct new --ct new --minimal ls "${flow}"], [0], [dn
# udp,reg14=0x${lsp1_inport},vlan_tci=0x0000,dl_src=00:00:00:00:00:01,dl_dst=00:00:00:00:00:02,nw_src=42.42.42.1,nw_dst=66.66.66.66,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=0,tp_dst=80
ct_lb {
ct_lb {
output("lsp2");
reg0[[6]] = 0;
*** chk_lb_hairpin_reply action not implemented;
reg0[[12]] = 0;
ct_lb /* default (use --ct to customize) */ {
output("lsp2");
};
};
};
])
Expand Down Expand Up @@ -3052,7 +3072,12 @@ AT_CHECK_UNQUOTED([ovn-trace --ct new --ct new --minimal ls "${flow}"], [0], [dn
# tcp,reg14=0x${lsp1_inport},vlan_tci=0x0000,dl_src=00:00:00:00:00:01,dl_dst=00:00:00:00:00:02,nw_src=42.42.42.1,nw_dst=66.66.66.66,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=0,tp_dst=80,tcp_flags=0
ct_lb {
ct_lb {
output("lsp2");
reg0[[6]] = 0;
*** chk_lb_hairpin_reply action not implemented;
reg0[[12]] = 0;
ct_lb /* default (use --ct to customize) */ {
output("lsp2");
};
};
};
])
Expand All @@ -3063,7 +3088,12 @@ AT_CHECK_UNQUOTED([ovn-trace --ct new --ct new --minimal ls "${flow}"], [0], [dn
# udp,reg14=0x${lsp1_inport},vlan_tci=0x0000,dl_src=00:00:00:00:00:01,dl_dst=00:00:00:00:00:02,nw_src=42.42.42.1,nw_dst=66.66.66.66,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=0,tp_dst=80
ct_lb {
ct_lb {
output("lsp2");
reg0[[6]] = 0;
*** chk_lb_hairpin_reply action not implemented;
reg0[[12]] = 0;
ct_lb /* default (use --ct to customize) */ {
output("lsp2");
};
};
};
])
Expand All @@ -3080,7 +3110,12 @@ AT_CHECK_UNQUOTED([ovn-trace --ct new --ct new --minimal ls "${flow}"], [0], [dn
# tcp,reg14=0x${lsp1_inport},vlan_tci=0x0000,dl_src=00:00:00:00:00:01,dl_dst=00:00:00:00:00:02,nw_src=42.42.42.1,nw_dst=66.66.66.66,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=0,tp_dst=80,tcp_flags=0
ct_lb {
ct_lb {
output("lsp2");
reg0[[6]] = 0;
*** chk_lb_hairpin_reply action not implemented;
reg0[[12]] = 0;
ct_lb /* default (use --ct to customize) */ {
output("lsp2");
};
};
};
])
Expand All @@ -3091,7 +3126,12 @@ AT_CHECK_UNQUOTED([ovn-trace --ct new --ct new --minimal ls "${flow}"], [0], [dn
# udp,reg14=0x${lsp1_inport},vlan_tci=0x0000,dl_src=00:00:00:00:00:01,dl_dst=00:00:00:00:00:02,nw_src=42.42.42.1,nw_dst=66.66.66.66,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=0,tp_dst=80
ct_lb {
ct_lb {
output("lsp2");
reg0[[6]] = 0;
*** chk_lb_hairpin_reply action not implemented;
reg0[[12]] = 0;
ct_lb /* default (use --ct to customize) */ {
output("lsp2");
};
};
};
])
Expand Down Expand Up @@ -5758,7 +5798,7 @@ flow="eth.dst == 00:00:00:00:01:00 && inport == \"rtr-ls\" && ip4.src == 42.42.4
AT_CHECK_UNQUOTED([ovn-trace --ct new --minimal "${flow}" --lb-dst 42.42.42.42:4242], [0], [dnl
# tcp,reg14=0x1,vlan_tci=0x0000,dl_src=00:00:00:00:00:00,dl_dst=00:00:00:00:01:00,nw_src=42.42.42.42,nw_dst=43.43.43.43,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=0,tp_dst=4343,tcp_flags=0
ct_dnat /* assuming no un-dnat entry, so no change */ {
ct_lb {
ct_lb /* default (use --ct to customize) */ {
ip.ttl--;
eth.src = 00:00:00:00:01:00;
eth.dst = 00:00:00:00:00:00;
Expand Down
6 changes: 5 additions & 1 deletion utilities/ovn-trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -2351,6 +2351,7 @@ execute_ct_lb(const struct ovnact_ct_lb *ct_lb,
const struct ovntrace_datapath *dp, struct flow *uflow,
enum ovnact_pipeline pipeline, struct ovs_list *super)
{
struct ds comment = DS_EMPTY_INITIALIZER;
struct flow ct_lb_flow = *uflow;

int family = (ct_lb_flow.dl_type == htons(ETH_TYPE_IP) ? AF_INET
Expand Down Expand Up @@ -2404,10 +2405,13 @@ execute_ct_lb(const struct ovnact_ct_lb *ct_lb,
}
ct_lb_flow.ct_state |= CS_DST_NAT;
}
ct_lb_flow.ct_state |= next_ct_state(&comment);
}

struct ovntrace_node *node = ovntrace_node_append(
super, OVNTRACE_NODE_TRANSFORMATION, "ct_lb");
super, OVNTRACE_NODE_TRANSFORMATION, "ct_lb%s",
ds_cstr_ro(&comment));
ds_destroy(&comment);
trace__(dp, &ct_lb_flow, ct_lb->ltable, pipeline, &node->subs);
}

Expand Down

0 comments on commit 8fd4cec

Please sign in to comment.