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

Ben Pfaff blp at nicira.com
Thu Oct 25 15:20:28 UTC 2012


On Thu, Oct 25, 2012 at 04:24:37PM +0800, Cong Wang wrote:
> 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.
> 
> 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.

I think it does, and in fact to the same value 16 as Linux.  But on ESX
(as under Linux) there can be entities other than network devices on
datapaths, and those entities have different limits.  But I'm very new
to ESX and may not understand the entire story.

Furthermore, ovs-vsctl is meant to be generic in the sense that you can
use an ovs-vsctl built in one place (on one OS) to control a switch and
database running elsewhere (on another OS).  You don't want to apply the
local host's restrictions to changes to a remote db.

Thanks,

Ben.



More information about the dev mailing list