Fix TAP device detection when using linux-cp

This commit is contained in:
2026-03-29 21:02:50 +02:00
parent d173b25b77
commit aec37f3371
3 changed files with 7 additions and 2 deletions

View File

@@ -1,3 +1,3 @@
"""Version information for vppcfg.""" """Version information for vppcfg."""
__version__ = "1.1.1" __version__ = "1.1.2"

View File

@@ -327,11 +327,14 @@ class PlannerSyncOperations(PlannerBase): # pylint: disable=too-few-public-meth
"""Synchronize the VPP Dataplane max frame size (link MTU), where 'shrink' determines the """Synchronize the VPP Dataplane max frame size (link MTU), where 'shrink' determines the
direction (if shrink is True, go from inner-most (QinQ) to outer-most (untagged), direction (if shrink is True, go from inner-most (QinQ) to outer-most (untagged),
and the other direction if shrink is False""" and the other direction if shrink is False"""
lcp_tap_sw_if_indexes = {lcp.host_sw_if_index for lcp in self.vpp.cache["lcps"].values()}
for _idx, vpp_iface in self.vpp.cache["interfaces"].items(): for _idx, vpp_iface in self.vpp.cache["interfaces"].items():
if vpp_iface.sub_number_of_tags != 0: if vpp_iface.sub_number_of_tags != 0:
continue continue
if vpp_iface.interface_dev_type in ["local", "Loopback", "VXLAN", "virtio"]: if vpp_iface.interface_dev_type in ["local", "Loopback", "VXLAN", "virtio"]:
continue continue
if vpp_iface.sw_if_index in lcp_tap_sw_if_indexes:
continue
_config_ifname, config_iface = interface.get_by_name( _config_ifname, config_iface = interface.get_by_name(
self.cfg, vpp_iface.interface_name self.cfg, vpp_iface.interface_name

View File

@@ -508,6 +508,7 @@ class VPPApi:
def get_phys(self): def get_phys(self):
"""Return all interfaces for which the super interface has the same sw_if_index """Return all interfaces for which the super interface has the same sw_if_index
and aren't known to be virtual interfaces""" and aren't known to be virtual interfaces"""
lcp_tap_sw_if_indexes = {lcp.host_sw_if_index for lcp in self.cache["lcps"].values()}
phys = [ phys = [
self.cache["interfaces"][x].interface_name self.cache["interfaces"][x].interface_name
for x in self.cache["interfaces"] for x in self.cache["interfaces"]
@@ -515,6 +516,7 @@ class VPPApi:
== self.cache["interfaces"][x].sup_sw_if_index == self.cache["interfaces"][x].sup_sw_if_index
and self.cache["interfaces"][x].interface_dev_type and self.cache["interfaces"][x].interface_dev_type
not in ["virtio", "BVI", "Loopback", "VXLAN", "local", "bond"] not in ["virtio", "BVI", "Loopback", "VXLAN", "local", "bond"]
and self.cache["interfaces"][x].sw_if_index not in lcp_tap_sw_if_indexes
] ]
return phys return phys
@@ -547,7 +549,7 @@ class VPPApi:
or False otherwise.""" or False otherwise."""
vpp_iface = self.get_interface_by_name(tap_ifname) vpp_iface = self.get_interface_by_name(tap_ifname)
if not vpp_iface or not vpp_iface.interface_dev_type == "virtio": if not vpp_iface:
return False return False
for _idx, lcp in self.cache["lcps"].items(): for _idx, lcp in self.cache["lcps"].items():