diff mbox series

[ovs-dev] ovn-trace: Make sure we don't exit when the port is not specified.

Message ID 20240409123636.897461-1-amusil@redhat.com
State Accepted
Delegated to: Dumitru Ceara
Headers show
Series [ovs-dev] ovn-trace: Make sure we don't exit when the port is not specified. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test fail github build: failed
ovsrobot/github-robot-_ovn-kubernetes fail github build: failed

Commit Message

Ales Musil April 9, 2024, 12:36 p.m. UTC
It might happen that the microflow doesn't have port specified or
the port is part of different datapath. In that case ovn-trace would
print warning and move to later crash on assert. Exit early instead
of crashing on assert.

Signed-off-by: Ales Musil <amusil@redhat.com>
---
 utilities/ovn-trace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Dumitru Ceara April 12, 2024, 2:33 p.m. UTC | #1
On 4/9/24 14:36, Ales Musil wrote:
> It might happen that the microflow doesn't have port specified or
> the port is part of different datapath. In that case ovn-trace would
> print warning and move to later crash on assert. Exit early instead
> of crashing on assert.
> 
> Signed-off-by: Ales Musil <amusil@redhat.com>
> ---
>  utilities/ovn-trace.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/utilities/ovn-trace.c b/utilities/ovn-trace.c
> index e0f1c3ec9..bfc94a73f 100644
> --- a/utilities/ovn-trace.c
> +++ b/utilities/ovn-trace.c
> @@ -3540,7 +3540,7 @@ trace(const char *dp_s, const char *flow_s)
>      }
>      uint32_t in_key = uflow.regs[MFF_LOG_INPORT - MFF_REG0];
>      if (!in_key) {
> -        VLOG_WARN("microflow does not specify ingress port");
> +        return xstrdup("microflow does not specify ingress port");
>      }
>      const struct ovntrace_port *inport = ovntrace_port_find_by_key(dp, in_key);
>      const char *inport_name = inport ? inport->friendly_name : "(unnamed)";

Thanks, Ales!

Applied to main and all stable branches down to 23.06.

Regards,
Dumitru
diff mbox series

Patch

diff --git a/utilities/ovn-trace.c b/utilities/ovn-trace.c
index e0f1c3ec9..bfc94a73f 100644
--- a/utilities/ovn-trace.c
+++ b/utilities/ovn-trace.c
@@ -3540,7 +3540,7 @@  trace(const char *dp_s, const char *flow_s)
     }
     uint32_t in_key = uflow.regs[MFF_LOG_INPORT - MFF_REG0];
     if (!in_key) {
-        VLOG_WARN("microflow does not specify ingress port");
+        return xstrdup("microflow does not specify ingress port");
     }
     const struct ovntrace_port *inport = ovntrace_port_find_by_key(dp, in_key);
     const char *inport_name = inport ? inport->friendly_name : "(unnamed)";