diff --git a/deluge/core/core.py b/deluge/core/core.py index 198410e318..867e3b0532 100644 --- a/deluge/core/core.py +++ b/deluge/core/core.py @@ -817,6 +817,11 @@ def set_config(self, config: Dict[str, Any]): continue self.config[key] = config[key] + @export + def is_valid_interface(self, interface: str) -> bool: + """Returns True is valid interface""" + return deluge.common.is_interface(interface) + @export def get_listen_port(self) -> int: """Returns the active listen port""" diff --git a/deluge/ui/console/modes/preferences/preference_panes.py b/deluge/ui/console/modes/preferences/preference_panes.py index b47bc4b079..afcb76945c 100644 --- a/deluge/ui/console/modes/preferences/preference_panes.py +++ b/deluge/ui/console/modes/preferences/preference_panes.py @@ -8,7 +8,6 @@ import logging -from deluge.common import is_interface from deluge.decorators import overrides from deluge.i18n import get_languages from deluge.ui.client import client @@ -91,11 +90,19 @@ def add_config_values(self, conf_dict): ) elif ipt.name == 'listen_interface': listen_interface = ipt.get_value().strip() - if is_interface(listen_interface) or not listen_interface: + if ( + client.is_daemon_version_equal_or_greater('2.1.1') + and client.core.is_valid_interface(listen_interface) + or not listen_interface + ): conf_dict['listen_interface'] = listen_interface elif ipt.name == 'outgoing_interface': outgoing_interface = ipt.get_value().strip() - if is_interface(outgoing_interface) or not outgoing_interface: + if ( + client.is_daemon_version_equal_or_greater('2.1.1') + and client.core.is_valid_interface(outgoing_interface) + or not outgoing_interface + ): conf_dict['outgoing_interface'] = outgoing_interface elif ipt.name.startswith('proxy_'): if ipt.name == 'proxy_type': diff --git a/deluge/ui/gtk3/preferences.py b/deluge/ui/gtk3/preferences.py index 3463b70c06..9857599616 100644 --- a/deluge/ui/gtk3/preferences.py +++ b/deluge/ui/gtk3/preferences.py @@ -676,15 +676,21 @@ def set_config(self, hide=False): 'chk_random_outgoing_ports' ).get_active() incoming_address = self.builder.get_object('entry_interface').get_text().strip() - if deluge.common.is_interface(incoming_address) or not incoming_address: + if ( + client.is_daemon_version_equal_or_greater('2.1.1') + and client.core.is_valid_interface(incoming_address) + or not incoming_address + ): new_core_config['listen_interface'] = incoming_address outgoing_address = ( self.builder.get_object('entry_outgoing_interface').get_text().strip() ) - if deluge.common.is_interface(outgoing_address) or not outgoing_address: - new_core_config['outgoing_interface'] = ( - self.builder.get_object('entry_outgoing_interface').get_text().strip() - ) + if ( + client.is_daemon_version_equal_or_greater('2.1.1') + and client.core.is_valid_interface(outgoing_address) + or not outgoing_address + ): + new_core_config['outgoing_interface'] = outgoing_address new_core_config['peer_tos'] = self.builder.get_object( 'entry_peer_tos' ).get_text() diff --git a/deluge/ui/web/js/deluge-all/preferences/NetworkPage.js b/deluge/ui/web/js/deluge-all/preferences/NetworkPage.js index 5ba98e7e26..1249196121 100644 --- a/deluge/ui/web/js/deluge-all/preferences/NetworkPage.js +++ b/deluge/ui/web/js/deluge-all/preferences/NetworkPage.js @@ -35,7 +35,7 @@ Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, { fieldset = this.add({ xtype: 'fieldset', border: false, - title: _('Incoming Address'), + title: _('Incoming Interface'), style: 'margin-bottom: 5px; padding-bottom: 0px;', autoHeight: true, labelWidth: 1,