[ovs-dev] [PATCH 6/7] datapath: Convert odp_flow_key to use Netlink attributes instead.

Jesse Gross jesse at nicira.com
Tue Dec 28 21:48:23 UTC 2010


On Tue, Dec 28, 2010 at 2:06 PM, Ben Pfaff <blp at nicira.com> wrote:
> On Tue, Dec 28, 2010 at 02:13:47AM -0500, Jesse Gross wrote:
>> On Thu, Dec 23, 2010 at 8:15 PM, Ben Pfaff <blp at nicira.com> wrote:
>> > +{
>> > +       struct sk_buff *skb;
>> > +       int retval;
>> > +
>> > +       skb = alloc_skb(FLOW_BUFSIZE, GFP_KERNEL);
>> > +       if (!skb)
>> > +               return -ENOMEM;
>> > +
>> > +       retval = flow_to_nlattrs(swkey, skb);
>> > +       if (copy_to_user(ukey, skb->data, min(skb->len, ukey_len)))
>> > +               retval = -EFAULT;
>> > +       kfree_skb(skb);
>>
>> If the copy fails, this will leak the skb.
>
> I don't see how.

Sorry, I misread the assignment to retval as a return.

>> > diff --git a/lib/flow.h b/lib/flow.h
>> > index ee460e3..bbf35c7 100644
>> > --- a/lib/flow.h
>> > +++ b/lib/flow.h
>> > @@ -35,6 +35,10 @@ struct ofpbuf;
>> >  #define FLOW_N_REGS 4
>> >  BUILD_ASSERT_DECL(FLOW_N_REGS <= NXM_NX_MAX_REGS);
>> >
>> > +/* Used for struct flow's dl_type member for frames that have no Ethernet
>> > + * type, that is, pure 802.2 frames. */
>> > +#define FLOW_DL_TYPE_NONE 0
>>
>> OpenFlow uses 0x05ff to represent this.  Does it get translated anywhere?
>
> Yes, odp_flow_key_{to,from}_flow do the translation correctly.

Right, I agree that the kernel/userspace translation looks fine.  I
was wondering about userspace/OpenFlow.




More information about the dev mailing list