From 47b2836aee40a1486e483142b412deb0f737b324 Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Wed, 2 Jun 2021 12:23:18 +1200 Subject: [PATCH] pretend virtual wlan (i.e. mac80211_hwsim) devices are real this allows their use for testing --- subiquitycore/models/network.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/subiquitycore/models/network.py b/subiquitycore/models/network.py index 6dbdb049..09de7da3 100644 --- a/subiquitycore/models/network.py +++ b/subiquitycore/models/network.py @@ -421,11 +421,18 @@ class NetworkModel(object): def new_link(self, ifindex, link): log.debug("new_link %s %s %s", ifindex, link.name, link.type) if link.type in NETDEV_IGNORED_IFACE_TYPES: + log.debug('ignoring based on type') return if not self.support_wlan and link.type == "wlan": + log.debug('ignoring based on support_wlan') return - if link.is_virtual and ( - link.type not in NETDEV_ALLOWED_VIRTUAL_IFACE_TYPES): + is_virtual = link.is_virtual + if link.type == "wlan": + # mac80211_hwsim nics show up as virtual but we pretend + # they are real for testing purposes. + is_virtual = False + if is_virtual and link.type not in NETDEV_ALLOWED_VIRTUAL_IFACE_TYPES: + log.debug('ignoring based on is_virtual') return dev = self.devices_by_name.get(link.name) if dev is not None: @@ -438,9 +445,10 @@ class NetworkModel(object): dev.info = link else: config = self.config.config_for_device(link) - if link.is_virtual and not config: + if is_virtual and not config: # If we see a virtual device without there already # being a config for it, we just ignore it. + log.debug('ignoring virtual device with no config') return dev = NetworkDev(self, link.name, link.type) dev.info = link