Hi Lorenzo,

On 12/1/21 23:18, Lorenzo Bianconi wrote:
> When performing CT_LB action in ovn-trace, take into account current
> connection tracking state provided by the user.
> 
> Related bz: https://bugzilla.redhat.com/show_bug.cgi?id=1980702

The formal tag is "Reported-at:".  It's actually also what our
downstream tools search for.

> 
> Fixes: 8accd26cb2 ("OVN: add CT_LB action to ovn-trace")
> Signed-off-by: Lorenzo Bianconi <[email protected]>
> ---
>  tests/ovn-northd.at   | 56 ++++++++++++++++++++++++++++++++++++-------
>  utilities/ovn-trace.c |  3 +++
>  2 files changed, 51 insertions(+), 8 deletions(-)
> 
> diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at
> index f03d14082..1655c8e80 100644
> --- a/tests/ovn-northd.at
> +++ b/tests/ovn-northd.at
> @@ -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 {
> +            output("lsp2");
> +        };
>      };
>  };
>  ])
> @@ -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 {
> +            output("lsp2");
> +        };
>      };
>  };
>  ])
> @@ -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 {
> +            output("lsp2");
> +        };
>      };
>  };
>  ])
> @@ -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 {
> +            output("lsp2");
> +        };
>      };
>  };
>  ])
> @@ -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 {
> +            output("lsp2");
> +        };
>      };
>  };
>  ])
> @@ -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 {
> +            output("lsp2");
> +        };
>      };
>  };
>  ])
> @@ -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 {
> +            output("lsp2");
> +        };
>      };
>  };
>  ])
> @@ -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 {
> +            output("lsp2");
> +        };
>      };
>  };
>  ])
> diff --git a/utilities/ovn-trace.c b/utilities/ovn-trace.c
> index 617ad834c..419849f64 100644
> --- a/utilities/ovn-trace.c
> +++ b/utilities/ovn-trace.c
> @@ -2404,6 +2404,9 @@ execute_ct_lb(const struct ovnact_ct_lb *ct_lb,
>              }
>              ct_lb_flow.ct_state |= CS_DST_NAT;
>          }
> +        if (ct_state_idx < n_ct_states) {
> +            ct_lb_flow.ct_state |= ct_states[ct_state_idx];
> +        }

It's better to use next_ct_state() which will take care of incrementing
the ct_state_idx, something like:

ct_lb_flow.ct_state |= next_ct_state(&comment);

>      }
>  
>      struct ovntrace_node *node = ovntrace_node_append(
> 

Here we could append the comment to the trace node:

struct ovntrace_node *node = ovntrace_node_append(
    super, OVNTRACE_NODE_TRANSFORMATION, "ct_lb%s",
    ds_cstr_ro(&comment));

Thanks,
Dumitru

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

Reply via email to