networkValidate: Forbid new-line char in network name

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 disappeared network which was already created with
new-line char in name.

Closes-Bug: https://bugzilla.redhat.com/show_bug.cgi?id=818064
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Sławek Kapłoński 2016-10-19 22:57:48 +02:00 committed by Michal Privoznik
parent e1b8196866
commit dc40dd6058

View File

@ -2973,6 +2973,9 @@ networkValidate(virNetworkDriverStatePtr driver,
bool bandwidthAllowed = true;
bool usesInterface = false, usesAddress = false;
if (virXMLCheckIllegalChars("name", def->name, "\n") < 0)
return -1;
/* Only the three L3 network types that are configured by libvirt
* need to have a bridge device name / mac address provided
*/