diff --git a/actor/src/actor_config_unmanaged.py b/actor/src/actor_config_unmanaged.py index 1c1f66c76..0f9866897 100755 --- a/actor/src/actor_config_unmanaged.py +++ b/actor/src/actor_config_unmanaged.py @@ -124,18 +124,19 @@ class UDSConfigDialog(QDialog): def saveConfig(self) -> None: # Ensure restrict_net is empty or a valid subnet restrictNet = self.ui.restrictNet.text().strip() - try: - subnet = udsactor.tools.strToNoIPV4Network(restrictNet) - if not subnet: - raise Exception('Invalid subnet') - except Exception: - QMessageBox.information( - self, - 'Invalid subnet', - 'Invalid subnet {}. Please, check it.'.format(restrictNet), - QMessageBox.Ok, - ) - return + if restrictNet: + try: + subnet = udsactor.tools.strToNoIPV4Network(restrictNet) + if not subnet: + raise Exception('Invalid subnet') + except Exception: + QMessageBox.information( + self, + 'Invalid subnet', + 'Invalid subnet {}. Please, check it.'.format(restrictNet), + QMessageBox.Ok, + ) + return # Store parameters on register for later use, notify user of registration self._config = udsactor.types.ActorConfigurationType( @@ -163,9 +164,9 @@ if __name__ == "__main__": app = QApplication(sys.argv) - #if udsactor.platform.operations.checkPermissions() is False: - # QMessageBox.critical(None, 'UDS Actor', 'This Program must be executed as administrator', QMessageBox.Ok) # type: ignore - # sys.exit(1) + if udsactor.platform.operations.checkPermissions() is False: + QMessageBox.critical(None, 'UDS Actor', 'This Program must be executed as administrator', QMessageBox.Ok) # type: ignore + sys.exit(1) if len(sys.argv) > 2: if sys.argv[1] == 'export': diff --git a/actor/src/udsactor/service.py b/actor/src/udsactor/service.py index 8bde46d4b..92b5412f8 100644 --- a/actor/src/udsactor/service.py +++ b/actor/src/udsactor/service.py @@ -397,7 +397,9 @@ class CommonService: # pylint: disable=too-many-instance-attributes ): # Not enouth data do check return - currentInterfaces = list(platform.operations.getNetworkInfo()) + currentInterfaces = tools.validNetworkCards( + self._cfg.restrict_net, platform.operations.getNetworkInfo() + ) old = self.serviceInterfaceInfo() new = self.serviceInterfaceInfo(currentInterfaces) if not new or not old: