[ovs-dev] [learn bugs 2/5] nx-match: Improve log message for errors parsing NX flow matches.

Ethan Jackson ethan at nicira.com
Tue Oct 18 18:33:10 UTC 2011


Looks good to me.

Does it make sense to guard the log message with a call to
vlog_is_enabled()?  That way we could avoid the memory allocation when
it isn't going to be used.  May not matter though.

Ethan

On Tue, Sep 27, 2011 at 13:36, Ben Pfaff <blp at nicira.com> wrote:
> ---
>  lib/nx-match.c |    7 +++++--
>  1 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/lib/nx-match.c b/lib/nx-match.c
> index 486f392..92a194d 100644
> --- a/lib/nx-match.c
> +++ b/lib/nx-match.c
> @@ -225,12 +225,15 @@ nx_pull_match(struct ofpbuf *b, unsigned int match_len, uint16_t priority,
>         }
>
>         if (error) {
> +            char *msg = ofputil_error_to_string(error);
>             VLOG_DBG_RL(&rl, "bad nxm_entry with vendor=%"PRIu32", "
>                         "field=%"PRIu32", hasmask=%"PRIu32", type=%"PRIu32" "
> -                        "(error %x)",
> +                        "(%s)",
>                         NXM_VENDOR(header), NXM_FIELD(header),
>                         NXM_HASMASK(header), NXM_TYPE(header),
> -                        error);
> +                        msg);
> +            free(msg);
> +
>             return error;
>         }
>
> --
> 1.7.4.4
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
>



More information about the dev mailing list