mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-20 03:30:09 +01:00
vpn: add new "listening" property to the VPN D-Bus API
Plugins can report that the connection is in "listening" mode. When they do, we don't require that the generic configuration contains all the parameters (like the external gateway), because they might not be known yet. Note that this new mechanism doesn't imply that we want to add support for full-fledged VPN servers in NetworkManager. However, some VPN technologies configure the two endpoints in a similar way. Think for example about IPsec in a host-to-host or subnet-to-subnet topology. NetworkManager is already capable of configuring both hosts, but lacked (until this commit) a way to say that one of them doesn't get the full IP configuration immediately.
This commit is contained in:
parent
09e74f30d3
commit
bb2767c7fe
2 changed files with 14 additions and 1 deletions
|
|
@ -124,6 +124,7 @@ typedef struct {
|
|||
typedef struct {
|
||||
gboolean service_can_persist;
|
||||
gboolean connection_can_persist;
|
||||
gboolean listening;
|
||||
|
||||
NMSettingsConnectionCallId *secrets_id;
|
||||
SecretsReq secrets_idx;
|
||||
|
|
@ -1856,8 +1857,13 @@ _config_process_generic(NMVpnConnection *self, GVariant *dict)
|
|||
NM_VPN_PLUGIN_CONFIG_EXT_GATEWAY,
|
||||
&priv->ip_data_6.gw_external);
|
||||
|
||||
if (g_variant_lookup(dict, NM_VPN_PLUGIN_CONFIG_LISTENING, "b", &v_b) && v_b) {
|
||||
/* Defaults to FALSE if not specified */
|
||||
priv->listening = TRUE;
|
||||
}
|
||||
|
||||
if (nm_ip_addr_is_null(AF_INET, &priv->ip_data_4.gw_external)
|
||||
&& nm_ip_addr_is_null(AF_INET6, &priv->ip_data_6.gw_external)) {
|
||||
&& nm_ip_addr_is_null(AF_INET6, &priv->ip_data_6.gw_external) && !priv->listening) {
|
||||
_LOGW("config: no VPN gateway address received");
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -197,6 +197,13 @@ typedef enum {
|
|||
/* boolean: Has IP6 configuration? */
|
||||
#define NM_VPN_PLUGIN_CONFIG_HAS_IP6 "has-ip6"
|
||||
|
||||
/* boolean: if %TRUE, the VPN plugin is listening for an incoming connection.
|
||||
* As such, it doesn't report all parameters (for example, the external gateway)
|
||||
* at the time the connection is activated. If the key is omitted, the value is
|
||||
* assumed to be %FALSE.
|
||||
*/
|
||||
#define NM_VPN_PLUGIN_CONFIG_LISTENING "listening"
|
||||
|
||||
/* boolean: If %TRUE the VPN plugin can persist/reconnect the connection over
|
||||
* link changes and VPN server dropouts.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue