On 14.10.2016 04:53, Sławek Kapłoński wrote: > New line character in name of network is now forbidden because it > mess virsh output and can be confusing for users. > Validation of name is done in network driver, after parsing XML to avoid > problems with dissappeared network which was already created with > new-line char in name. > > Closes-Bug: https://bugzilla.redhat.com/show_bug.cgi?id=818064 > --- > src/network/bridge_driver.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c > index b2af482..df85884 100644 > --- a/src/network/bridge_driver.c > +++ b/src/network/bridge_driver.c > @@ -2973,6 +2973,12 @@ networkValidate(virNetworkDriverStatePtr driver, > bool bandwidthAllowed = true; > bool usesInterface = false, usesAddress = false; > > + if (virStringHasChars(def->name, "\n")) { > + virReportError(VIR_ERR_XML_ERROR, > + _("name %s cannot contain '\\n'"), def->name); > + return -1; > + } > + > /* Only the three L3 network types that are configured by libvirt > * need to have a bridge device name / mac address provided > */ > Good, you found the best place to have this check. Impressive. But if we go with my suggestion, this can be reduced to: if (virStringHasChars(def->name, "\n")) return -1; Also, any plans on turning some other checks in other drivers into using this wrapper? Michal -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list