Subject: Re: [PATCH 03/21] odp-util: Add tun_key to parse_odp_key_attr()

From: Ben Pfaff <[email-masked]>
Date: Thu, 24 May 2012 09:29:11 -0700

On Thu, May 24, 2012 at 06:08:56PM +0900, Simon Horman wrote:
> Cc: Kyle Mestery <[email-masked]>

But I don't see him CCed?

> +        ovs_be32 ipv4_src;
> +        ovs_be32 ipv4_dst;
> +        unsigned long long tun_flags;
> +        int ipv4_tos;
> +        int ipv4_ttl;
> +        int n = -1;
> +
> +        if (sscanf(s, "ipv4_tunnel(tun_id=%31[x0123456789abcdefABCDEF]"
> +                   ",flags=%llx,src="IP_SCAN_FMT",dst="IP_SCAN_FMT
> +                   ",tos=%i,ttl=%i)%n",
> +                   tun_id_s, &tun_flags,
> +                   IP_SCAN_ARGS(&ipv4_src), IP_SCAN_ARGS(&ipv4_dst),
> +                   &ipv4_tos, &ipv4_ttl, &n) > 0
> +            && n > 0) {

Does this compile?  I don't see a declaration of tun_id_s.

In the ODP printer and parser, we usually require fields that are
hexadecimal to be written with an explicit "0x" on output (using
something like "0x%x" or "%#x" on output), and then use "%i" on input,
so that it is always unambiguous at a glance whether a number is
decimal or hexadecimal.  I'd appreciate it if we could maintain that
here (I didn't look over at the printer code to see if it writes 0x,
but I'd like it to).

Otherwise, this looks good, thank you.