[ovs-dev] [PATCH] netdev: Allow explicit creation of netdev objects
Justin Pettit
jpettit at nicira.com
Wed Dec 2 04:48:37 UTC 2009
On Dec 1, 2009, at 6:22 PM, Jesse Gross wrote:
> Justin Pettit wrote:
>> diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
>> index 35724d9..e252782 100644
>> --- a/lib/dpif-netdev.c
>> +++ b/lib/dpif-netdev.c
>> @@ -373,9 +373,13 @@ do_add_port(struct dp_netdev *dp, const char *devname, uint16_t flags,
>> if (!internal) {
>> error = netdev_open(devname, NETDEV_ETH_TYPE_ANY, &netdev);
>> } else {
>> - char *tapname = xasprintf("tap:%s", devname);
>> - error = netdev_open(tapname, NETDEV_ETH_TYPE_ANY, &netdev);
>> - free(tapname);
>> + error = netdev_create(devname, "tap", NULL);
>> + if (!error) {
>> + error = netdev_open(devname, NETDEV_ETH_TYPE_ANY, &netdev);
>> + if (error) {
>> + netdev_destroy(devname);
>> + }
>> + }
>> }
>> if (error) {
>> return error;
>
> I don't think that the netdev created here is ever destroyed (in the non error case).
Good catch. I've put a fix in for that, but there seems to be some sloppy handling of netdevs when used as a bridge device. It doesn't seem to generally cause problems with the common case, but we should give the userspace datapath a thorough testing when we've got some time.
Thanks for the review. I went ahead and pushed with that change.
--Justin
More information about the dev
mailing list