[ovs-dev] [PATCH] Allow OVS_USERSPACE_ATTR_USERDATA to be variable length.

Jesse Gross jesse at nicira.com
Sat Feb 16 01:36:00 UTC 2013


On Fri, Feb 15, 2013 at 4:48 PM, Ben Pfaff <blp at nicira.com> wrote:
> I tested this just now and found a bug: OVS_USERSPACE_ATTR_USERDATA in
> the action has to be translated to OVS_PACKET_ATTR_USERDATA in the
> kernel->user Netlink message, otherwise it gets interpreted as
> OVS_PACKET_ATTR_KEY.  So I applied the following incremental:
>
> diff --git a/datapath/datapath.c b/datapath/datapath.c
> index bc0b906..0920a30 100644
> --- a/datapath/datapath.c
> +++ b/datapath/datapath.c
> @@ -392,8 +392,9 @@ static int queue_userspace_packet(struct net *net, int dp_ifindex,
>         nla_nest_end(user_skb, nla);
>
>         if (upcall_info->userdata)
> -               nla_append(user_skb, NLA_ALIGN(upcall_info->userdata->nla_len),
> -                          upcall_info->userdata);
> +               __nla_put(user_skb, OVS_PACKET_ATTR_USERDATA,
> +                         upcall_info->userdata->nla_len - NLA_HDRLEN,

Is there a reason to not use nla_len() here?



More information about the dev mailing list