[libvirt] [PATCH 2/2] lxc: check actual type of interface not config type

Laine Stump posted 2 patches 7 years, 2 months ago
There is a newer version of this series
[libvirt] [PATCH 2/2] lxc: check actual type of interface not config type
Posted by Laine Stump 7 years, 2 months ago
virLXCControllerGetNICIndexes() was deciding whether or not to add the
ifindex for an interface's ifname to the list of ifindexes sent to
CreateMachineWithNetwork based on the interface type stored in the
config. This would be incorrect in the case of <interface
type='network'> where the network was giving out macvlan interfaces
tied to a physical device (i.e. when the actual interface type was
"direct").

Instead of checking the setting of "net->type", we should be checking
the setting of virDomainNetGetActualType(net).

I don't think this caused any actual misbehavior, it was just
technically wrong.

Signed-off-by: Laine Stump <laine@laine.org>
---
 src/lxc/lxc_controller.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index 1c20f451af..dad6abed3b 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -377,7 +377,8 @@ static int virLXCControllerGetNICIndexes(virLXCControllerPtr ctrl)
     VIR_DEBUG("Getting nic indexes");
     for (i = 0; i < ctrl->def->nnets; i++) {
         int nicindex = -1;
-        switch (ctrl->def->nets[i]->type) {
+
+        switch (virDomainNetGetActualType(ctrl->def->nets[i])) {
         case VIR_DOMAIN_NET_TYPE_BRIDGE:
         case VIR_DOMAIN_NET_TYPE_NETWORK:
         case VIR_DOMAIN_NET_TYPE_ETHERNET:
-- 
2.19.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 2/2] lxc: check actual type of interface not config type
Posted by Daniel P. Berrangé 7 years, 2 months ago
On Wed, Dec 05, 2018 at 09:35:13PM -0500, Laine Stump wrote:
> virLXCControllerGetNICIndexes() was deciding whether or not to add the
> ifindex for an interface's ifname to the list of ifindexes sent to
> CreateMachineWithNetwork based on the interface type stored in the
> config. This would be incorrect in the case of <interface
> type='network'> where the network was giving out macvlan interfaces
> tied to a physical device (i.e. when the actual interface type was
> "direct").
> 
> Instead of checking the setting of "net->type", we should be checking
> the setting of virDomainNetGetActualType(net).
> 
> I don't think this caused any actual misbehavior, it was just
> technically wrong.
> 
> Signed-off-by: Laine Stump <laine@laine.org>
> ---
>  src/lxc/lxc_controller.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list