From 11029c023a12dbe3f3569fcc22f25667686e417f Mon Sep 17 00:00:00 2001 From: Dwight Engen Date: Fri, 17 May 2013 18:28:12 -0400 Subject: [PATCH] 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 --- 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 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); -- 2.47.2