From: Dwight Engen Date: Fri, 17 May 2013 22:28:12 +0000 (-0400) Subject: return lxc generated name for veth pair X-Git-Tag: lxc-1.0.0.alpha1~1^2~203 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=11029c023a12dbe3f3569fcc22f25667686e417f;p=thirdparty%2Flxc.git return lxc generated name for veth pair 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 Signed-off-by: Serge Hallyn --- diff --git a/src/lxc/confile.c b/src/lxc/confile.c index fb851c98b..a7db1178a 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);