mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-06 04:28:29 +02:00
device: add nm_device_is_vpn() function
This commit is contained in:
parent
bf4b53d453
commit
7d87d2b8da
2 changed files with 18 additions and 0 deletions
|
|
@ -871,6 +871,22 @@ is_loopback (NMDevice *self)
|
||||||
&& NM_DEVICE_GET_PRIVATE (self)->ifindex == 1;
|
&& NM_DEVICE_GET_PRIVATE (self)->ifindex == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
nm_device_is_vpn (NMDevice *self)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (NM_IS_DEVICE (self), FALSE);
|
||||||
|
|
||||||
|
/* NetworkManager currently treats VPN connections (loaded from NetworkManager VPN plugins)
|
||||||
|
* differently. Those are considered VPNs.
|
||||||
|
* However, some native device types may also be considered VPNs...
|
||||||
|
*
|
||||||
|
* We should avoid distinguishing between is-vpn and "regular" devices. Is an (unencrypted)
|
||||||
|
* IP tunnel a VPN? Is MACSec on top of an IP tunnel a VPN?
|
||||||
|
* Sometimes we differentiate, but avoid unless reasonable. */
|
||||||
|
|
||||||
|
return NM_IS_DEVICE_WIREGUARD (self);
|
||||||
|
}
|
||||||
|
|
||||||
NMSettings *
|
NMSettings *
|
||||||
nm_device_get_settings (NMDevice *self)
|
nm_device_get_settings (NMDevice *self)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -881,4 +881,6 @@ struct _NMBtVTableNetworkServer {
|
||||||
const char *nm_device_state_to_str (NMDeviceState state);
|
const char *nm_device_state_to_str (NMDeviceState state);
|
||||||
const char *nm_device_state_reason_to_str (NMDeviceStateReason reason);
|
const char *nm_device_state_reason_to_str (NMDeviceStateReason reason);
|
||||||
|
|
||||||
|
gboolean nm_device_is_vpn (NMDevice *self);
|
||||||
|
|
||||||
#endif /* __NETWORKMANAGER_DEVICE_H__ */
|
#endif /* __NETWORKMANAGER_DEVICE_H__ */
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue