summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorSławek Kapłoński <slawek@kaplonski.pl>2016-10-19 22:57:48 +0200
committerMichal Privoznik <mprivozn@redhat.com>2016-10-20 19:10:42 +0800
commitdc40dd605800c560dec6ec73b7bbd922666e5d73 (patch)
tree062c3da301dc1eb100645f6b10f3205f4c37a583 /src/network
parente1b8196866c2c70bc7303ee69561e7f52edb8460 (diff)
downloadlibvirt-dc40dd605800c560dec6ec73b7bbd922666e5d73.tar.gz
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>
Diffstat (limited to 'src/network')
-rw-r--r--src/network/bridge_driver.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index b2af482725..9d7fc31f8f 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -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
*/