]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
network: add ifindex field for host veth device
authorChristian Brauner <christian.brauner@ubuntu.com>
Thu, 31 Aug 2017 11:19:33 +0000 (13:19 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Thu, 31 Aug 2017 13:30:08 +0000 (15:30 +0200)
We should not just record the ifindex for the container's veth device but also
for the host's veth device. This is useful when {configuring,deconfiguring}
veth devices and becomes crucial when calling our lxc-user-nic setuid helper
where we rely on the ifindex to make decisions about whether we are licensed to
perform certain operations on the veth device in question.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/network.h

index 27d2c1e74170a413e5aacc0ac81d320486f45c54..3fbf2dd9b26d4e6adf834c4376bf02f0dde13a08 100644 (file)
@@ -79,9 +79,21 @@ struct lxc_route6 {
        struct in6_addr addr;
 };
 
+/* Contains information about the host side veth device.
+ * @pair    : Name of the host side veth device.
+ *            If the user requested that the host veth device be created with a
+ *            specific names this field will be set. If this field is set @veth1
+ *            is not set.
+ * @veth1   : Name of the host side veth device.
+ *            If the user did not request that the host veth device be created
+ *            with a specific name this field will be set. If this field is set
+ *            @pair is not set.
+ * @ifindex : Ifindex of the network device.
+ */
 struct ifla_veth {
-       char *pair; /* pair name */
-       char veth1[IFNAMSIZ]; /* needed for deconf */
+       char *pair;
+       char veth1[IFNAMSIZ];
+       int ifindex;
 };
 
 struct ifla_vlan {