Re: [PATCH v4] dots should be valid characters in interface names

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05/20/2010 09:12 AM, Chris Lalancette wrote:
On 05/20/2010 01:06 AM, Charles Duffy wrote:
On 05/19/2010 11:54 PM, Charles Duffy wrote:
A revised patch is attached. This lifts its logic from its kernel
counterpart, and is updated only to permit forward slashes (which, while
disallowed for interface names with the kernel, are required for
*device* names -- for which the ESX driver happens to overload this
field. Ugh).

Hm.  You know, I'm wondering if we should have "isValidIfname" at all in
domain_conf.c.  The thing is that if you think about different platforms
that this could be running on (Windows, Linux, Solaris, etc), and the
number of different drivers that go through here (Qemu, Xen, ESX, Virtualbox,
Phyp, openvz, ONE, UML), it seems like we have to allow everything to
cover all bases.  Indeed, there is very little else in domain_conf.c that
does validity checking, probably for just this reason.

Charles, Laine, what do you think about just removing this check completely?

WORKSFORME as well.

I'm presuming that it's still appropriate to check against an empty string. Does the attached look right? If so, I'll update the associated RHEL6 ticket [https://bugzilla.redhat.com/show_bug.cgi?id=593907] appropriately.
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 20c9c51..d4c2148 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -26,6 +26,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
+#include "c-ctype.h"
 #include <fcntl.h>
 #include <dirent.h>
 #include <sys/time.h>
@@ -1801,12 +1802,6 @@ cleanup:
 }
 
 
-static bool
-isValidIfname(const char *ifname) {
-    return ifname[strspn(ifname, VALID_IFNAME_CHARS)] == 0;
-}
-
-
 /* Parse the XML definition for a network interface
  * @param node XML nodeset to parse for net definition
  * @return 0 on success, -1 on failure
@@ -1891,7 +1886,7 @@ virDomainNetDefParseXML(virCapsPtr caps,
                 if ((ifname != NULL) &&
                     (((flags & VIR_DOMAIN_XML_INACTIVE) &&
                       (STRPREFIX((const char*)ifname, "vnet"))) ||
-                     (!isValidIfname(ifname)))) {
+                     (*ifname == 0))) {
                     /* An auto-generated target name, blank it out */
                     /* blank out invalid interface names */
                     VIR_FREE(ifname);
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index fadc8bd..c3bd4e8 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -298,9 +298,6 @@ struct _virDomainNetDef {
     virNWFilterHashTablePtr filterparams;
 };
 
-# define VALID_IFNAME_CHARS \
- "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_/"
-
 enum virDomainChrTargetType {
     VIR_DOMAIN_CHR_TARGET_TYPE_NULL = 0,
     VIR_DOMAIN_CHR_TARGET_TYPE_MONITOR,
--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]