[libvirt] [PATCH 3/3] Forbid new-line char in name of new networks

Michal Privoznik mprivozn at redhat.com
Thu Oct 20 11:18:04 UTC 2016


On 20.10.2016 04:57, 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 | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
> index b2af482..a5a116a 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 (virXMLNodeHasIllegalChars("name", def->name, "\n"))
> +        return -1;
> +
>      /* Only the three L3 network types that are configured by libvirt
>       * need to have a bridge device name / mac address provided
>       */
> 

ACK here too.

Michal




More information about the libvir-list mailing list