[ovs-dev] [PATCH 1/6] vxlan: Update netdev_vport_get_dpif_port() to support VXLAN port names

Kyle Mestery (kmestery) kmestery at cisco.com
Thu Feb 14 18:00:33 UTC 2013


On Feb 14, 2013, at 11:55 AM, Ben Pfaff <blp at nicira.com> wrote:
> On Thu, Feb 14, 2013 at 09:37:25AM -0500, Kyle Mestery wrote:
>> Modify netdev_vport_get_dpif_port() to return a name for
>> VXLAN ports which includes the destination UDP port number as a part of the
>> name.
>> 
>> Signed-off-by: Kyle Mestery <kmestery at cisco.com>
>> Acked-by: Ethan Jackson <ethan at nicira.com>
> 
> I applied the following incremental.  The only important change is
> changing <= to < since I believe that IFNAMSIZ has to include a
> terminating null.
> 
> Let me know if you see any problems quickly, I haven't pushed this yet.
> 
> diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c
> index 76efa74..d4a95f5 100644
> --- a/lib/netdev-vport.c
> +++ b/lib/netdev-vport.c
> @@ -119,8 +119,7 @@ netdev_vport_is_vxlan(const struct netdev *netdev)
>     const char *type = netdev_dev_get_type(dev);
> 
>     return (class->get_config == get_tunnel_config
> -        ? !strcmp("vxlan", type)
> -        : false);
> +            && !strcmp("vxlan", type));
> }
> 
> const char *
> @@ -140,7 +139,7 @@ netdev_vport_get_dpif_port(const struct netdev *netdev)
>          * port name below is 15 bytes. Still, assert here on the size of
>          * strlen(type) in case that changes in the future.
>          */
> -        ovs_assert((strlen(type) + 10) <= IFNAMSIZ);
> +        ovs_assert(strlen(type) + 10 < IFNAMSIZ);
>         snprintf(dpif_port_vxlan, IFNAMSIZ, "%s_sys_%d", type,
>                  ntohs(vport->tnl_cfg.dst_port));
>         return dpif_port_vxlan;

This looks fine to me, thanks Ben.


More information about the dev mailing list