]> 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>
Mon, 4 Sep 2017 11:19:11 +0000 (13:19 +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 d4c98d2ed85821f0bcca6f9ac25dffbd6b48a868..173596969094dbeb2b30a60a9ad28756cc61f192 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 {