@@ -675,6 +675,10 @@ async def wait_for_connection(timeout: int = 30) -> bool:
675675 existing_connection = await self ._find_existing_connection (credentials )
676676 if existing_connection :
677677 logger .info (f"Using existing connection for { credentials .ssid } on { interface_name } " )
678+ # Profiles created on older single-interface setups (or auto-bound by NetworkManager)
679+ # may have `interface-name` pinned to a specific device. Clear it so the same profile
680+ # can be activated on any interface, otherwise NM rejects with "mismatching interface name".
681+ await self ._unbind_connection_from_interface (existing_connection )
678682 await self ._nm .activate_connection (existing_connection , device_path , "/" )
679683
680684 # If hotspot was running, restart it
@@ -797,6 +801,22 @@ async def _find_existing_connection(self, credentials: WifiCredentials) -> Optio
797801 logger .error (f"Error finding existing connection: { e } " )
798802 return None
799803
804+ async def _unbind_connection_from_interface (self , conn_path : str ) -> None :
805+ """Clear the `interface-name` binding from a connection profile so it can be activated
806+ on any compatible device. Older profiles (or those auto-bound by NetworkManager) often
807+ pin themselves to a specific interface, which causes activation failures on others."""
808+ try :
809+ settings = NetworkConnectionSettings (conn_path , self ._bus )
810+ profile = await settings .get_profile ()
811+ bound = profile .connection .interface_name if profile .connection else None
812+ if not bound :
813+ return
814+ logger .info (f"Clearing interface-name binding ('{ bound } ') from connection profile { conn_path } " )
815+ profile .connection .interface_name = None
816+ await settings .update_profile (profile , save_to_disk = True )
817+ except Exception as e :
818+ logger .warning (f"Failed to clear interface-name binding from { conn_path } : { e } " )
819+
800820 # pylint: disable=too-many-branches,too-many-statements
801821 async def enable_hotspot_on_interface (self , interface : str , save_settings : bool = True ) -> bool :
802822 """Enable hotspot on a specific interface."""
0 commit comments