From: Christian Brauner Date: Thu, 31 Aug 2017 11:19:33 +0000 (+0200) Subject: network: add ifindex field for host veth device X-Git-Tag: lxc-2.0.9~48^2~33 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1482e8e0f6cd18a9cd2b6bd2031e4f2695d2a682;p=thirdparty%2Flxc.git network: add ifindex field for host veth device 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 --- diff --git a/src/lxc/network.h b/src/lxc/network.h index d4c98d2ed..173596969 100644 --- a/src/lxc/network.h +++ b/src/lxc/network.h @@ -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 {