[ovs-dev] [PATCH] ovs-vsctl: check if the device name is valid

Cong Wang xiyou.wangcong at gmail.com
Thu Oct 25 08:24:37 UTC 2012


On Wed, Oct 24, 2012 at 11:54 PM, Ben Pfaff <blp at nicira.com> wrote:
> On Wed, Oct 24, 2012 at 05:45:36PM +0800, Cong Wang wrote:
>> Before waiting for the kernel to reject an invalid name, we
>> can actually check it before going into the kernel. The code
>> is stolen from linux kernel function dev_valid_name(),
>> but it should apply to non-Linux arch as well, because
>> IFNAMSIZ is POSIX and other errors are obvious.
>>
>> After this patch I got:
>>
>> # ovs-vsctl add-port ovsbr0 12345678901234567890
>> ovs-vsctl: cannot create a port named 12345678901234567890 because the name is not valid
>> # ovs-vsctl add-br 12345678901234567890
>> ovs-vsctl: cannot create a bridge named 12345678901234567890 because the name is not valid
>
> I understand why this is an attractive patch, but it restricts what
> ovs-vsctl can do to what Linux can handle.  ovs-vsctl, and Open vSwitch,
> are meant to be more portable than that.  Different operating systems
> have different limits on the maximum length and the allowed format of
> port names.  I don't have the ESX source code right here, for example,
> but if I recall correctly the maximum length of a port name is much
> longer in ESX, and less restricted, than in Linux.

Hi, Ben,

As I mentioned above, I think it is not bad to apply the same restriction
to other arch than Linux, so that people don't need to modify their
openvswitch script for different arch. :)

And, IFNAMSIZ is POSIX, don't know why ESX doesn't define its
own.

Thanks.



More information about the dev mailing list