]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
return lxc generated name for veth pair
authorDwight Engen <dwight.engen@oracle.com>
Fri, 17 May 2013 22:28:12 +0000 (18:28 -0400)
committerSerge Hallyn <serge.hallyn@ubuntu.com>
Mon, 20 May 2013 14:27:30 +0000 (09:27 -0500)
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@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
src/lxc/confile.c

index fb851c98b0d1dfced7512a15ff284784f16aed35..a7db1178a32274f6941800465bfc2a3a778b3a79 100644 (file)
@@ -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);