mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-03 19:50:14 +01:00
manager: add _connection_is_vpn() helper to unify checks for VPN type
This commit is contained in:
parent
bdc622fd31
commit
7fcdca29b6
1 changed files with 19 additions and 4 deletions
|
|
@ -338,6 +338,23 @@ static NM_CACHED_QUARK_FCN ("autoconnect-root", autoconnect_root_quark)
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
static gboolean
|
||||
_connection_is_vpn (NMConnection *connection)
|
||||
{
|
||||
const char *type;
|
||||
|
||||
type = nm_connection_get_connection_type (connection);
|
||||
if (type)
|
||||
return nm_streq (type, NM_SETTING_VPN_SETTING_NAME);
|
||||
|
||||
/* we have an incomplete (invalid) connection at hand. That can only
|
||||
* happen during AddAndActivate. Determine whether it's VPN type based
|
||||
* on the existance of a [vpn] section. */
|
||||
return !!nm_connection_get_setting_vpn (connection);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static gboolean
|
||||
concheck_enabled (NMManager *self, gboolean *out_changed)
|
||||
{
|
||||
|
|
@ -4036,7 +4053,7 @@ _new_active_connection (NMManager *self,
|
|||
|
||||
specific_object = nm_utils_dbus_normalize_object_path (specific_object);
|
||||
|
||||
is_vpn = nm_connection_is_type (NM_CONNECTION (connection), NM_SETTING_VPN_SETTING_NAME);
|
||||
is_vpn = _connection_is_vpn (NM_CONNECTION (connection));
|
||||
|
||||
if (NM_IS_SETTINGS_CONNECTION (connection))
|
||||
settings_connection = (NMSettingsConnection *) connection;
|
||||
|
|
@ -4252,9 +4269,7 @@ validate_activation_request (NMManager *self,
|
|||
error))
|
||||
return NULL;
|
||||
|
||||
if ( nm_connection_get_setting_vpn (connection)
|
||||
|| nm_connection_is_type (connection, NM_SETTING_VPN_SETTING_NAME))
|
||||
is_vpn = TRUE;
|
||||
is_vpn = _connection_is_vpn (connection);
|
||||
|
||||
if (*out_device) {
|
||||
device = *out_device;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue