[lxc-devel] [PATCH] return lxc generated name for veth pair

Serge Hallyn serge.hallyn at ubuntu.com
Mon May 20 14:06:58 UTC 2013


Quoting Dwight Engen (dwight.engen at oracle.com):
> Doing a get_config_item for lxc.network.0.veth.pair only returns the
> pair name if explicitly given, but it can be useful to know the name
> even if it is the one that lxc autogenerated.
> 
> Signed-off-by: Dwight Engen <dwight.engen at oracle.com>

Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>

> ---
>  src/lxc/confile.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/src/lxc/confile.c b/src/lxc/confile.c
> index fb851c9..a7db117 100644
> --- a/src/lxc/confile.c
> +++ b/src/lxc/confile.c
> @@ -1705,8 +1705,12 @@ static int lxc_get_item_nic(struct lxc_conf *c, char *retv, int inlen,
>  			strprint(retv, inlen, "%s", mode);
>  		}
>  	} else if (strcmp(p1, "veth.pair") == 0) {
> -		if (netdev->type == LXC_NET_VETH && netdev->priv.veth_attr.pair)
> -			strprint(retv, inlen, "%s", netdev->priv.veth_attr.pair);
> +		if (netdev->type == LXC_NET_VETH) {
> +			strprint(retv, inlen, "%s",
> +				 netdev->priv.veth_attr.pair ?
> +				  netdev->priv.veth_attr.pair :
> +				  netdev->priv.veth_attr.veth1);
> +		}
>  	} else if (strcmp(p1, "vlan") == 0) {
>  		if (netdev->type == LXC_NET_VLAN) {
>  			strprint(retv, inlen, "%d", netdev->priv.vlan_attr.vid);
> -- 
> 1.8.1.4
> 
> 
> ------------------------------------------------------------------------------
> AlienVault Unified Security Management (USM) platform delivers complete
> security visibility with the essential security capabilities. Easily and
> efficiently configure, manage, and operate all of your security controls
> from a single console and one unified framework. Download a free trial.
> http://p.sf.net/sfu/alienvault_d2d
> _______________________________________________
> Lxc-devel mailing list
> Lxc-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lxc-devel




More information about the lxc-devel mailing list