:fix(vpn):连接时如果为其他虚拟网络类型,也可执行(#190696)

This commit is contained in:
jzxc95 2023-09-08 11:34:55 +08:00
parent 45c1d17acb
commit 5c5d475747
1 changed files with 15 additions and 3 deletions

View File

@ -66,8 +66,14 @@ void KyVpnConnectOperation::getConnectionSetting(QString connectUuid, KyVpnConfi
connectSetting.m_ifaceName = connectionSettings->interfaceName(); connectSetting.m_ifaceName = connectionSettings->interfaceName();
connectSetting.m_isAutoConnect = connectionSettings->autoconnect(); connectSetting.m_isAutoConnect = connectionSettings->autoconnect();
if (connectionSettings->connectionType() != NetworkManager::ConnectionSettings::Vpn) { if (NetworkManager::ConnectionSettings::ConnectionType::Vpn != connectPtr->settings()->connectionType()
return ; && NetworkManager::ConnectionSettings::ConnectionType::Bond != connectPtr->settings()->connectionType()
&& NetworkManager::ConnectionSettings::ConnectionType::Bridge != connectPtr->settings()->connectionType()
&& NetworkManager::ConnectionSettings::ConnectionType::Vlan != connectPtr->settings()->connectionType()
&& NetworkManager::ConnectionSettings::ConnectionType::Team != connectPtr->settings()->connectionType()
&& NetworkManager::ConnectionSettings::ConnectionType::IpTunnel != connectPtr->settings()->connectionType()
&& NetworkManager::ConnectionSettings::ConnectionType::Wired != connectPtr->settings()->connectionType()) {
return;
} }
QDBusPendingReply<NMVariantMapMap> reply = connectPtr->secrets(KYVPN_VPN_KEY); QDBusPendingReply<NMVariantMapMap> reply = connectPtr->secrets(KYVPN_VPN_KEY);
@ -1481,7 +1487,13 @@ void KyVpnConnectOperation::activateVpnConnection(const QString connectUuid)
return; return;
} }
if (NetworkManager::ConnectionSettings::Vpn != connectPtr->settings()->connectionType()) { if (NetworkManager::ConnectionSettings::ConnectionType::Vpn != connectPtr->settings()->connectionType()
&& NetworkManager::ConnectionSettings::ConnectionType::Bond != connectPtr->settings()->connectionType()
&& NetworkManager::ConnectionSettings::ConnectionType::Bridge != connectPtr->settings()->connectionType()
&& NetworkManager::ConnectionSettings::ConnectionType::Vlan != connectPtr->settings()->connectionType()
&& NetworkManager::ConnectionSettings::ConnectionType::Team != connectPtr->settings()->connectionType()
&& NetworkManager::ConnectionSettings::ConnectionType::IpTunnel != connectPtr->settings()->connectionType()
&& NetworkManager::ConnectionSettings::ConnectionType::Wired != connectPtr->settings()->connectionType()) {
QString errorMessage = tr("the connect type is") QString errorMessage = tr("the connect type is")
+ connectPtr->settings()->connectionType() + connectPtr->settings()->connectionType()
+ tr(", but it is not vpn"); + tr(", but it is not vpn");