[ovs-dev] [PATCH 08/10] datapath: Use RCU dereference in vport_get_ifindex().

Jesse Gross jesse at nicira.com
Wed Dec 29 18:41:50 UTC 2010


On Wed, Dec 29, 2010 at 1:06 PM, Ben Pfaff <blp at nicira.com> wrote:
> On Tue, Dec 28, 2010 at 08:50:46PM -0800, Jesse Gross wrote:
>> If we don't have an ifindex for a device (because it is a virtual
>> port), we fall back to using the ifindex of the local port.
>> However, we weren't properly dereferencing the vport from the ports
>> array, so this adds that.  This isn't a real problem though, because
>> the local port always exists and never changes as long as the
>> datapath exists.
>>
>> Found with sparse.
>>
>> Signed-off-by: Jesse Gross <jesse at nicira.com>
>
> I can't remember why we do this.  Why not just return 0 in this case?

There's no particularly good reason to do it.  It's probably better to
return 0 than a valid but incorrect index, so I'll do that in a
followup patch.




More information about the dev mailing list