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

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

 



On 05/20/2010 04:45 PM, Eric Blake wrote:
On 05/20/2010 03:06 PM, Charles Duffy wrote:
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.

Looks like Chris posted a similar patch, but I like yours better.  But
why the additional inclusion of "c-ctype.h"?

Accidental -- updated patch attached -- though I'm perfectly happy with Chris's version too (though it probably ought to clean up the now-unused VALID_IFNAME_CHARS).
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 20c9c51..7a2bccc 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1801,12 +1801,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 +1885,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]